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

What is Framer? Join the Community
Return to index
Siavash Shabanipour
Posted Aug 12 - Read on Facebook

I'm trying to add 2 states and a state switch to all the layers in my array but it's only working with the first layer in the array.

8 Comments

Jordan Robert Dobson

I think change pin.states.current to this.states.current

Jordan Robert Dobson

If this.states.current is "active"

Siavash Shabanipour

Super speedy response, cheers! Do you mind explaining what "this" is and if "is" similar to using "=="

Siavash Shabanipour

P.S it worked

Jordan Robert Dobson

Yes "is" is basically coffeescript version of == and... "This" which you're already using is just referencing the item that fired the event.

If you use pin like you were its going to use the last pin that was set in your loop... Not the one that was there during that loop. The context gets lost. That's why you need "this" so it's self referencing.

Jordan Robert Dobson

Coffeescript.org can give you more info on operators.

Siavash Shabanipour

Ah awesome, got it

Troy Mcilvena

Siavash Shabanipour If the pin has only two states, then you probably don't need to explicitly set the state by name, just cycle through using this.states.next()

Read the entire post on Facebook