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

What is Framer? Join the Community
Return to index
Kristof Goossens
Posted Nov 06 - Read on Facebook

Hi all :) I'm pretty new to coding. However Framer worked well for me to do some basic interaction prototypes. However now I want to trigger a certain animation once a draggable layer is in a certain 'area', if not it should snap back to it's original position. I tried making something only using x values & if else. But it's not really working & I don't think it's the right angle to tackle this situation. Do you guys have any clue or tips on how to make this work?

6 Comments

Mike Kotsch

Check the text indents. Did the same, and the only problem was the right formatting of the code.

Mike Kotsch

I can even upload some example code if you want to for this thing: http://playground.mikekotsch.de/framer/slider/

Kristof Goossens

Mmm thx man, but it looks like I can't acces the folder. The code is working now though. I was just wondering if it is possible to be more specific in the if statement. As in if x & y is inbetween this & this values.

Kristof Goossens

I'm trying it out with this now. if(YellowRing.y < 400) && (YellowRing.y > 300) && (YellowRing.x < 400) && (YellowRing.x > 200) not sure if it is the right way

Kristof Goossens

Allright it's working. Sorry for this post, I was too impatient. Thx for the help though! YellowRing.draggable.enabled = true

#Events
YellowRing.on Events.DragEnd, ->

if(YellowRing.y < 820) && (YellowRing.y > 520) && (YellowRing.x < 520) && (YellowRing.x > 220)
BlueRing.animate
properties:
hueRotate: 220

YellowRing.animate
properties:
scale:0

else

YellowRing.animate
properties: x:500, y:800
time: 0.2
curve: "spring(600, 30, 0)"

Stephen Crowley

Hey there ya go! Sometimes talking it out with someone listening helps :) At least it works for me

Read the entire post on Facebook