@usephase/react
v0.6.4
Published
React bindings for Phase animation and rendering primitives
Readme
@usephase/react
Status: Alpha. APIs are evolving rapidly. Expect breaking changes.
React hooks and components built on the lifecycle-aware primitives in @usephase/core.
Install
pnpm add @usephase/core @usephase/reactGetting started
import { useLoop } from '@usephase/react';
function Orbit({ radius }) {
const { ref } = useLoop({
onTick: (frame) => {
const angle = frame.elapsed / 1000;
ref.current.style.transform = `translate(${Math.cos(angle) * radius}px, ${Math.sin(angle) * radius}px)`;
},
});
return <div ref={ref} className="dot" />;
}Read the full documentation, review the changelog, or see the MIT license.
