简要教程
这是一款基于anime.js的文字动画特效。这些文字效果是通过前后导航按钮切换文字时,制作不同的文字动画特效。
使用方法
下面是其中一种文字动画特效的gif动态图片演示效果:
制作这组文字动画特效的js代码类似下面的样子:
// initialize
var txt = new textfx(this.el.queryselector('.title'));
// show letters:
// txt.show([effect] [,callback]);
// if nothing is passed, then there's no animation.
// ´effect´ can either be one of the predefined effects: ['fx1',...,'fx17'] or
// an object literal representing both, in and out animations (anime.js based).
// example:
effect = {
in: {
duration: 500,
delay: function(el, index) {
return 250+index*40;
},
easing: 'easeoutexpo',
opacity: 1,
translatey: ['50%','0%']
},
out: {
duration: 500,
delay: function(el, index) {
return index*40;
},
easing: 'easeoutexpo',
opacity: 0,
translatey: '-50%'
}
}
// ´callback´ is the callback function, after all the letters finished the animation.
// hide letters:
// txt.hide([effect] [,callback]); (same logic of show)
关于anime.js更详细的用法,可以参考它的说明文档。
该文字动画特效的原文地址为:http://tympanus.net/codrops/2016/10/18/inspiration-for-letter-effects/
以上就是18种基于anime.js的文字动画特效的内容。