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

What is Framer? Join the Community
Return to index
Noam Elbaz
Posted Nov 26 - Read on Facebook

superLayer (parent) is a draggable layer that is holding 14 video thumbnails (children).
I snap it into position with this if/else.
BUT : if I click a bunch of times.... it will mess things up. I want to set ignoreEvents to true and then after animation is over set it back to FALSE but it doesnt seem to do the trick

Any ideas? Maybe I am injecting the IGNORE EVENTS in the wrong place?

#___________

setY = 240

superLayer.on Events.DragStart, ->

setY = superLayer.y
print "PreDrag setY " + setY
print "PreDrag superLayer.y " + superLayer.y
superLayer.on Events.DragEnd, ->
if superLayer.y > setY
superLayer.animate
properties:
y: setY + 1464
curve: "spring(100,10,0)"
print "PostDrag setY " + setY
print "PostDrag superLayer.y " + superLayer.y

else if superLayer.y < setY
superLayer.animate
properties:
y: setY - 1464
curve: "spring(100,10,0)"
print "PostDrag setY " + setY
print "PostDrag superLayer.y " + superLayer.y
else
superLayer.animate
properties:
y: setY
curve: "spring(100,10,0)"
print "PostDrag setY " + setY
print "PostDrag superLayer.y " + superLayer.y

7 Comments

Benjamin Den Boer

Hmm, looks like you've nested your DragEnd event within your DragStart event. Have you tried defining them separately?

You want to define 3 separate animations based on the position of the superLayer on DragEnd, right?

(Attaching a .framer file replicating the issue would be helpful :) )

Noam Elbaz

Truth is - the DRAG END was not nested first time around,... i'll send the FRAMER file

Noam Elbaz

Also - since you are looking at the code, how would I reference one of the layers created in the LOOP, outside of the LOOP....

Noam Elbaz

https://www.dropbox.com/s/s9byaftsoqtkao5/Screenshot%202014-11-25%2010.19.24.png?dl=0 Much easier with states. Create states in the loop, and then use calculate velocity to decide up or down

Benjamin Den Boer

Noam Elbaz you can access layers created within a loop by pushing them into an array defined outside of the loop.

Noam Elbaz

Benjamin Den Boer thanks alot. States have become my best friend. When I first made this post a few days back, I had barely touched States. Now they're my go-to tool. :)

Read the entire post on Facebook