Jump to content
Search Community

OOP customizing TweenMax

protoemocional test
Moderator Tag

Recommended Posts

Hello,

 

 

Is it possible to "extend" the TweenMax class, in order to add some customized functions?

 

Suppose I have this function, toLine():TweenMax, that returns new Tweens according to different data that is manipulated dinamically within reach of the Document class (or perhaps an instance of another class).

 


var t:TimelineMax = new TimelineMax();
t.append(TweenMax.toLine(movieclip, somevariable, someothervariable));

 

Is this at all possible using OOP? Or am I just daydreaming?

 

Thanks a lot, any pointers appreciated.

Link to comment
Share on other sites

Could you provide a few more details about what you specifically need to do? It is very doubtful that you'd need to extend TweenMax to get what you need. TweenLite and TweenMax were built with a very flexible plugin architecture that makes it relatively simple to add custom functionality without bloating the core set of classes and without needing to extend the core class. You just extend TweenPlugin and create your own functionality in a plugin. There's also a dynamicProps plugin that might give you what you need (tough to say because I don't quite understand your goal). There's an interactive example of the dynamicProps plugin in the Plugin Explorer at http://www.greensock.com/tweenlite/#plugins

Link to comment
Share on other sites

Nevermind, I think I solved the issue. Anyhow, I have noticed that if you have a TimelineMax (time1) variable instantiated directly in your document class, nothing you append from within the IDE timeline will progress beyond state 0. This become even worse if you want to append some global TimelineMax (time1, time2, time3) variables to a master TimelineMax (master.append()), also from within the document class. To append to "master", you have to instantiate them first. But if you want to append anything to them from within the IDE timeline frames, you need to reinstantiate them and thus loose all of master's inherited properties – for instance, useFrames.

 

This means that Timelines are made to act as modules, so... you can't just control them globally, regardless of appending-by-frame?

 

Thanks, as always.

Link to comment
Share on other sites

Sure, you can add stuff whenever you want - it sounds like you might just be misunderstanding how timing works in TimelineLite/Max. Please read this thread: viewtopic.php?f=1&t=3842&p=15044#p15044

 

I've used a global timeline many times. In fact, the whole animation on the GreenSock.com home page was built in that way (a master TimelineLite that had lots of child TimelineLite instances added to it, each with their own tweens). That made it very easy to piece together in a modular way and skip to wherever I wanted during authoring, etc.

 

You probably either didn't pause() the timeline(s) when you should of, or you didn't place your tweens/timelines into the master in the appropriate way (at the right insertion time). Hopefully the above thread sheds some light on the concept for you.

 

Have you watched the video at http://www.greensock.com/timeline-basics/?

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