1.17.0 • Published 5 months ago

svelte-trigger-action v1.17.0

Weekly downloads
-
License
-
Repository
github
Last release
5 months ago

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>

DEMO

The CSS class that defines the animation can be specified in the following places:

  1. When creating trigger and action
const { triggerAnimation, animationAction } = createAnimationTriggerAction('shake'); // <- specified here

// in such case, trigger can be called without arguments:
triggerAnimation();
  1. 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>
  1. As a parameter to trigger function:
const { triggerAnimation, animationAction } = createAnimationTriggerAction();
triggerAnimation('shake');
1.15.0

5 months ago

1.17.0

5 months ago

1.16.0

5 months ago

1.14.0

5 months ago

1.13.0

5 months ago

1.12.0

2 years ago

1.11.0

2 years ago

1.9.1

3 years ago

1.9.6

3 years ago

1.9.5

3 years ago

1.9.4

3 years ago

1.9.3

3 years ago

1.9.2

3 years ago

1.10.0

3 years ago

1.9.0

3 years ago

1.8.2

3 years ago

1.8.1

3 years ago

1.8.0

3 years ago

1.7.0

3 years ago

1.6.0

3 years ago

1.5.0

3 years ago

1.3.0

3 years ago

1.2.0

3 years ago

1.1.0

3 years ago

1.0.0

3 years ago