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

What is Framer? Join the Community
Return to index
Aaron James
Posted Jul 08 - Read on Facebook

Brain teaser time. Why are the colors/data from my two-dimensional array not cycling through when tapping the button. When I tap the button, I expect the background color to change, but it's not updating. Any clues? Here is my file.
http://share.framerjs.com/hkjnvmb1zuk8/

5 Comments

Douwe Homans

You're not actually updating the layer color. So in your circle method you should do something with your updated key value ;)

Struan Fraser

Yeah, I think you need to put your variable declarations within the cycle function. You'll also need to directly change the layer in the cycle function with bg.backgroundColor = color.

Because the variables are being declared in global scope they're only executed once. They need to be declared in events so they update.

Aaron James

Got it! thanks Douwe and Struan! Here is how I solved it. I created a mapKeys function that I pass into the cycle function. and bingo.

Aaron James

Here's the project so you can take a peek at the working code. http://share.framerjs.com/0xd7x2okr62k/

Struan Fraser

Cool! Good fixin' :)

Read the entire post on Facebook