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

What is Framer? Join the Community
Return to index
Anthony Roscoe
Posted Mar 12 - Read on Facebook

::: FIXED :::

Anyone know a way to change drag speed mid drag without having the layer flicker?

4 Comments

Andy Yang

This is a total hacky workaround, but you could just let the draggable always move according to speedX=1, and have an identical object follow along while "gearing" its x position to a value based on the x position of the draggable. You can then toggle opacities of both objects accordingly. The behavior you want is for the box to switch to a slower speed once it hits a certain point, right? Example: http://share.framerjs.com/d1scgrz45bua/

Andy Yang

...There are some issues to work out on DragEnd, but you get the idea :)

Andreas Wahlström

Not by the computer so I cant test, but have you tried something like this:

layer.on Events.DragMove, -> @speedX = Utils.modulate @x,[0,200],[1,.3]

Anthony Roscoe

Thanks Andy and Andreas! Utils.modulate did the trick. For those interested in the specific code its only a slight modification on Andreas example:

test.on Events.DragMove, ->
@draggable.speedX = Utils.modulate @x, [0,200], [1,.6]

Read the entire post on Facebook