svg配合css3動畫_帶有Adobe Illustrator,HTML和CSS的任何網站的SVG動畫

svg配合css3動畫

A top trend in web design for 2020 is the increased use of SVG animations on web pages and in logo design. In this article, we will implement a simple and straight forward method to create relatively complex animation. We will use Adobe Illustrator, although a similar program capable of creating SVG files will suffice. On our web page we will use HTML and CSS to animate our SVG.

2020年網頁設計的主要趨勢是在網頁和徽標設計中增加使用SVG動畫。 在本文中,我們將實現一種簡單直接的方法來創建相對復雜的動畫。 我們將使用Adobe Illustrator,盡管能夠創建SVG文件的類似程序就足夠了。 在我們的網頁上,我們將使用HTML和CSS對SVG進行動畫處理。

In this tutorial, we will create the IRIS WEB CORE logo.

在本教程中,我們將創建IRIS WEB CORE徽標。

So let’s begin.

因此,讓我們開始吧。

Open Adobe Illustrator and hit “Create new…”, set the artboard width to 1300px and the height to 723px

打開Adobe Illustrator并單擊“ Create new…”,將畫板寬度設置為1300px,高度設置為723px

Type in some text and hit “ctrl + t” on your keyboard on PC or “Command + t” on Mac.

輸入一些文字,然后在PC上的鍵盤上按“ ctrl + t”,在Mac上按“ Command + t”。

Set the font size to “72pt”, the letter tracking to “100” and the font family to “Helvetica”

將字體大小設置為“ 72pt”,字母跟蹤設置為“ 100”,字體系列設置為“ Helvetica”

Image for post

Hit “Document Setup” and select “Edit Artboards”. Move the edges of the art board closer to the edges of the text.

點擊“文檔設置”,然后選擇“編輯畫板”。 將畫板的邊緣移到更靠近文本邊緣的位置。

Image for post

Select the text and set the Fill property to “None” and the Stroke property to “White” and “2pt”

選擇文本并將“填充”屬性設置為“無”,將“描邊”屬性設置為“白色”和“ 2pt”

Image for post

Go to “File” and “Save As”. Choose the destination for the file and select from the “Save as type” dropdown list “SVG (*.SVG)” and hit “Save”

轉到“文件”和“另存為”。 選擇文件的目標,然后從“另存為類型”下拉列表中選擇“ SVG(* .SVG)”,然后單擊“保存”

Image for post

From the following menu on the Fonts group select from the “Type:” dropdown list “Convert to outline”. Hit the “SVG Code…” button. In the text editor that will open remove the first two lines of code before the <svg></svg> tag.

從“字體”組的以下菜單中,從“類型:”下拉列表中選擇“轉換為輪廓”。 點擊“ SVG Code…”按鈕。 在打開的文本編輯器中,刪除<svg> </ svg>標記之前的前兩行代碼。

Image for post

Go to the bottom of the file and remove the unnecessary <g></g> tags

轉到文件底部,然后刪除不必要的<g> </ g>標記

Image for post

Copy the remaining code and paste it into your HTML document. Close Adobe Illustrator.

復制剩余的代碼并將其粘貼到HTML文檔中。 關閉Adobe Illustrator。

Image for post
Image for post

Remove the <style></style> tag from your html document as we will do the styling in the .css file.

從html文檔中刪除<style> </ style>標記,因為我們將在.css文件中進行樣式設置。

Image for post

To control the size of the SVG Logo and to keep it responsive we set a “max-width: 35em;” on its parent container “.iris-logo-wide”.

為了控制SVG徽標的大小并使其保持響應狀態,我們設置了“最大寬度:35em;” 在其父容器“ .iris-logo-wide”上。

Image for post

To animate our SVG we are concerned with adjusting the following parts of the SVG in our CSS — the “.st0” class and the <path></path> tag.

要為SVG設置動畫,我們需要調整CSS中SVG的以下部分-“ .st0”類和<path> </ path>標記。

Copy and paste the following code into your CSS file.

將以下代碼復制并粘貼到CSS文件中。

.st0{
fill:#000;
stroke:#000;
stroke-width:2;
stroke-miterlimit:10;
}path{
stroke:#000;
fill: #000;
stroke-dasharray:1800;
opacity: 10;
animation: animate 3s cubic-bezier(0,0.23,1,.1);
}@keyframes animate{
0%{
opacity:0;
fill:none;
stroke-dashoffset:1800;
}

30%{
opacity:1;
fill:none;
stroke-dashoffset:1800;
}

90%{
fill:rgba(0,0,0,0);
}
100%{
opacity: 1;
fill:rgba(0,0,0,0);
stroke-dashoffset:0;
}
}

We can set up the colors of the stroke and fill of our SVG in the “.st0” class and the <path></path> tag. We have set them up here to black #000. Notice that we started with a white #FFF stroke and no fill color. in Adobe Illustrator. This is valid for all the properties of the SVG, they can be changed in our .css file.

我們可以在“ .st0”類和<path> </ path>標記中設置筆劃和SVG填充的顏色。 我們將其設置為黑色#000。 請注意,我們從白色#FFF筆劃開始,沒有填充顏色。 在Adobe Illustrator中。 這對SVG的所有屬性均有效,可以在我們的.css文件中更改它們。

We want to animate the <path></path> tag so we create an animation “@keyframes animate”. At 0% we start with “opacity:0;” “fill:none;” “stroke-dashoffset:1800;” and at 100% we finish with “opacity: 1;” “fill:rgba(0,0,0,0);” “stroke-dashoffset:0;”.

我們要設置<path> </ path>標簽的動畫,因此我們創建了動畫“ @keyframes animate”。 在0%時,我們從“ opacity:0;”開始 “填充:無;” “ stroke-dashoffset:1800;” 并以100%的“不透明度:1”結束 “ fill:rgba(0,0,0,0);” “ stroke-dashoffset:0;”。

This is the result

這是結果

Image for post
Image for post

You can absolutely customise the animation. Notice that we have used a cubic-bezier animation above. Here is a good place to customize your animation https://cubic-bezier.com/

您可以絕對自定義動畫。 注意,我們在上面使用了三次方貝塞爾曲線動畫。 這是自定義動畫的好地方https://cubic-bezier.com/

Find the full code for our web page below

在下面找到我們網頁的完整代碼

HTML

HTML

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1.0"><title>iris Web Core</title>


<meta name="description" content="IRIS WEB CORE is a Website Design and Digital Marketing Agency experienced in delivering customers through attractive design, strategic SEO and Social Media management." /><meta name="author" content="COPYRIGHT 2020 IRIS WEB CORE LTD ALL RIGHTS RESERVED (developed with care by Fabio Aleksiev at irisWebCore)" />



<link href="site.css" rel="stylesheet" type="text/css">

</head><body><div class="hero"><div class="iris-logo-wide">

<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 640 72" style="enable-background:new 0 0 640 72;" xml:space="preserve"><g>
<path class="st0" d="M7.1,9.9h7.1v51.6H7.1V9.9z"/>
<path class="st0" d="M33.5,9.9h23.9c3.9,0,7.2,0.6,9.7,1.7c4.9,2.2,7.3,6.3,7.3,12.2c0,3.1-0.6,5.6-1.9,7.6c-1.3,2-3.1,3.6-5.4,4.7
c2,0.8,3.5,1.9,4.6,3.2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7.3L197.3,9.9H204.9z
"/>
<path class="st0" d="M277.3,9.9H315v6.3h-30.8v15.7h28.5v6h-28.5v17.5h31.4v6.2h-38.2V9.9z"/>
<path class="st0" d="M331.7,9.9h22.2c6,0,10.3,1.8,12.9,5.4c1.5,2.1,2.3,4.6,2.3,7.4c0,3.3-0.9,5.9-2.8,8c-1,1.1-2.3,2.1-4.1,3
c2.6,1,4.6,2.1,5.9,3.4c2.3,2.3,3.5,5.4,3.5,9.3c0,3.3-1,6.3-3.1,9c-3.1,4-8.1,6-14.9,6h-21.8V9.9z M351.3,31.7
c3,0,5.3-0.4,6.9-1.2c2.6-1.3,3.9-3.6,3.9-7c0-3.4-1.4-5.6-4.1-6.8c-1.5-0.7-3.8-1-6.9-1h-12.5v16H351.3z M353.7,55.5
c4.3,0,7.3-1.2,9.2-3.7c1.1-1.6,1.7-3.5,1.7-5.7c0-3.7-1.7-6.3-5-7.7c-1.8-0.7-4.1-1.1-7.1-1.1h-13.9v18.2H353.7z"/>
<path class="st0" d="M451.3,13.6c3.6,3.4,5.6,7.4,6,11.7h-6.8c-0.8-3.3-2.3-6-4.6-7.9c-2.3-1.9-5.5-2.9-9.7-2.9
c-5.1,0-9.2,1.8-12.3,5.4c-3.1,3.6-4.7,9.1-4.7,16.4c0,6,1.4,11,4.2,14.7s7,5.6,12.6,5.6c5.2,0,9.1-2,11.8-5.9
c1.4-2.1,2.5-4.8,3.2-8.2h6.8c-0.6,5.4-2.6,10-6,13.7c-4.1,4.4-9.6,6.6-16.6,6.6c-6,0-11-1.8-15.1-5.4c-5.4-4.8-8.1-12.2-8.1-22.3
c0-7.6,2-13.9,6-18.7c4.4-5.3,10.4-7.9,18-7.9C442.6,8.4,447.7,10.2,451.3,13.6z"/>
<path class="st0" d="M516.1,17.2c3.4,4.6,5.1,10.4,5.1,17.5c0,7.7-2,14.1-5.9,19.2c-4.6,6-11.1,9-19.7,9c-7.9,0-14.2-2.6-18.7-7.9
c-4.1-5.1-6.1-11.5-6.1-19.2c0-7,1.7-13,5.2-17.9c4.5-6.4,11-9.6,19.8-9.6C504.9,8.4,511.7,11.4,516.1,17.2z M509.9,50.1
c2.8-4.4,4.1-9.5,4.1-15.2c0-6.1-1.6-11-4.8-14.7c-3.2-3.7-7.5-5.6-13-5.6c-5.3,0-9.7,1.8-13.1,5.5c-3.4,3.7-5.1,9.1-5.1,16.2
c0,5.7,1.4,10.5,4.3,14.5c2.9,3.9,7.6,5.9,14.1,5.9C502.7,56.8,507.1,54.5,509.9,50.1z"/>
<path class="st0" d="M537.6,9.9h23.9c3.9,0,7.2,0.6,9.7,1.7c4.9,2.2,7.3,6.3,7.3,12.2c0,3.1-0.6,5.6-1.9,7.6s-3.1,3.6-5.4,4.7
c2,0.8,3.5,1.9,4.6,3.2s1.6,3.5,1.7,6.5l0.2,6.9c0.1,2,0.2,3.4,0.5,4.4c0.4,1.6,1.2,2.7,2.3,3.2v1.2h-8.6c-0.2-0.4-0.4-1-0.6-1.7
s-0.3-2.1-0.4-4.1l-0.4-8.6c-0.2-3.4-1.4-5.6-3.8-6.8c-1.3-0.6-3.4-0.9-6.3-0.9h-15.9v22.1h-7V9.9z M560.7,33.5
c3.3,0,5.9-0.7,7.8-2c1.9-1.3,2.9-3.7,2.9-7.1c0-3.7-1.3-6.2-4-7.5c-1.4-0.7-3.3-1.1-5.7-1.1h-17.1v17.6H560.7z"/>
<path class="st0" d="M596.6,9.9h37.7v6.3h-30.8v15.7h28.5v6h-28.5v17.5h31.4v6.2h-38.2V9.9z"/>
</g>
</svg></div></div></body></html>

CSS

CSS

@charset "UTF-8";
/* CSS Document */html,
html * {
padding: 0;
margin: 0 auto;
box-sizing: border-box;
max-width: 1300px;
}.iris-logo-wide {
margin: 0 auto;
max-width: 35em;}body {

padding: 1em;
height: 100em;
background-image: url("https://s3.wasabisys.com/core/Model_G_@80.jpg");
background-repeat: no-repeat;
background-position: top;
background-size: cover;

}.st0{
fill:#000;
stroke:#000;
stroke-width:2;
stroke-miterlimit:10;
}path{
stroke:#000;
fill: #000;
stroke-dasharray:1800;
opacity: 10;
animation: animate 3s cubic-bezier(0,0.23,1,.1);
}@keyframes animate{
0%{
opacity:0;
fill:none;
stroke-dashoffset:1800;
}

30%{
opacity:1;
fill:none;
stroke-dashoffset:1800;
}

90%{
fill:rgba(0,0,0,0);
}
100%{
opacity: 1;
fill:rgba(0,0,0,0);
stroke-dashoffset:0;
}
}

Get Adobe Illustrator from here https://www.adobe.com/products/illustrator.html

從這里https://www.adobe.com/products/illustrator.html獲取Adobe Illustrator

That is it my friends, if you liked this article visit our Facebook page and our website IRIS WEB CORE.

就是我的朋友們,如果您喜歡這篇文章,請訪問我們的Facebook頁面和我們的網站IRIS WEB CORE 。

And as always have a great day!

一如既往的美好!

Find me on LinkedIn: https://www.linkedin.com/in/fabio-aleksiev-irsctx

在LinkedIn上找到我: https : //www.linkedin.com/in/fabio-aleksiev-irsctx

翻譯自: https://uxdesign.cc/svg-animation-for-any-website-with-adobe-illustrator-html-and-css-87acaf1a2044

svg配合css3動畫

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/274219.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/274219.shtml
英文地址,請注明出處:http://en.pswp.cn/news/274219.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

【原創-長文】openstack 版本D安裝配置及本次安裝中遇到的問題

openstack配置 一、硬件及操作系統要求 硬件&#xff1a;IBM服務器R410 兩臺、網線、顯示器、鍵盤若干&#xff0c;100M光纖&#xff08;硬性要求&#xff09; 操作系統&#xff1a;兩臺服務器均安裝Ubuntu server 12.04 LTS 二、安裝步驟&#xff08;server-1與server-2公共部…

基于pt100溫度計仿真_基于8pt網格的設計系統

基于pt100溫度計仿真重點 (Top highlight)This article is the 2nd in a two part series — to the previous chapter in which I demonstrate how to establish an 8pt grid.本文是該系列文章的第二部分 &#xff0c;這是上一章 的第二部分 &#xff0c;在上一章中&#xff0…

GL ERROR - after deleteUnusedTextures() glError (0x502)

最近用百度提供的javascript API開發地圖時&#xff0c;html頁面在手機瀏覽器中拖動地圖時會出現GL ERROR - after deleteUnusedTextures() glError (0x502)的異常&#xff0c;看了下國外論壇異常的說法&#xff0c;經調試&#xff0c;找出解決辦法&#xff0c;異常原因還是和布…

利用 k8s 建立軟件商店_為企業建立應用商店

利用 k8s 建立軟件商店It’s June 2019. I’m sitting in a conference room in Research Triangle Park in North Carolina. At the end of the table are the two executives that have been tapped to lead a new endeavor on behalf of IBM’s $34 billion acquisition of …

[轉]gcc生成動態庫靜態庫

http://blog.csdn.net/hzn407487204/article/details/5323254轉載于:https://www.cnblogs.com/hengli/archive/2013/06/07/3125354.html

蘋果復興_類型復興的故事:來自Type West的經驗教訓

蘋果復興Last Fall, I began the 去年秋天&#xff0c;我開始 在舊金山的Type West program at the Letterform檔案庫中Letterform Archive in San Francisco. For those of you who don’t know, the Letterform Archive is creative heaven — a type nerd’s letter art co…

C#調用ATL COM

作者&#xff1a;朱金燦 來源&#xff1a;http://blog.csdn.net/clever101 簡單介紹C#程序如何調用ATL編寫的COM組件。 首先新建一個ATL工程&#xff0c;具體如下&#xff1a; 1. 填寫工程名稱和路徑&#xff0c;如下圖&#xff1a; 2. 選擇工程的服務器類型為動態鏈接庫&a…

浪潮世科和浪潮軟件什么關系_社交圖形浪潮

浪潮世科和浪潮軟件什么關系Nowadays, the cornucopia of graphics seems like a given. However, it was not so long ago that infographics were scarce and lived in closed ecosystems. The majority of graphics were published in newspapers, magazines, or books, and…

PHP圖形圖像的典型應用 --常用圖像的應用(驗證碼)

php生成動態的驗證碼&#xff0c;是php防止惡意登陸或者注冊等常規手段-廢話不多說&#xff0c;直接看例子。&#xff08;只是一個簡單的應用&#xff0c;如果要安全或者更復雜的&#xff0c;請期待我以后的文章&#xff09; PHP生成驗證碼核心文件 (checks.php): <?php/*成…

接口練習

前臺代碼&#xff1a; <form id"form1" runat"server"> <div> 見面時間:<asp:TextBox ID"MeetTime" runat"server"></asp:TextBox><br /> 見面地點:<asp:TextBox ID"MeetAddr…

寫saas創業的書_我在SaaS創業公司擔任UX設計師的第一個月中學到的三件事

寫saas創業的書I recently transitioned from being a copywriter at an ad agency to a UX Designer at a SaaS startup. To add more multidisciplinary skills into the mix, I graduated with a Bachelor in Accountancy.我最近從一名廣告代理商的撰稿人過渡到了SaaS初創公…

ui項目答辯中學到了什么_我在UI設計9年中學到的12件事

ui項目答辯中學到了什么重點 (Top highlight)I know these can seem a bit clich but I will try to explain everything from my own experience.我知道這些內容似乎有些陳詞濫調&#xff0c;但我會嘗試根據自己的經驗來解釋所有內容。 第一名 (No.1 Never assume) The first…

linux下命令行的使用:使用sed命令操作文件

用該命令sed刪除文件test.txt中包含某個字符串abc的行: sed /adc/d test.txt >result.txt 在文件test.txt中刪除從開頭到含有某個字符串abc的行 sed 1,/abc/d test.txt >result.txt 獲取文件test.txt中包含字符串abc的行 cat test.txt |grep "abc" > resul…

ux的重要性_UX中清晰的重要性

ux的重要性重點 (Top highlight)Times, since the very first occurrences of web design in the 90’s, have changed a lot design-wise. The particular technology and its applications got more stable. Human-computer interaction (HCI) was deeply researched, design…

工欲善其事,必先利其器

vs2010中一些常用的快捷鍵、組合鍵&#xff1a; 1、快速格式化 CtrlED 2、注釋選中部分 CtrlEC 3、停止調試 ShiftF5 4、取消注釋選中部分 CtrlEU 5、顯示解決方案資源管理器 CtrlWS 6、快速折疊 CtrlMO 7、封裝一個字段 CtrlRE 8、查看屬性 CtrlWP 9…

可靠消息最終一致性設計_如何最終啟動您的設計產品組合

可靠消息最終一致性設計It’s not a secret that most designers procrastinate on their portfolios whether it is to update them or to create them in the first place.大多數設計師在更新產品組合時還是拖延產品組合并不是秘密。 首先創建它們 。 Hopefully, by the e…

臺式機共享筆記本的無線網絡(只需要一根網線)

以windowsXP系統為例 一、筆記本的設置方法&#xff1a; 1.先將筆記本的無線連接共享給有線網卡 將鼠標放到桌面的 網上鄰居 上&#xff0c;按鼠標右鍵&#xff0c;選屬性&#xff0c;再將鼠標放到無線連接上&#xff0c;又是按鼠標右鍵&#xff0c;選屬性&#xff0c;在彈出的…

游戲用戶體驗指標_電子游戲如何超越游戲化的用戶體驗

游戲用戶體驗指標游戲UX (GAMES UX) During a time when the time spent on video games has reached record breaking heights, due to excessive time indoors, gamification has more of a place now than ever before.d uring的時候花在視頻游戲的時間已經達到了 破紀錄的高…

JAVA編程心得-JAVA實現CRC-CCITT(XMODEM)算法

CRC即循環冗余校驗碼&#xff08;Cyclic Redundancy Check&#xff09;&#xff1a;是數據通信領域中最常用的一種差錯校驗碼&#xff0c;其特征是信息字段和校驗字段的長度可以任意選定。 1 byte checksum CRC-16 CRC-16 (Modbus) CRC-16 (Sick) …

什么字體字母和數字大小一樣_字母和字體如何適應我們的屏幕

什么字體字母和數字大小一樣Writing went through many iterations before it became what is today. Times New Roman wasn’t the default script for ancient Egyptians, in fact, paper didn’t even exist when the first words were written.寫作經歷了許多迭代&#xff…