Closed nvh closed 6 years ago
Really cool! While the API is super clean I wonder if it is intuitive. Wouldn't it be more clear if the function would be named somethings like: layer.animateAlongPath(path, enableRotation)
I agree that it isn't really discoverable, but I'm also not sure if this is going to be used as much that it justifies a separate function. We could of course always create a wrapper function that does this later.
Initially I would have sided with Jonas here, but after briefly using the API myself I think Niels' approach is ultimately better. A wrapper function would be a "nice to have" but I don't see it as being absolutely necessary.
However, if you decide to add such a function, please allow to pass animationOptions
as an optional argument layer.animateAlongPath(path, enableRotation, animationOptions = Framer.Defaults.Animation)
.
That's what I had at some point, but this doesn't show errors in Framer for Mac, and it can be pretty confusing, because setting a null animation value will just do nothing, and changing some properties that seem unrelated in Design can cause the SVG to suddenly not be a single path anymore. What are the disadvantages of throwing errors? These are certainly programming errors in my view, that should be handled asap by the user.
You could also only throw when run inside Studio
That's smart! Will do!
This is basically a really light-weight re-implementation of https://github.com/koenbok/Framer/pull/151.
Here's an example: https://framer.cloud/RiKaw
The API is as follows:
I've added a
path
property to SVG layer that only returns an SVG path if it's the only child of the svg. This is a bit limiting, but hopefully makes the API a bit clearer