In this video I show you how to use the Wix animation API to create a hover effect. If you have any questions please let me know in the comments below.
Thanks for watching.
The code:
import wixAnimations from 'wix-animations';
const timeline = wixAnimations.timeline();
const truck = $w('#truck');
timeline.add(truck, {
rotate: -5,
duration: 100
}).add(truck, {
rotate: 0,
x: 300,
duration: 300,
delay: 200
})
$w.onReady(function () {
});
export function button1_mouseIn(event) {
timeline.play();
}
export function button1_mouseOut(event) {
timeline.reverse();
}