【发布时间】:2016-04-28 16:28:02
【问题描述】:
我想做一个看起来像谷歌搜索框的动画
我有一个文本路径,其中单词以“粗体”字体显示。
我想让单词动画化,使第一个字母出现“常规”,然后是第一个和第二个,然后是第一个第二个和第三个等等。
这可能与 svg 动画有关吗?
<svg width="100%" height="100%" viewBox="30 -50 600 500" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1">
<path id="path1">
<animate attributeName="d" from="m100,50 h0" to="m100,50 h1100" dur="5s" begin="0s" repeatCount="indefinite" />
</path>
// this text "types"
<text font-size="90" font-family="Montserrat" fill='black'>
<textPath xlink:href="#path1">Google is</textPath>
</text>
// I want this text to animate the "font-style"
<text font-size="90" font-family="Montserrat" fill='black' x="100" y="200">
Google is gold
<animate attributeType="CSS" .... />
</text>
【问题讨论】:
-
谢谢。我需要给每个
一个 id 来执行此操作吗?我也可以通过在 animate 标签中编写 font-style='regular' 并给每个标签设置不同的 begin="?s" 来制作动画吗? -
如果您希望它们链接,请在上一个的
<animation id>.end 事件上为每个设置动画