A simple utility to trigger CSS animations on elements by calling a function
npm install svelte-trigger-actionA simple utility to trigger CSS animations on elements by calling a function
``svelte
`
The CSS class that defines the animation can be specified in the following places:
1. When creating trigger and action
`js
const { triggerAnimation, animationAction } = createAnimationTriggerAction('shake'); // <- specified here
// in such case, trigger can be called without arguments:
triggerAnimation();
`
2. As a parameter to action:
`svelte
`
3. As a parameter to trigger function:
`js``
const { triggerAnimation, animationAction } = createAnimationTriggerAction();
triggerAnimation('shake');