Not sure if this is an impossibility or a syntax issue, but how do I group multiple variables under one variable?
Example:I have two layers named card1 and card2.
I want to define:bothCards = card1, card2
So that I can use: bothCards.states.add in order to apply the same state properties and animations to each of them, without having to write it out twice.Or bothCards.y, or bothCards.animate etc.
Suspect this might be solved by arrays (which I am new to), will go fight with that and see.
you can't do it the way you want but coffeescript lets you do some neat things
Array is the right way to go. Take a look at the CoffeeScript Intro example (line 42) made by the Framer guys. http://cl.ly/ZuPf
Thank you everyone, I'm getting there :D
Legendary. Now I've applied the starting state to the cards as a group, and triggered the return to their original state (states.next). To make it perfect I just need to put a slight delay between them, but either way this works really well and should speed up a lot of stuff in future.
My main problem was that I was trying to triggercard.states.next()
from outside the for card in cards statement, when I should have treated it the same way I treat Utils.delay etc