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

这是一款基于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/

在线预览    源码下载

爱编程-编程爱好者经验分享平台
版权所有 爱编程 © Copyright 2012. All Rights Reserved.
闽ICP备12017094号-3