Skip to main content
Known Participant
April 20, 2010
Answered

Regular.easeIn / Strong.easeOut : This shouldn't be hard right?

  • April 20, 2010
  • 2 replies
  • 3090 views

I've got a tween that moves a movie clip from right to left. I want it to Regular.easeIn and Strong.easeOut. I have no idea what's wrong with my code. This is all very new to me so I apologize for not getting it, assuming this is really a no brainer, etc. Anyhow, here's what I've got in my action script 3.0 panel.

import fl.transitions.Tween ;

import fl.transitions.easing .*;

var playerXTween :Tween = new Tween(mc_GENERIC, "x" , Regular.easeIn , 200, -200, 90, true);

I've tried to copy the code and make a regular.easeIn and a Strong.easeOut and I get error messages. Also, though I don't know why, I cannot even get it to do a Regular.easeInOut !!! No idea why... What am I missing? Thanks much, Ethan.

This topic has been closed for replies.
Correct answer kglad

the following will work:

import fl.transitions.Tween ;

import fl.transitions.easing .*;

var  playerXTween :Tween = new Tween(mc_GENERIC, "x" , Regular.easeIn , 200,  -2000, 90, true);

IF you have a movieclip with instance name mc_GENERIC.  ie, click on that movieclip to select it, copy the instance name in the properties panel and paste it over mc_GENERIC to ensure the names are exact matches.  retest.


this will work:

import fl.transitions.Tween ;

import fl.transitions.easing .*;

var  playerXTween :Tween = new Tween(mc_GENERIC,  "x" , Regular.easeInOut , 200,  -2000, 90, true);

but to do what you want will require a custom ease.

2 replies

erafalAuthor
Known Participant
April 21, 2010

So, I'm running that code, exactly as you've laid it, and I've got a run of numbers on my output tab and minimal movement leading to none at all. ? Sorry for the density on my brain here. Appreciate the help. Thanks, Ethan.

kglad
Community Expert
Community Expert
April 21, 2010

show the code you're using.

erafalAuthor
Known Participant
April 21, 2010

import fl.transitions.easing.*;

import fl.transitions.Tween;

var playerXTween:Tween = new Tween(mc_GENERIC, "x", regEaseInStrongEaseOut, 500, -2500, 90, true);

function regEaseInStrongEaseOut(t:Number, b:Number, c:Number, d:Number): Number {

trace(t)

if ((t/=d*0.5)<1) {

return Regular.easeIn(t,b,c,d);

}

else {

return Strong.easeOut(t,b,c,d);

}

}

kglad
Community Expert
Community Expert
April 20, 2010

that's a pretty slow tween at 90 seconds to move 400 pixels.  you're not going to see much easing with that even if you use a correct easing function like Regular.easeInOut

erafalAuthor
Known Participant
April 20, 2010

Whoops. I meant -2000. It's a very wide movie clip, a series of images, etc. Regardless, as stated, I've got nothing on either Regular.easeInOut or Regular.easeIn / Strong.easeOut (the ideal setup). Any help toward this would be huge. Thanks!

kglad
Community Expert
Community Expert
April 20, 2010

the following will work:

import fl.transitions.Tween ;

import fl.transitions.easing .*;

var  playerXTween :Tween = new Tween(mc_GENERIC, "x" , Regular.easeIn , 200,  -2000, 90, true);

IF you have a movieclip with instance name mc_GENERIC.  ie, click on that movieclip to select it, copy the instance name in the properties panel and paste it over mc_GENERIC to ensure the names are exact matches.  retest.