Drag Objects with momentum


Hi all.

I was wondering if anyone has come across a similar problem and has come up with a solution to something like this.

I’m wanting to be able to drag 2D objects across my screen, but I want to apply a sort-of ‘momentum with inertia’ effect on it (keeping traveling in the direction of drag briefly, then slows down and stops).

I’m aware that ZapWorks Studio does not yet have any Physics libraries deployed.

Any help would be appreciated.



Hi there. I don’t know if I’ve understood correctly but you can animate a 2D object using timelines and interpolations, adding these effects on the keyframes that you want. Try it using you object position plus one interpolation effect and see the results.

I’ve found a post about timelines and effects, hope it’s helpfull.
[ Animations in Zappar's Studio ]


Hey Brandon,

If you want it on release of the dragged object, during on pointer move you can continually store the position of the user’s finger in the current frame and the previous frame. Then when on pointer up you can calculate direction and distance from the two positions and continue applying that translation every frame while dividing it by say 1.1 each time until its magnitude is negligible.