You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Parity] Add declarative gradient stops and resource composition #31
Make gradients usable without constructing Two.Stop manually or round-tripping a callback ref through React state.
The current LinearGradient and RadialGradient wrappers accept a stops array, but there is no exported Stop component or hook and no declarative relationship between a gradient resource and a shape. The current README example supplies plain stop objects; Two.js expects Two.Stop instances and throws when it tries to bind those objects.
Desired capabilities
A final API may use components, hooks, resource props, or a combination, but it should support an ergonomic equivalent of:
The lifecycle and property foundation for gradient resources is now in place via #36 (closing #29 and completing #30):
LinearGradient and RadialGradient are refactored to use the unified useTwoObject hook (isSceneObject: false), providing discrete prop diffing and Strict Mode double-mount safety.
Endpoint properties (left, right, center, focal) now support VectorProp (Two.Vector, { x, y }, [x, y]) and update without overwriting internal vector instances.
Owned vs shared resource disposal semantics have been established and tested, unblocking declarative <Stop /> composition and resource binding.
Activity
jonobr1 commentedon Sep 3, 2026
Foundation Update from #29 & #30
The lifecycle and property foundation for gradient resources is now in place via #36 (closing #29 and completing #30):
LinearGradientandRadialGradientare refactored to use the unifieduseTwoObjecthook (isSceneObject: false), providing discrete prop diffing and Strict Mode double-mount safety.left,right,center,focal) now supportVectorProp(Two.Vector,{ x, y },[x, y]) and update without overwriting internal vector instances.<Stop />composition and resource binding.