Copy link to clipboard
Copied
Hi!
I was looking on the net and I did not find the code - smooth, because drag text is a little hard and not smoothly dragging. How to make a smooth drag text in Adobe Animate?
Please help. Thank you!
My code:
var root = this;
var text = root.text;
root.start = function()
{
createjs.Touch.enable(stage);
stage.mouseMoveOutside = true;
text.transitionDelay = 350;
text.transitionEase = createjs.Ease.quintOut;
text.on("mousedown", root.mouseDownHandler);
text.on("pressmove", root.pressMoveHandler, this, false, { min: -430, max: 40 });
};
root.mouseDownHandler = function(e)
{
e.currentTarget.offsetY = stage.mouseY / stage.scaleY - e.currentTarget.y;
};
root.pressMoveHandler = function(e, data)
{
e.currentTarget.y = root.clamp(stage.mouseY / stage.scaleY - e.currentTarget.offsetY, data.min, data.max);
createjs.Tween.get(text).to( text.transitionDelay, text.transitionEase);
};
root.clamp = function(value, min, max)
{
if (value < min)
return min;
if (value > max)
return max;
return value;
};
root.start();
Copy link to clipboard
Copied
Try this tutorial https://www.youtube.com/watch?v=JYBWehkks_Y