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

What is Framer? Join the Community
Return to index
Taurean Bryant
Posted Nov 19 - Read on Facebook

I'm just getting started, I can't find a way to edit the .style for each state. Is this possible?

10 Comments

Taurean Bryant

Most errors comeback as undefined is not a function

Benjamin Den Boer

Hey Taurean Bryant, while you can only define layer properties when defining new States, it's possible to change style properties based on State Events or on specific States. For example:

if layerA.states.current is "stateB"
____layerA.style.color = "blue"

Taurean Bryant

Perfect thanks!

Taurean Bryant

Benjamin Den Boer this worked exactly how I needed it, and I can see this being crazy useful. Thanks!

Taurean Bryant

I may have spoken too soon. When I am defining the current state as layerA.states.switch("stateB") it works perfectly, but if I'm doing an on click state switch it won't pull from the style like that. My guess is because the script has already been executed so the other states styling is not being used.

Taurean Bryant

Any ideas on how to circumvent that?

Benjamin Den Boer

Taurean Bryant could you attach your prototype / a code sample?

Taurean Bryant

Benjamin Den Boer http://cl.ly/3G3g2u0D0N3r file is kind of a mess though

Benjamin Den Boer

Hey Taurean Bryant, you've defined new style properties based on the states "focused" and "selected" but on click events you switch between "default" and "selected". Perhaps that's the issue?

taskContainer.states.next("default", "selected")

(You've defined a unique set of styles for "focused" but you never switch to that state)

Taurean Bryant

Benjamin Den Boer I must have sent you a later file that was mid-process in trying something else my bad. I'll try to send you a better one so you can see whats going on. Thanks though!

Read the entire post on Facebook