Animation
A developer guide that details numerous strategies for implementing animation into Aurelia applications.
Learn numerous techniques for implementing animations into your Aurelia applications.
Component-based animations
In instances where you don't need to implement router-based transition animations (entering and leaving), we can lean on traditional CSS-based animations to add animation to our Aurelia applications.
Let's animate the disabled state of a button by making it wiggle when we click on it:
Stateful Animations
Some animations are reactive based on user input or other application actions. An example might be a mousemove
event changing the background colour of an element.
In this example, when the user moves their mouse over the DIV, we get the clientX
value and feed it to a reactive style string that uses the x
value to complete the HSL color value. We use lower percentages for the other values to keep the background dark for our white text.
Reactive Animations
Not to be confused with state animations, a reactive animation is where we respond to changes in our view models instead of views and animate accordingly. You might use an animation library or custom animation code in these instances.
In the following example, we will use the animation engine Anime.js to animate numeric values when a slider input is changed. Using the change
event on our range slider, we'll animate the number up and down depending on the dragged value.
Last updated