18种基于anime.js的文字动画特效

黄舟
黄舟 原创
2017-01-18 14:25:54 1824浏览

简要教程

这是一款基于anime.js的文字动画特效。这些文字效果是通过前后导航按钮切换文字时,制作不同的文字动画特效。

使用方法

下面是其中一种文字动画特效的GIF动态图片演示效果:

336.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的文字动画特效的内容,更多相关内容请关注PHP中文网(m.sbmmt.com)!


声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。