Fusion icon indicating copy to clipboard operation
Fusion copied to clipboard

Allow T everywhere we publicly accept StateObject<T>

Open dphfox opened this issue 1 year ago • 1 comments

Right now, the last remaining pain point when dealing with things that are sometimes state objects, is that things like Observer will error if you pass it something that isn't a state object.

I propose that Fusion relaxes this restriction and allows for constant values to be interpreted identically to a state object that never changes value (i.e. onChange never runs, onBind runs once only, Spring always aims at that value, Tween never moves from that value, etc...)

This helps remove yet another hurdle preventing most code from dealing with CanBeState rather than requiring StateObject types.

dphfox avatar Jan 20 '24 03:01 dphfox

This idea extends to Tween and Spring objects, too. Updating post to match.

dphfox avatar Jan 20 '24 05:01 dphfox