How to Use Ionic 5 Animation API with Example?

0

Ionic 5 Animation uses the Web Animations API for creating animations. This is an example that changes the opacity of an element of the DOM: 
 
const animation = createAnimation()
.addElement(document.querySelector(‘.square’))
.duration(1000)
.direction(‘alternate’)
.iterations(Infinity)
.keyframes([
{ offset: 0, transform: ‘scale(1)’, opacity: ‘1’ },
{ offset: 1, transform: ‘scale(1.5)’, opacity: ‘0.5’
}
]);
animation.play();

0
Skip to toolbar