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

What is Framer? Join the Community
Return to index
Lachezar Petkov Petkov
Posted Jul 01 - Read on Facebook

Hello. I am new to coding/FramerJS, please forgive me if the question is silly. I am designing a simple rating dialog where I want to draw five stars - the user would tap on them, they will animate, an image would show up depending on which star is pressed, etc.

So far I have:

for i in [1..5]
star = new Layer
image: "img/star-inactive"
width: 89, height: 87, x: 180 * i, y: 20

Now I want to kind of work with each star individually, set events, animate it. I tried to select a star from the array, but to no avail:

stars[0].on Events.Click, ->

Is this the right approach? What am I missing?
Thanks a lot!


Floris Verloop

You listen to the click event inside the for loop and then use the clicked layer inside the event. See this example →

Lachezar Petkov Petkov

Thanks a lot!

Read the entire post on Facebook