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
Is your feature request related to a problem? Please describe.
When using springs and tweens to describe values that are set from props, I find myself doing this sort of thing:
In this situation I want the value of size to be static when the component is first created, until the prop changes. But it's a nuisance to have to specify big ? 100 : 20 twice. You could create a function for it...
Describe the solution you'd like
If it were possible to call spring without an initial value, we could initialise it later:
constsize=spring();
$: size.set(big ? 100 : 20);
Of course, it would be nice if we could initialise the store right there in the reactive declaration, as happens for non-store values, but I'm not sure what that would look like. Might be cool to be able to do this sort of thing...
$: <spring>$size = big ? 100 : 20;
...but it's obviously invalid JS. Maybe worth coming back round to that one day, but for the meantime allowing undefined/null initial values solves the DRY problem.
How important is this feature to you?
I'm encountering this situation a lot in my current project. I think it's important that using motion be as frictionless as possible.
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
When using springs and tweens to describe values that are set from props, I find myself doing this sort of thing:
In this situation I want the value of
size
to be static when the component is first created, until the prop changes. But it's a nuisance to have to specifybig ? 100 : 20
twice. You could create a function for it......but that's arguably worse.
Describe the solution you'd like
If it were possible to call
spring
without an initial value, we could initialise it later:Of course, it would be nice if we could initialise the store right there in the reactive declaration, as happens for non-store values, but I'm not sure what that would look like. Might be cool to be able to do this sort of thing...
...but it's obviously invalid JS. Maybe worth coming back round to that one day, but for the meantime allowing
undefined
/null
initial values solves the DRY problem.How important is this feature to you?
I'm encountering this situation a lot in my current project. I think it's important that using motion be as frictionless as possible.
The text was updated successfully, but these errors were encountered: