-
Notifications
You must be signed in to change notification settings - Fork 114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add createSpring primitive. #629
base: main
Are you sure you want to change the base?
Conversation
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently it allows you to pass a string as an input (or an array of strings, object with string values etc), but you could use a type like this to provide some validation
type SpringTargetPrimitive = number | Date;
type SpringTarget =
| SpringTargetPrimitive
| { [key: string]: SpringTargetPrimitive | SpringTarget }
| SpringTargetPrimitive[]
| SpringTarget[];
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a good suggestion. Was also considering this. I just made it close to Svelte's implementation which was more loose with types.
But under the hood it does actually only implement those specific primitives: Date, Number, Array<Date | number>, and { [key: any]: Date | number> }.
Will definitely add it here. Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update: I also figure of adding const springValue = createDerivedSpring(signal, opts) Will add this tonight. |
18ee12d
to
45d16ec
Compare
Summary
createSpring
primitive. Inspired and Forked from https://svelte.dev/docs/svelte-motion#springtween
primitive.Example Usage:
Witness, the springiness:
solidjs.spring.primitive.-.demo.mp4
Solid.CreateSpring.Demo.mp4
Todos: