devuiGuideDemosAPIGitHub

Curves, shapes and orientations

Curves map one value to another, or animate one over time. Your code samples them, and the panel edits them in place:

import { gui, curve, easing } from '@haxiomic/devui';

const anim = gui.folder('Anim').params({
  bounce: curve([[0, 0], [0.5, 1], [1, 0]], 'loop'),   // keys [x, y], smooth between them
  falloff: curve([[0, 1, 'linear'], [4, 0]]),          // any domain: seconds, metres…
  ease: { value: curve(easing('easeInOutCubic')), view: 'easing' },
});
anim.bounce.sample(t);       // the value at t (and the editor shows a playhead at t)
anim.falloff.lut(64);        // Float32Array over the keys' domain
anim.ease.cubicBezier();     // 'cubic-bezier(0.65, 0, 0.35, 1)'

Your own curves. A list of points or a CSS easing your code already has is edited in place, and your code samples it as it did:

const motion = gui.folder('Motion').params({
  falloff: [[0, 1], [0.25, 0.85], [1, 0]],   // [x, y] or { x, y }, x rising
  easing: 'ease-in-out',                     // or 'cubic-bezier(…)'
});
dot.style.animationTimingFunction = motion.easing;

Springs. A spring config your app already has, for whichever library animates with it, is a spring's row: how it moves, its damping ratio and how long it takes to settle. Click it to tune it:

const motion = gui.folder('Motion').params({
  pop: { type: 'spring', stiffness: 260, damping: 14 },   // Motion
  drawer: { tension: 170, friction: 26 },                  // react-spring
  fade: { duration_s: 0.4, bounce: 0.5 },                  // physics-animator
});
animate(el, { x: 100 }, motion.pop);                       // as before
import { physicsOf, spring, stepSpring } from '@haxiomic/devui/spring';
const s = spring({ duration: 0.6, bounce: 0.3 });   // from any library's config
gsap.to(el, { x: 100, ...s.gsap() });               // { duration, ease }
const { duration, easing } = s.css();               // a CSS linear() easing
el.style.transition = `transform ${duration}s ${easing}`;
stepSpring(physicsOf(config)!, state, target, dt);  // or step any config yourself, exactly

Orientations, directions, pads and knobs: