AnimationUpdated in v15

Click Spark

Sparks that burst from wherever you click inside it.

Installation

Import the class, and @use the entry point in your global styles: without it the component renders unstyled.

import { Component } from '@angular/core';
import { WrClickSpark } from 'ngwr/bits/click-spark';

@Component({ imports: [WrClickSpark] })
export class MyComponent {}
Angular adaptation of an effect by David Haz / reactbits.dev.

Playground

Click anywhere
<wr-click-spark
  sparkColor="var(--wr-color-on-surface)"
  [sparkCount]="8"
  [sparkRadius]="15"
  [sparkSize]="10"
  [duration]="400"
  easing="ease-out"
>
  <div>Click me</div>
</wr-click-spark>

Customize

Spark Count
8
Spark Radius (px)
15 px
Spark Size (px)
10 px
Duration (ms)
400 ms
Easing
Color

API

NameDescriptionTypeDefault
sparkColorSpark colour: any CSS colour or a var(--wr-…) token.string'var(--wr-color-on-surface)'
sparkSizeStarting length of each spark, in px.number10
sparkRadiusHow far each spark travels, in px.number15
sparkCountSparks per click.number8
durationAnimation duration in ms.number400
easingEasing applied to travel distance.'linear' | 'ease-in' | 'ease-in-out' | 'ease-out''ease-out'
extraScaleMultiplier on how far sparks travel.number1

See also