第3天写了打字特效炫起来!
今天来个姊妹篇,手写字特效炫起来
!
已经默默进入SVG几天了...
老样子先来看成果!
底线是我用Adobe XD拉的~按下右键复制SVG code~(拉到後面有点丑 ಠ_ಠ
这个其实就是使用:dash-array
& dash-offset
的属性去做。
stroke-dasharray: 笔画的长度
stroke-dashoffset: 笔画的位置
算好dash-array 为可以包覆整个物件的长度後,
(不会算的就跟我一样手动试试长度 XD)
再调整dash-offset 移动他的位置,就会有在写字的效果罗~
不熟悉这两个属性的人可以到女神的codepen玩一下:试试看dasharray试试看dashoffset
stroke-dashoffset也可以像我之前的范例一样,
做出网页的进度条~传送门
上部分code!
//HTML
<div class="logo">
<svg width="600px" height="" viewBox="0 0 600 160">
<text
fill="none"
stroke="#fff"
x="0"
y="120"
stroke-width="5"
font-size="120"
font-family="'Raleway', sans-serif"
font-weight="800">
Hi Regina
</text>
<path class="underline" data-name="Path 1"
d="M107,318.31...省略"
transform="translate(60 -188.421)"
fill="none" stroke="#00BFFF" stroke-width="3"/>
</svg>
</div>
</div>
//SCSS
$color: #F3F3F3;
$stroke-width: 5px;
//文字的部分
text {
stroke-width: $stroke-width;
stroke-dasharray: 900;
stroke-dashoffset: -900;
animation: text 4s forwards 1;
animation-delay: 1s;
}
.underline{
stroke-dasharray: 900;
stroke-dashoffset: 900;
animation: underline 4s forwards 1;
animation-delay: 5s;
}
//文字的动态
@keyframes text {
75% {
fill: transparent;
stroke-dashoffset: 0;
stroke-width: $stroke-width;//先留着外框框
}
100% {
fill: $color; //让他上色~
stroke-dashoffset: 0;
stroke-width: 0;//把外框框消掉,不然会变很肥
}
}
//下底线的动态
@keyframes underline {
75% {
stroke-dashoffset: 0;
}
100% {
stroke-dashoffset: 0;
}
}
今天的 code: 在这里
今天的篇幅有点少,让我推荐一下资源~
推荐SVG女神 Cassie 的教学资源,网站也是做的超级棒?
不过她的动画很喜欢使用GSAP套件。
她在Google I/O大会的SVG演讲影片
https://www.youtube.com/watch?v=ADXX4fmWHbo
SVG基础一样推荐oxxostudio:
https://www.oxxostudio.tw/articles/201410/svg-tutorial.html
有任何错误或是问题欢迎批评指教!?
>>: Day18【Web】网路攻击:SQL injection
今天要来介绍 Bootstrap 工具、通用类别 在这章节中,最重要的就是要熟悉各种装置尺寸代号, ...
第二十七天 各位点进来的朋友,你们好阿 小的不才只能做这个系列的文章,但还是希望分享给点进来的朋友,...
在OE中的order_items和product_information资料表中,查询产品单价>...
今天简单操作测试Associations 有能力用原生Rspec语法去测任何东西,一定超强的,但是为...
快到结尾了,再让笔者水一篇 XDD,今天我们来聊聊 CNN 会不会是深度学习领域的最後呢? CNN...