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

What is Framer? Join the Community
Return to index
Urban Maciej
Posted Dec 08 - Read on Facebook

I've got a questions about loops.
here is my little framer prototype

card = [r1, r2, r3, r4, r5, r6]

for i in [0..5]
card[i].onMouseOver ->
this.animate
shadowY: 6
shadowBlur: 20
y: this.y - 5
options:
time: 0.3

card[i].onMouseOut ->
this.animate
shadowY: 1
shadowBlur: 2
y: this.y + 5
options:
time: 0.3

i've got a problem with y value. Is it possible to store array element y value before onMouseOver function? so when i use onMouseOut i can use it instead of this.y-5 in animation ?

2 Comments

Aalok Trivedi

Try storing the y in a variable before the mouse events. startY = card[i].y and then animate back to startY

Aalok Trivedi

Also you can just loop through the card array by doing 'for layer, i in card' instead of creating a new loop

Read the entire post on Facebook