Jump to content
Search Community

Tweening into place using SplitTextField question?

sideDoor test
Moderator Tag

Recommended Posts

Hello,

 

We bought into the club, yah!

 

So, using the SplitTextField, I'm trying to tween text into place from random x/y coords - I can see from your example how easy it is to tween TO a random location:

 

// from the documentation:

for (var i:int = stf.textFields.length - 1; i > -1; i--)

{

TweenMax.to(stf.textFields, 1, {blurFilter:{blurX:10, blurY:10}, x:Math.random() * 650 - 100, y:Math.random() * 350 - 100, scaleX:Math.random() * 4 - 2, scaleY:Math.random() * 4 - 2, rotation:Math.random() * 360 - 180, autoAlpha:0, delay:Math.random() * 0.5, ease:Quad.easeIn, repeat:1, yoyo:true, repeatDelay:1.2});

}

 

...But to tween text INTO place from a preset random location escapes me - I've taken a quick look through the SplitTextField to see if the original x/y props of each split-created textfield are stored somewhere so I can use them to tween to...but can't seem to see if these values are saved somewhere...

 

Any advice?

Thanks,

sd

Link to comment
Share on other sites

Ahh, this works:

 

for (var i:int = 0; i < stf.textFields.length; i++)
{
origX.push(stf.textFields[i].x);
origY.push(stf.textFields[i].y);

stf.textFields[i].x = Math.random() * 650 - 100;
stf.textFields[i].y = Math.random() * 350 - 100;
}

for (i = stf.textFields.length - 1; i > -1; i--)
{
TweenMax.to(stf.textFields[i], .6, {x:origX[i], y:origY[i], ease:Quad.easeIn});
}

 

It'll do for what I'm trying to do, but is there an array of original props, er something?

 

Thanks!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...