Jump to content
Search Community

Axonn

Members
  • Posts

    45
  • Joined

  • Last visited

Everything posted by Axonn

  1. Or, more shortly, tl.totalProgress = tl.currentProgress; Thank you Carl. Excellent reply, as usual with you guys! ;;- ).
  2. I got a TimelineMax which repeats non stop (repeat = -1) UNTIL a certain event happens. When that happens, what I want is the animation to STOP REPEATING. Unfortunately, setting repeat to 0 also resets the "playhead" to 0 instead of waiting for the current animation to finish. I don't know if there is another method to do this. Also note that I'm using the OLD animation platform (2012-06-30 / TimelineMax 1.698). To accomplish my task, I had to make "_cyclesComplete" in TimelineMax publicly accessible (via property). Then: tl.repeat = tl.cyclesComplete; So the suggestion is to take care of this issue so that it is no longer an issue ::- D.
  3. Yes. I see. But I'm a big fan of consistency. So then, I would be in favor of removing event dispatching from Tween*.* and let's just all work with .vars. (thanks for joining the talk).
  4. Ouchhhhhhhhhhh. I never thought of trying those two! I feel dumb. Thank you carl schooff! ::- D. LATER EDIT: However, it would be nice I guess for TimeLine to have addEventListener as well, for consistency reasons. Do you agree?
  5. I suspect that this topic has been approached in the past, but I want to bring my own 2 cents to the table (if you'll have my cents ::- D). Since we can add onComplete and other such callbacks upon construction, why can't we add it later directly in the instance (if we saved the reference to the instance of the TimeLine or Tween). For example, in my situation, I want to add an onComplete to a TimeLine, but only sometimes. It's clumsy to call the constructor in an if statement. I would prefer to call the constructor and append methods and only later add the onComplete event (or any other such events). Are you just saving space in the library? Because as far as I suspect, this would be a piece of cake to make. Could you perhaps advise how to implement this as an extension to your library? I'm thinking of extending the TimeLine class and add the properties myself. Size is not a concern for me (these days, for who is?).
  6. Hm, I thought about using that method. So you think this approach should work, right? I mean, what I'm trying to do is not impossible.
  7. Hello everybody ::- ). I have a board with many well organized objects on it. I would like to create an animation where they all start circling at various speeds. But the problem is that I want them to start on their circle paths from their current locations, swirling around the center of the screen. Any idea how I could do this? I guess I could use Pythagora's theorem to find out the radius of the Circle, but I'm unsure how I could find out the progress of the Object onto its Circle Path, so that I only start the animation from that point. Otherwise, when I add it to the Path, it'll lose its original position and I don't want that.
  8. I completely agree with you. If it's not used enough, definitely not worth the extra bytes! I'm sure it's not in the "kb" range but if you keep adding, yes, you will get into the kb range and then in the tens of kb range. I used overwrite: 3 (CONCURRENT).
  9. Hello everybody ::- ). I'm trying to use TimelineLite to do some nice text animations. As part of my task, I need to change 2 GlowFilters which I applied on the TextFields. One GlowFilter is inner and the other is outer. Now... the way I tween ONE GlowFilter, is like this: _StoryTextsTimeline.append(TweenMax.to(text1, 2, { x: 100, scaleX: 1, scaleY: 1, glowFilter: { index: 0, blurX: 2, blurY: 2 } } )); But then, how can I use the same glowFilter vars property in order to target my *second* GlowFilter on the same object? I can't specify glowFilter twice, nor can I specify two different indexes. I think that it would be wise to allow the glowFilter vars property to accept an ARRAY as well as a simple Object (like it is now). Whenever you see that you got an Array there, you for-each it and treat all its members as glowFilter instruction Objects. Anyway, the only solution I found to this is to append another extra Tween with an offset of minus initial_tween_time. This way, the two tweens will launch simultaneously within the Timeline. If there is any other way to achieve this, I'm all ears.
  10. As far as I know, you can't even export a running SWF to a video. But what you want to do is perfectly achievable. What you need to do is use FRAPS or Camtasia to capture the screen. In Camtasia, you should turn off any video compression routines so that it captures the stuff at highest quality. After that, you can play with it all you want, wherever you want ::- ). FRAPS is free but with limitations. I'm sure you could find some other free screen capturing tool if you search well enough.
  11. What got my confused was my object-oriented C# thinking ::- D. I said that: Hm, if you pass a reference to a variable to TweenCore, then if you change that reference, when onComplete executes, the value you get in onComplete Params will also change. But it's not like this because the vars object of the Tween gets saved internally in the TweenCore, so the original reference is kept. The variable is simply used as a vessel to feed that reference to TweenCore. Correct me if I'm wrong.
  12. Nevermind what I said. You don't need that array. You can just do as carl schooff showed you. You won't lose your reference. It was my mistake to add that new array. Just pass your image to onCompleteParams and you should be fine.
  13. Yeap. You got that exactly right ::- ). LATER EDIT: I see in your code: posarrax[supimg.id], y: posarray[supimg.id] Which means you have some Arrays for some internal use. Well, use those arrays to store in them the "supimg=evt.currentTarget". posarraImages[supimg.id] = evt.currentTarget Then: TweenMax.to(whatever, 4, { whatever_You_want_to_tween, onCompleteParams: [posarraImages[supimg.id]], onComplete: YourFunctionHere[/b] } ); Then, in your onComplete Function code, don't forget to clean up the array elements which you don't use any more.
  14. You can do it directly. In ActionScript 3, arrays can be declared inline when you first type [].
  15. IX and IY are some properties of mine. I just pasted something from one of my projects. You use whatever you have there. pl3 is not an array. It is an element in an array: [pl3] = array onCompleteParams needs an array parameter.
  16. Use onCompleteParams. You pass an Array to it, like this: TweenMax.to(pl3, 4, { scaleX: 1, scaleY: 1, x: pl3.IX - planetOffset, y: pl3.IY, onCompleteParams: [pl3], onComplete: FinishedZoomForObject } ); In my code, I pass a 1-element Array where the "pl3" object is the single element. The receiving Function's signature has to look like this: private function FinishedZoomForObject (pl: SomeObject): void As you can see, [pl3] is an array. You can pass more things there. In that case, make sure your Function accept an Array argument, instead of SomeObject. As for your reference problem: you will have to clone your object. Otherwise, the Function will always receive the CHANGED version (if it changes). Either clone it, either create a new reference every-time you need to and clean up the old reference in the onComplete function.
  17. Damn, unfortunately, my attempt for a workaround didn't turn out so well. When doing that "resume", apparently the Timeline gets "dirty", and the "totalDuration" getter is called internally in your library. And it crashes ::- ( TypeError: Error #1009: Cannot access a property or method of a null object reference. at com.greensock::TimelineLite/get totalDuration()[TM_PATH\com\greensock\TimelineLite.as:926] at com.greensock::TimelineLite/renderTime()[TM_PATH\com\greensock\TimelineLite.as:530] at com.greensock.core::TweenCore/setTotalTime()[TM_PATH\com\greensock\core\TweenCore.as:270] at com.greensock.core::TweenCore/restart()[TM_PATH\com\greensock\core\TweenCore.as:126] at Gamaddiction.Games.AlienInvasion.Engine::LMRcade/Announce()[GAME_PATH\Engine\LMRcade.as:446] I updated two weeks ago. The error is at "prevStart = tween.prevNode.cachedStartTime;". prevNode is NULL. I'm stuck again ::- (. Without that resume, I'm dead. My Timeline gets corrupted when I do resumeAll (I think! I'm not sure). What happens is that after I call resumeAll (when I close the game's menu), most of time (not always though), my Announcer text appears with a delay of ~1 second. And it *CONTINUES* to appear with that delay EACH time I call the Announcer EVEN IF I didn't pause the game any more! So it's like resumeAll somehow *permanently* nudges my Timeline Lite about 1 second and all subsequent calls occur with that delay. Any idea how I could workaround this? Is it possible to somehow make resumeAll ignore my 4 tweens which are already handled by the TimelineLite instance? I tried doing that " for each (var tw: TweenMax in _AnnouncerTimeline.getChildren()) tw.resume(); " inside the function which also does the resumeAll instead of the Announce() function. I get the same Error but without a stack trace inside my game (it's only the first 4 lines, TimelineLite.as only), so it crashes while the internal rendering occurs in the library. I tried handling the error but to no avail: once it occurs, my TimelineLite crashes and I get no more Announcer Text *sigh*.
  18. Hey! Thanks for answering ::- D. After I corrected the error you pointed me, indeed, the behavior is much more predictable. I do see it as an error. It's obvious that tweening occurs between two values. When you explained it that well, I immediately realized why the .paused = true behaves the way it does: it's because it pauses the Tween and it doesn't get to render until I set the scaleX and scaleY to 0.01. And because of that, I first play the Timeline and it does get to render, it will start from 0.01. Should have seen it. As for pauseAll and resumeAll, it's a bit more complicated. I'm not using Flash. I work in Flash Builder 4.5 and I'm developing two separate products: a UI library and a game (which uses the UI library). My game has a Pause function, as I said, and when it gets paused, it's very handy to pauseAll. Many objects have animations integrated in them rather than keeping everything in the Engine. You could say that keeping everything in one place is good, but not when you're dealing with a 45.000 lines of code game. I need to separate animations PER OBJECT because of concern separation. So then I got about 20 classes in which various animation occurs. It's very handy to pauseAll. And I will give you an other reason why globalTimeScale won't work for me. You see, when I pause the Game, I need all the objects in the Game paused, but *NOT* the subsequent animation calls. Because when I pause the game, the UI Library menu comes into play, and that guy also uses TweenLite/Max. So if I use globalTimeScale I will effectively freeze everything which I *don't* want. pauseAll is actually ideal because (fortunately for me) it pauses all CURRENT Tweens, but not future ones. So you see, your "legacy" function is quite useful. Or maybe I'm using your library in a wrong way... (???) I found the problem I had with pauseAll / resumeAll. You see, when I invoke the Menu, I do pauseAll. But if I click "Give up" in the Menu, then, it goes to another module and will *NOT* do resumeAll. When I return to the "animated" area and I try to Announce something, I restart the TimelineLite in the Announce() function. But all the TweenMax instances in the TimelineLite are still paused, because I didn't resume them. So, I also needed to do this in the Announce(): for each (var tw: TweenMax in _AnnouncerTimeline.getChildren()) tw.resume(); I suppose that if I would rebuild the entire game, I could create a sort of "Tween Register" where I have Dictionaries for Game-Related Tweens and for UI-Related Tweens. What do you think? Sounds like a reasonable solution? Maybe I'll do that in my next game. Damn, you know this library so well......... it's .......... it's ....... well... believe it or not... it's almost like YOU WROTE IT! *grin*.
  19. Hello everybody ::- ). I got myself into a very weird situation with Timeline Lite and I'm hoping maybe somebody can clear me up about how to manage its Play Head. For my game, I created an Announcer component which shows various messages on the screen, in big red letters. To do this, I used a TimelineLite in which I got 4 TweenMax instances. One of them uses a YoYo (for the flashing the Text). This is how I create the TimelineLite, in the Class Constructor (because I want to reuse it every-time I want to announce something): _AnnouncerTimeline = new TimelineLite(); _AnnouncerTimeline.append(TweenMax.to(_AnnouncerHost, 0.5, { scaleX: 1, scaleY: 1, glowFilter: { color: 0xFF00D5, blurX: 40, blurY: 15, strength: 3 } } ) ); _AnnouncerTimeline.append(TweenMax.to(_AnnouncerHost, 0.1, { glowFilter: { color: 0xFF00D5, blurX: 5, blurY: 5, strength: 2 } } ) ); _AnnouncerTimeline.append(TweenMax.to(_AnnouncerHost, 0.1, { repeat: 20, yoyo: true, glowFilter: { color: 0xFF00D5, blurX: 40, blurY: 15, strength: 3 } } ) ); _AnnouncerTimeline.append(TweenMax.to(_AnnouncerHost, 0.5, { scaleX: 0.01, scaleY: 0.01, onComplete: function(): void { _AnnouncerHost.visible = false; } } ), 2 ); _AnnouncerTimeline.paused = true; //If I don't do this, when starting the TimeLine, it will always start from step 2, completely ignoring the GROW part. I use this to 1. Grow 2. Blink-Glow 20 TIMES, 3. Shrink an announcer text on the screen. I trigger the Announcement via this Function: private function Announce (text: String): void { _AnnouncerText.text = text; //This is contained within the AnnouncerHost Sprite and the basic properties are initialized elsewhere. _AnnouncerHost.visible = true; _AnnouncerHost.scaleX = _AnnouncerHost.scaleY = 0.01; //Reset Scale. _AnnouncerHost.filters = _AnnouncerGlow; //Refresh glow. //_AnnouncerTimeline.restart(true); //Tried to use it, but doesn't help. Obviously, should do the same thing as the line below, which also doesn't help. _AnnouncerTimeline.gotoAndPlay(0); //When I do this, if I hadn't PAUSED the TimeLine at the beginning, the Announcer will NOT grow. } Usually it works OK. But during my game, sometimes I invoke TweenMax.pauseAll() and TweenMax.resumeAll() (when the game is Paused). And what happens when I do that, is that the Announcer Timeline goes crazy. Instead of the text appearing and flashing, it appears and just stays there for about 2 seconds, AND ONLY THEN it starts to Flash, and after that, it disappears. So the duration of the Timeline actually increases. It is interesting that it stays for 2 seconds, because that's exactly the time it should YoYo. Or, it appears seconds later. The other weird thing is that if I didn't PAUSE the Timeline at the beginning, no matter how hard I would want to restart it, it will still start directly from step 2 (fully grown). This is even though in the Announcer Function I'm settings its scale to 0.01! I'm definitely not using something the way I should. I think the Timeline doesn't restart the Tweens by itself, and somehow I'm mixing it up with resumeAll() as well. LATER EDIT: Ok and now I also noticed that if I let the Timeline PLAY FOR AT LEAST ONCE before starting to pause the game, IT WILL ALWAYS WORK OK AFTER THAT. *sigh*
  20. It works ::- ). Thank you for answering so soon. My evening was getting depressed because of this ::- D. I had a tough development day yesterday and this is exactly what I *didn't* need today. I was 100% sure I'm missing something in the way I'm using the library. Well... actually... it turns out I really did *grin*.
  21. No, I am not sure at all ::- ). As a matter of fact, I'm about 6 months behind. Let me update right now.
  22. Hello everybody ::- ). I stumbled upon a strange issue using Paths. for each (var scr: Saucer in saucers) circlePath.addFollower(new PathFollower(scr), circlePath.angleToProgress(saucerIndex++ * (360 / saucers.length))); Then, later: circlePath.removeFollower(circlePath.getFollower(some_saucer)); This results in all objects on the path freezing in their places. I am tweening the path like this: tw = TweenMax.to(circlePath, 5, { progress:1, repeat: -1, onRepeat: CirclePathRepeated } ); Any tips are greatly appreciated. Am I doing something wrong? I tried like this, and same failure: for each (var scr: Saucer in saucers) circlePath.addFollower(scr, circlePath.angleToProgress(saucerIndex++ * (360 / saucers.length))); then circlePath.removeFollower(some_saucer); I got a call assigned to my TweenMax "onRepeat" and I can confirm that the TweenMax continues to operate normally.
  23. http://greensock.com/as/docs/tween/com/ ... nterOrigin height of the rectangle in its unrotated, unscaled state (does not factor in any transformations like scaleX/scaleY/rotation) CenterOrigin is definitely not height ::- ).
  24. I didn't look at the code. Now I do. getAllTweens ===> var ml:Dictionary = masterList; So apparently it uses the same "masterList" of TweenLite? Right?
  25. Is this the way it is supposed to work? I find it a bit surprising considering that the two classes each has a separate (?) Master List.
×
×
  • Create New...