• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

How to make a smooth drag text in Adobe Animate?

Community Beginner ,
Jan 27, 2021 Jan 27, 2021

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();

 

TOPICS
Code , How to , Other

Views

148

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 02, 2021 Mar 02, 2021

Copy link to clipboard

Copied

LATEST

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines