Top Related Projects
JavaScript animation engine
🍿 A cross-browser library of CSS animations. As easy to use as an easy thing.
Animate on scroll library
Reveal CSS animation as you scroll down a page
A lightweight JavaScript library for creating particles
GSAP (GreenSock Animation Platform), a JavaScript animation library for the modern web
Quick Overview
Textillate.js is a jQuery plugin that applies CSS3 text animations to any text. It allows developers to easily add eye-catching text animations to their web projects, combining the power of CSS3 animations with the flexibility of lettering.js to deliver dynamic and engaging text effects.
Pros
- Easy to implement with minimal setup required
- Offers a wide variety of text animation effects
- Highly customizable with options for in and out animations, loop, sync, and more
- Lightweight and performant, utilizing CSS3 animations
Cons
- Depends on jQuery and lettering.js, which may not be ideal for modern projects
- Limited to text animations only, not suitable for more complex animations
- May not be actively maintained (last commit was in 2016)
- Potential accessibility issues if not implemented carefully
Code Examples
- Basic usage:
$('.tlt').textillate();
This code applies the default animation to elements with the class 'tlt'.
- Custom options:
$('.tlt').textillate({
in: { effect: 'rollIn' },
out: { effect: 'rollOut', sync: true },
loop: true
});
This example sets custom in and out animations, enables syncing for the out animation, and sets the animation to loop.
- Callback functions:
$('.tlt').textillate({
in: { effect: 'fadeInLeft' },
out: { effect: 'fadeOutRight', sync: true },
callback: function () {
console.log('The animation is complete!');
}
});
This code demonstrates how to use a callback function that runs after the animation is complete.
Getting Started
- Include the necessary files in your HTML:
<link rel="stylesheet" href="assets/animate.css">
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="assets/jquery.lettering.js"></script>
<script src="jquery.textillate.js"></script>
- Add the class 'tlt' to the elements you want to animate:
<h1 class="tlt">This headline will be animated</h1>
- Initialize Textillate in your JavaScript:
$(function () {
$('.tlt').textillate();
});
This will apply the default animation to all elements with the 'tlt' class. You can customize the animation by passing options to the textillate() function as shown in the code examples above.
Competitor Comparisons
JavaScript animation engine
Pros of anime
- More versatile, capable of animating various properties beyond just text
- Supports a wider range of animation types and easing functions
- Actively maintained with regular updates and a larger community
Cons of anime
- Steeper learning curve due to its broader functionality
- Larger file size, which may impact page load times for simpler projects
- Requires more setup for basic text animations compared to Textillate
Code Comparison
Textillate:
$('.tlt').textillate({
in: { effect: 'fadeInLeft' },
out: { effect: 'fadeOutRight', sync: true },
loop: true
});
anime:
anime({
targets: '.text',
opacity: [0, 1],
translateX: ['-100%', '0%'],
easing: 'easeOutExpo',
duration: 1000,
delay: (el, i) => 50 * i
});
Summary
While Textillate is specifically designed for text animations and offers a simpler API for this purpose, anime provides a more comprehensive animation solution for various elements and properties. Textillate is easier to use for basic text animations, but anime offers greater flexibility and ongoing development. The choice between the two depends on the project's specific requirements and the developer's familiarity with animation libraries.
🍿 A cross-browser library of CSS animations. As easy to use as an easy thing.
Pros of animate.css
- More comprehensive animation library with a wider range of effects
- Easier to implement for general-purpose animations across entire web pages
- Actively maintained with frequent updates and a large community
Cons of animate.css
- Less specialized for text animations compared to Textillate
- May require more custom CSS for fine-tuning text-specific animations
- Larger file size due to its broader scope of animations
Code Comparison
Textillate:
$('.tlt').textillate({
in: { effect: 'rollIn' },
out: { effect: 'rollOut', sync: true },
loop: true
});
animate.css:
<h1 class="animate__animated animate__bounce">An animated element</h1>
.animate__animated {
animation-duration: 1s;
animation-fill-mode: both;
}
Textillate is specifically designed for text animations, offering more granular control over letter-by-letter effects. It provides a simple API for chaining multiple text animations. animate.css, on the other hand, is a more versatile animation library that can be applied to any HTML element, not just text. It offers a wider range of animation types but may require additional JavaScript for complex text animations.
Animate on scroll library
Pros of AOS
- More versatile, offering various animation effects for scrolling
- Actively maintained with recent updates and larger community support
- Easier to implement for scroll-based animations across entire pages
Cons of AOS
- Limited to scroll-based animations, less suitable for text-specific effects
- May have a larger performance impact on complex pages with many animated elements
- Requires more setup for custom animations compared to Textillate's text-focused approach
Code Comparison
Textillate:
$('.tlt').textillate({
in: { effect: 'rollIn' },
out: { effect: 'rollOut', sync: true },
loop: true
});
AOS:
<div data-aos="fade-up" data-aos-duration="1000">
Animated content
</div>
AOS.init({
duration: 1000,
easing: 'ease-in-out'
});
Summary
Textillate focuses on text animations with a simple API, while AOS provides a broader range of scroll-based animations for various elements. Textillate is more suitable for specific text effects, whereas AOS excels in creating animated scrolling experiences across entire web pages. The choice between the two depends on the project's specific animation needs and overall design goals.
Reveal CSS animation as you scroll down a page
Pros of WOW
- Focuses on scroll-based animations, providing a smooth and engaging user experience
- Lightweight and easy to implement with minimal configuration
- Supports a wide range of animation effects out of the box
Cons of WOW
- Limited to scroll-triggered animations, less versatile for other animation needs
- Lacks text-specific animation features that Textillate offers
- May require additional libraries or custom code for more complex animations
Code Comparison
WOW:
new WOW().init();
<div class="wow fadeInUp" data-wow-duration="1s" data-wow-delay="0.5s">
Animated content
</div>
Textillate:
$('.tlt').textillate({
in: { effect: 'fadeInUp' },
out: { effect: 'fadeOutDown', sync: true },
loop: true
});
<h1 class="tlt">Animated text</h1>
Summary
WOW is ideal for scroll-based animations and offers a simple implementation, while Textillate specializes in text animations with more granular control. WOW is better suited for general page animations, whereas Textillate excels in creating dynamic text effects. The choice between the two depends on the specific animation requirements of your project.
A lightweight JavaScript library for creating particles
Pros of particles.js
- More versatile and customizable, allowing for various particle effects beyond text
- Supports interactive animations with mouse events
- Larger community and more frequent updates
Cons of particles.js
- Heavier in terms of file size and performance impact
- Steeper learning curve due to more configuration options
- Not specifically designed for text animations
Code Comparison
particles.js:
particlesJS("particles-js", {
particles: {
number: { value: 80, density: { enable: true, value_area: 800 } },
color: { value: "#ffffff" },
shape: { type: "circle" },
// ... more configuration options
}
});
textillate:
$('.tlt').textillate({
in: {
effect: 'fadeInLeft',
delayScale: 1.5,
delay: 50,
sync: false,
shuffle: false
}
});
Summary
particles.js offers more flexibility for creating particle-based animations, while textillate focuses specifically on text animations. particles.js has a larger community and more frequent updates but comes with a larger file size and potentially higher performance impact. textillate is simpler to use for text-specific animations but lacks the versatility of particles.js for other types of particle effects.
GSAP (GreenSock Animation Platform), a JavaScript animation library for the modern web
Pros of GSAP
- More comprehensive animation library with a wider range of features
- Better performance and optimization for complex animations
- Robust documentation and community support
Cons of GSAP
- Steeper learning curve due to its extensive feature set
- Larger file size, which may impact page load times
Code Comparison
Textillate:
$('.tlt').textillate({
in: { effect: 'rollIn' },
out: { effect: 'rollOut', sync: true },
loop: true
});
GSAP:
gsap.to(".text", {
duration: 2,
text: "Hello, world!",
ease: "power1.inOut"
});
Key Differences
- Textillate focuses specifically on text animations, while GSAP is a general-purpose animation library
- GSAP offers more control over timing, easing, and complex animation sequences
- Textillate provides pre-built text effects, making it easier for quick implementations
Use Cases
- Textillate: Simple text animations, especially for headings or short phrases
- GSAP: Complex animations, interactive user interfaces, and advanced motion graphics
Community and Maintenance
- GSAP has a larger and more active community
- Textillate has fewer recent updates, while GSAP is regularly maintained and improved
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
Textillate.js v0.4.1
See a live demo here.
Textillate.js combines some awesome libraries to provide an easy-to-use plugin for applying CSS3 animations to any text.
Usage
Let's start with the basic markup:
<h1 class="tlt">My Title</h1>
And your JavaScript should look like this:
$(function () {
$('.tlt').textillate();
})
This will animate using the default options. To change the defaults, you can either use the html data api:
<h1 class="tlt" data-in-effect="rollIn">Title</h1>
or pass in options on initialization (see full list of options below):
$('.tlt').textillate({ in: { effect: 'rollIn' } });
You can also tell textillate.js to animate a list with the following markup:
<h1 class="tlt">
<ul class="texts">
<li data-out-effect="fadeOut" data-out-shuffle="true">Some Title</li>
<li data-in-effect="fadeIn">Another Title</li>
</ul>
</h1>
$('.tlt').textillate();
Notice that you can control the animation parameters on each text (<li>
) using the data api.
Dependencies
To start using textillate.js, you will need the following:
Options
$('.tlt').textillate({
// the default selector to use when detecting multiple texts to animate
selector: '.texts',
// enable looping
loop: false,
// sets the minimum display time for each text before it is replaced
minDisplayTime: 2000,
// sets the initial delay before starting the animation
// (note that depending on the in effect you may need to manually apply
// visibility: hidden to the element before running this plugin)
initialDelay: 0,
// set whether or not to automatically start animating
autoStart: true,
// custom set of 'in' effects. This effects whether or not the
// character is shown/hidden before or after an animation
inEffects: [],
// custom set of 'out' effects
outEffects: [ 'hinge' ],
// in animation settings
in: {
// set the effect name
effect: 'fadeInLeftBig',
// set the delay factor applied to each consecutive character
delayScale: 1.5,
// set the delay between each character
delay: 50,
// set to true to animate all the characters at the same time
sync: false,
// randomize the character sequence
// (note that shuffle doesn't make sense with sync = true)
shuffle: false,
// reverse the character sequence
// (note that reverse doesn't make sense with sync = true)
reverse: false,
// callback that executes once the animation has finished
callback: function () {}
},
// out animation settings.
out: {
effect: 'hinge',
delayScale: 1.5,
delay: 50,
sync: false,
shuffle: false,
reverse: false,
callback: function () {}
},
// callback that executes once textillate has finished
callback: function () {},
// set the type of token to animate (available types: 'char' and 'word')
type: 'char'
});
Events
Textillate triggers the following events:
start.tlt
- triggered when textillate startsinAnimationBegin.tlt
- triggered when the in animation beginsinAnimationEnd.tlt
- triggered when the in animation endsoutAnimationBegin.tlt
- triggered when the out animation beginsoutAnimationEnd.tlt
- triggered when the out animation endsend.tlt
- triggered when textillate ends
$('.tlt').on('inAnimationBegin.tlt', function () {
// do something
});
Methods
$element.textillate('start')
- Manually start/restart textillate$element.textillate('stop')
- Manually pause/stop textillate$element.textillate('in')
- Trigger the current text's in animation$element.textillate('out')
- Trigger the current text's out animation
Code Samples
Top Related Projects
JavaScript animation engine
🍿 A cross-browser library of CSS animations. As easy to use as an easy thing.
Animate on scroll library
Reveal CSS animation as you scroll down a page
A lightweight JavaScript library for creating particles
GSAP (GreenSock Animation Platform), a JavaScript animation library for the modern web
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot