1.17.0 • Published 2 years ago
svelte-trigger-action v1.17.0
svelte-trigger-action
A simple utility to trigger CSS animations on elements by calling a function
<script>
import { createAnimationTriggerAction } from 'svelte-trigger-action';
// create trigger and action
const { triggerAnimation, animationAction } = createAnimationTriggerAction();
</script>
<button use:animationAction on:click={() => triggerAnimation('shake')}> shake me </button>
The CSS class that defines the animation can be specified in the following places:
- When creating trigger and action
const { triggerAnimation, animationAction } = createAnimationTriggerAction('shake'); // <- specified here
// in such case, trigger can be called without arguments:
triggerAnimation();
- As a parameter to action:
<script>
import { createAnimationTriggerAction } from 'svelte-trigger-action';
// create trigger and action
const { triggerAnimation, animationAction } = createAnimationTriggerAction();
</script>
<button use:animationAction={'shake'} onClick={triggerAnimation}> shake me </button>
- As a parameter to trigger function:
const { triggerAnimation, animationAction } = createAnimationTriggerAction();
triggerAnimation('shake');
1.15.0
2 years ago
1.17.0
2 years ago
1.16.0
2 years ago
1.14.0
2 years ago
1.13.0
2 years ago
1.12.0
3 years ago
1.11.0
4 years ago
1.9.1
4 years ago
1.9.6
4 years ago
1.9.5
4 years ago
1.9.4
4 years ago
1.9.3
4 years ago
1.9.2
4 years ago
1.10.0
4 years ago
1.9.0
4 years ago
1.8.2
4 years ago
1.8.1
4 years ago
1.8.0
4 years ago
1.7.0
4 years ago
1.6.0
4 years ago
1.5.0
4 years ago
1.3.0
4 years ago
1.2.0
4 years ago
1.1.0
4 years ago
1.0.0
4 years ago