axi0motion

Click spark

Each click throws a ring of small sparks from the pointer.

  • enhancer
  • click
  • pointer
  • burst
  • since 0.1

Background Studio: tune it below, then copy the code

Your system asks for reduced motion: the demo shows its final state and nothing moves.

Live demo

Click spark example

Controls

8
12 px
26 px
420 ms

Code

It follows the controls above: change an option and the code changes with it.

<link rel="stylesheet" href="/axi0/motion/motion.css?v=6">
<script src="/axi0/motion/motion.js?v=10" defer></script>

<button type="button" class="demo-btn" data-motion="click-spark">Click me</button>

The wrappers: ClickSpark.tsx (React, TypeScript) and ClickSpark.vue (Vue). Both render the same attributes as the HTML; the loader does the rest.

Options

AttributeDefaultWhat it does
data-motion-count8sparks per click
data-motion-size12spark length in pixels
data-motion-radius26how far they fly, in pixels
data-motion-duration420milliseconds
data-motion-colorautospark color; auto is the text color

Accessibility

One fixed canvas over the viewport, shown only while sparks fly; the loop stops with the last spark. A keyboard press sparks from the middle. Reduced motion: no sparks.

Size

click-spark.js is 1.0 KB gzip. A page loads the loader (2.7 KB) and core.js (1.4 KB) once, whatever it uses.