This is a read-only archive of the Framer Community on Facebook.

What is Framer? Join the Community
Return to index
Vladimir Shlygin
Posted Apr 21 - Read on Facebook

Hi there! Dumb question, how can I add an array of states? Here is the idea:

https://www.dropbox.com/s/1a456qxtop3c8n6/Screenshot%202016-04-20%2023.49.05.png?dl=0

9 Comments

Michael James

just curious, why are you interested in doing this with states? you could maybe get something similar using the layer.animate method

Vladimir Shlygin

I've made a new class which allows creating SVG-based paths and animating them. The animation data is stored in an array, which is then supposed to be transformed into a series of states which are connected to the animation of specific points of this path.

Vladimir Shlygin

For example, [20, 20] should be converted into a state with properties {x:20; y:20}, [20,20,40,40] into two individual states and so on

Vladimir Shlygin

layer.animate and Animation Class are my backup plans, they make everything so complicated :)

Michael James

it seems like you want to evaluate the "a+1" so that it is a variable rather than a number. not sure how to do that in coffeescript.... i know you can in python

Vladimir Shlygin

yes, the idea here is not to evaluate, but to assign a unique name to every state

George Kedenburg III

Try setting the state name to "#{i}"

Sigurd Tapio Mannsåker

Haven't tested this myself, but since the add() method just takes an object, you should be able to create the object before calling add(), which allows you to generate key names inside [] as usual.

George Kedenburg III

its just as simple as this

Read the entire post on Facebook