Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
ppdc

SplitTextField: regOffsetY and regOffsetX not working

Recommended Posts

I can't seem to get this working. I am trying to scale a textfield (by letter) from the center, but whatever I change regOffsetY to, it always scales from the top left corner. 

What am I doing wrong?

Thank you.

 

Peter

 

 

test.fla.zip

Link to comment
Share on other sites

The regOffsetX and regOffsetY are applied to the parent Sprite that contains all you split characters. It is not the origin of each individual split character (word, or line).

 

Place this code in your file to see how these params work

import com.greensock.*;
import com.greensock.easing.*;
import com.greensock.plugins.*;
import com.greensock.text.SplitTextField;


var tl = new TimelineLite({paused:true});
var stf1:SplitTextField = new SplitTextField(txt,"characters",550,400);
TweenLite.to(stf1, 5, {rotation:360})

Notice the entire textfield spins around the lower right corner.

 

To scale each character from its center, you can use the TransformAroundCenterPlugin (which comes with your membership).

 

Try this

import com.greensock.*;
import com.greensock.easing.*;
import com.greensock.plugins.*;
import com.greensock.text.SplitTextField;


TweenPlugin.activate([TransformAroundCenterPlugin]);


var tl = new TimelineLite({paused:true});
var stf1:SplitTextField = new SplitTextField(txt,"characters",550,400);
TweenMax.staggerFrom(stf1.textFields, 1, {transformAroundCenter:{scale:0}}, 0.5);

That should do the trick.

 

Let us know if you need more help and thank you for supporting us through your Club GreenSock membership.

 

Happy Tweening!

Link to comment
Share on other sites

Great, thank you!

 

Just out of curiosity: Why was my regOffsetY-approach not working?

 

Merry Christmas or whatever you're celebrating!

Link to comment
Share on other sites

You were setting the regOffSets properly, you just didn't notice anything because you weren't rotating or scaling stf1 (like in my first example above).

 

You were only animating stf.textFields.

 

Hopefully that helps, and Merry Christmas to you too!

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.
×