Skip to content

Effects engine ​

Everything the components throw is exported, so your own elements can hit just as hard.

ts
import { at, burst, puff, sfx } from 'vue-manga-ui';

function onLike(e: MouseEvent) {
  const c = at(e.currentTarget as Element); // page coordinates of the element's center
  burst(c.x, c.y, { r: 60 });
  puff(c.x - 30, c.y + 10, { vx: -40 });
  sfx('don', c.x, c.y - 60, { size: 56 });
}
ExportWhat it is
puff, burst, shards, splash, slash, speedLines, ticks, wobble, sparkledrawn effects at page coordinates
sfx(word, x, y, { size, style })sound-effect lettering: 'don' | 'kachi' | 'zuza' | 'pon' | 'gogo' | 'shu' or any text; styles solid, hollow, dotted
spawn(life, draw)your own effect: draw(ctx, progress, seconds) every frame
Springnew Spring(x, stiffness, damping); set .to, call .step(dt)
useSquash(elRef), useFrame(step), useBackLayer(canvasRef)composables the components are built from
clock, advance, later, setSeedthe shared clock; pause it and step frames for tests or frame-by-frame review