From our sponsor: Leverage AI for dynamic, custom website builds with ease.
Today we’d like to share some inspiration for letter effects with you. We wanted to explore some simple, creative animations for display typography and large headlines using anime.js. These kind of animations can really enhance a certain message; combining these effects with a fitting font and playing with transforms opens up a huge range of possibilities. We hope this set inspires you and gives you some ideas on how to use an animation library like anime.js for this purpose.
For the effects we created a little plugin that can be used as follows:
// 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)
For more info on how to use anime.js, check out the documentation.
The essential stylesheet for the effect itself is lettereffect.css. Note that we’ve created a little slideshow script to navigate through the different words to showcase the effects.
Browser Support:- ChromeSupported
- FirefoxSupported
- Internet ExplorerSupported from version 11+
- SafariSupported
- OperaSupported
References and Credits
- anime.js by Julian Garnier
- Images by Unsplash.com and pngimg.com
- Charming.js by Yuan Qing
- imagesLoaded by Dave DeSandro
- Line Maker by Codrops