【发布时间】:2020-08-07 10:53:26
【问题描述】:
您好,我正在尝试使用 anime js 创建不同的动画,现在我想使用anime.js 创建带有打字机效果的文本动画,就像这里的demo live。
这是我目前所拥有的。
HTML:
<div class="text-animation">
Welcome to codingflag
</div>
css:
body {
margin:0px;
height:100vh;
display:flex;
align-items:center;
justify-content:center;
background:#222;
}
.text-animation {
color:#f5f5f5;
font-size:50px;
font-family:"Passion One",sans-serif;
letter-spacing:1px;
}
.text-animation .letter {
display:inline-block;
}
这里是js。
var element = document.getElementsByClassName("text-animation")[0];
element.innerHTML = element.textContent.replace(/\S/g,'<span class="letter">$&</span>');
anime.timeline({loop:true})
.add({
targets:'.text-animation .letter',
scale:[3,1],
opacity:[0,1],
translateZ:0,
duration:1000,
easing:"easeOutExpo",
delay:(elem, index) => index*70
})
.add({
targets:'.text-animation',
opacity:0,
duration:1000,
delay:1000,
easing:"easeOutExpo"
})
这是我的 CODPEN: type writer effect。
根据我上面提供的示例,我需要添加什么才能获得我想要的结果。?
【问题讨论】:
-
所以你的意思是你不想放大并且你还需要一个光标?对吗?
-
hej 我只想要这样的东西 css-tricks.com/snippets/css/typewriter-effect 但在anime.js中
-
你可以尝试修改这个:tobiasahlin.com/moving-letters/#11
标签: javascript html jquery css anime.js