Friday, August 22, 2008

Create Custom Tween's for TweenLite

I wanted an easy way to create custom tweens with a visual guide, much like you can with LMC Tween and Fuse. Since I couldn't find anything out there that provided this I decided to create my own.

Here is the link http://rokkan.com/testing/tween/rokkan_bezierdefiner.swf .

To use this program I recommend downloading the accompanying class ZigoTween.as .


Example of creating a custom tween:


var zt:ZigoTween = new ZigoTween([{Mx:0,Nx:0,Ny:-1000,My:0,Px:500,Py:500},{Mx:500,My:-500}] );
TweenLite.to(mc,1,{x:200,ease:zt.ease});


This example assumes you have imported the ZigoTween.as class.

If anybody can help me make this a custom Flash Panel I would appreciate the help.

13 comments:

佛玉 said...

good ,I like it ,I am from china yahoo,ths

Marfastic said...

Woops, the files had been taken down for awhile. They should be back up now.

Anonymous said...

That class does not work...
Gives a lot of errros, variables are not declared, etc.......

Marfastic said...

Hey Anonymous. I have been using this class for about 6 months and I have not had any problems with it... Occasionally a tween I make with it throws an error (but that hasn't been happening with the latest TweenLite). Can you give me an example of your code that doesn't work?

actionfilter said...

thanks very much!

Anonymous said...

does this work for AS3?

Marfastic said...

Yes it is actually written for AS3 (although an AS2 version could be made if there are requests).

Anonymous said...

Can't get it to work, is this correct?

import gs.*
import com.rokkan.tween.ZigoTween;

var zt:ZigoTween = new ZigoTween ([(Mx: 0, Nx: 0, Ny: -1000.00000, My: 0, Px: 500, Py: 500), (Mx: 500, My: -500)]);
TweenLite.to(mc,1,{x:200,ease:zt.ease});

Marfastic said...

Yes those import and the code is right. I think I would have to see the whole code to understand what might not be working... What type of errors are you getting?

Anonymous said...

got it to work! there are some syntax errors in your example code, when you copy it, I had to use the Bezier graph to get the right code. But Thanks! and Great work!

Marfastic said...

Hmmm, I just double checked my example code and it worked for me. So I am not sure about that, but I am glad you got it working!

Anonymous said...

Found the error, in the Zigo example code. You have ( and )instead of { and }. Fix that and you are all good! Thanks again!

Anonymous said...

oh weird blogger show upas ( no matter, suppose to be parentheses what, that's your problem.