3.2.0 • Published 9 months ago

@lukekaalim/act-curve v3.2.0

Weekly downloads
-
License
MIT
Repository
-
Last release
9 months ago

@lukekaalim/act-curve

A @lukekaalim/act-based library for working with fast-updating changes.

Features

  • Simple interpolator hook for smoothly changing a value based on state.
  • Array interpolator hook to tell if elements are entering or exiting and animate them accordingly
  • Custom Animator framework for building data-driven animations

Install

npm i @lukekaalim/act-curve

Quickstart Usage

Interpolate between values using useCurve hook.

useCurve(value, (interpolatedValue) => {
  element.textContent = Math.floor(interpolatedValue)
});

::hook_demo

Use the useChangeList hook to show/hide sets of elements gradually

const [colorListChanges, animator] = useChangeList(colorList);
colorListChanges.map(([color, change]) =>
  h(ColorBox, { color, change, onDone: () => animator.remove(color) }))

// inside ColorBox
useCurve(change === 'exiting' ? 1 : 0, v => {
  element.style.opacity = (1 - Math.abs(v)).toString();
  element.style.maxHeight = ((1 - Math.abs(v)) * 1).toString() + 'em';
  if (v === 1)
    onDone()
}, { start: -1 })

::transition_demo

3.2.0

9 months ago

3.1.2

2 years ago

2.2.1

2 years ago

2.2.0

2 years ago

3.1.1

2 years ago

3.1.0

2 years ago

3.0.1

2 years ago

3.0.0

2 years ago

2.1.0

2 years ago

2.0.0

3 years ago