Jump to content
Search Community

cerulean last won the day on April 30 2013

cerulean had the most liked content!

cerulean

Members
  • Posts

    133
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by cerulean

  1. Thanks -- I'll try that. I did get it working fine in the end, but only by keeping it a separate timeline -- that is, if I created the child timeline (as per your original helpful code) and set the time() to be partway through (.5 for me, .97 in your code), when I added it to my main timeline the time got set back to 0. Is this to be expected? Or is there something going wrong somewhere in my code?
  2. I've solved this, but I have no idea how, and I'm trying to understand what happened. I have TImelineMax's set up in a class. One of them is this, super-simple -- I use it to have a person 'escaping' or not escaping -- if they are escaping, they move off screen, if you click, the timeline is reversed and they come back. Instantiations of this class are being moved in z-space forwards, in a timelinemax which contains repeat = -1 tweenmaxes (as per Carl's great help) -- when the person disappears off screen in the distance I reset this timeline to get them not escaping anymore. I was using gotoAndStop(0) but now am using seek(0), pause() -- the reset can happen while the timeline is moving forwards, or reverse. _escapeString = Math.random() > .5 ? "+=" + ESCAPE_DISTANCE : "-=" + ESCAPE_DISTANCE; _escapeTimeline = new TimelineMax({paused:true,onStart:tlStart,onComplete:tlComplete,onReverseComplete:tlReverseComplete,ease:Linear.easeNone}); _escapeTimeline.add(new TweenMax(this,ESCAPE_TIME,{x:_escapeString,ease:Linear.easeNone})); As I said, I solved it, somehow -- but as I don't like unknown unknowns, my question is: apart from kills(), is there anything else that would make the duration() of a timeline == 0, and the progress() == NaN ? That's what was happening. But the timeline itself existed, i.e. != null.
  3. Thanks! One question: with a timeline like this, where the attached tweenmax'es go on forever, what is the length of the timeline, so the next thing added knows when to fire? mainTL.add(carlsTimelineWithRepeatingTweenMaxes); // what's the length?mainTL.add(anotherTimeline); // to determine when this will start? It works well but as my objects move in z space and also randomly in x space, I have to do some resetting when they get back to the end, that is 'onRepeat' -- One thing: I tried setting progress() but I had to set it to something like 0.001 -- is that because the 'duration' is 'infinite'? UPDATE: Yes, having problems when I try to add to main timeline. It just doesn't seem to work there very well -- as if adding it were resetting the already set time()…
  4. Thanks. Yes, all the sounds are loaded. In fact I'm able to grab them from the LoaderMax before I can't grab them from LoaderMax from within the timeline callback! (I also get reports that they're loaded from within the main progress report of my xmlloader — the progress of an xmlloader loading xml that contains MP3Loader nodes will report the percentage of all things loaded? Or will the complete for the XMLLoader fire before the MP3s are fully loaded?). I'm working in AS3 -- what would I be looking for in terms of scope? I don't know what I'd be looking for, the difference between a call called external to a timeline, and a call called as a callback from within a timeline that is played immediately… UPDATE: Banging my head on this one. The call to LoaderMax.getContent works in my function and then if I put in a delayed call, (forget about the timeline, just a TweenMax delayedCall) stops working. A number of class instantiations happen in between, i.e. a lot of stuff going on but nothing that should affect LoaderMax internals. Why would a call to LoaderMax.getContent('mysound') work and then not work? Could it be GC? I know that an FLA is called for, but this is a two-month project and I don't think I can pull it apart at this point — and the devil seems to be in the details. So, to summarize, LoaderMax works fine, then something I'm doing is making it not return the Sound anymore.
  5. UPDATE: If I load the sounds using LoaderMax.getContent() into an object soon after I load the xml and then grab them by name when I do the TimelineMax callback, all works perfectly. That is, I can't use LoaderMax.getContent() from within the TimelineMax callback, but if I do it first, and use the saved sounds, it works fine. Why?? Does this have something to do with the note in the API that the sounds that are loaded may get garbage collected and you need to make local copies? Or am I reading that wrong? The way my class structure is set up, I can't load the sounds immediately after loading the xml, but only when I instantiate a class that will use that xml (shortly thereafter). If there's a GC issue how much time do I have, if any, before the sounds are at risk?
  6. I have a function set up to play a loaded MP3 by name string: protected function playSoundByName($name:String):void { // trace("play sound by name ", $name, LoaderMax); _currentSound = LoaderMax.getContent($name); // trace("current sound is ",_currentSound); if (_currentSoundChannel) _currentSoundChannel.stop(); // trace("the sound is ", _currentSound,_currentSound.length,_currentSound.url); _currentSoundChannel = _currentSound.play(0); _currentSound.addEventListener(Event.SOUND_COMPLETE,soundComplete,false,0,true); } Which works fine when I call it directly, but not when I call it from a callback in a TimelineMax (see below -- the first call works fine, the one from inside the TLM does not). I'm sure I'm missing the obvious, but it's a big problem…Thanks… var introSoundsTL:TimelineMax = new TimelineMax({ease:Linear.easeNone}); playSoundByName("jsTexasSurf"); // works! introSoundsTL.addCallback(playSoundByName,0,["jsTexasSurf"]); // the sound from LoaderMax.getContent() in called function is null! (The loaded xml is in this form: <?xml version="1.0"?> <content> <timelimit limit="45" /> <MP3Loader url="music/jetski/321go.mp3" name="js321Go" autoPlay="false" load="true" /> <MP3Loader url="music/jetski/pg3-300beachs.mp3" name="js300beaches" autoPlay="false" load="true" /> <MP3Loader url="music/jetski/pg5-texassurf.mp3" name="jsTexasSurf" autoPlay="false" load="true" /> </content> )
  7. If you have more than one loaded asset with the same name, how does LoaderMax.getContent() resolve that? I have a lot of assets to load -- maybe 70 mp3s, and while I can make sure no names ever duplicate, I'm wondering whether it's not easier to use the instance version of LoaderMax's getContent, rather than the static. What is the best practice? Thanks!
  8. Thanks. I see the basic concept, that you stagger them with the offset based on total number, but, yes, seeing it in AS3 might help. I'm a bit unclear what the ()time and scale() calls are for, and how the delayedCall() fits in — I was able to get the thing to work using a formula that did something like this: calculate for each element already in position the tween time by (finalZ - currentZ)/pixelsPerSecond -- and then simply doing a TweenMax onComplete to generate a new Tween for each object when it had reached the destination. It worked, but I was unhappy with it, as it both used a TimelineMax and then popped out of it to start generating Tweens — ugh. Yours looks great -- if you could explain it slightly more that would be very helpful
  9. I have a situation where I want to have a number of objects tweening from different starting points towards a common goal. They are moving in the same direction, and should move at the same pace. I also want to get rid of the object when it reaches its goal, and add a new one (or the same one) at the back of the queue. Picture a line of people moving forward in a queue: they shuffle forward slowly, all at the same speed. We start the queue with a line already formed, that is, we 'open the scene' with the line in place. Is there a way to do this with TimelineMax? I had thought of something like this _mainTimeline.to(_people,TIME,{z:"+=1000"},"+=1"); But they won't all end up at the same end point. If I substitute a fixed end point (i.e. z:1000) then they won't move at the same pace, since they distance they must cover is different. I also need to figure out a way to keep adding and removing from the queue. I suppose the answer might be to maintain an array of TweenMax's, or simply to do old-school ENTER_FRAME +='s, but I very much like the robustness of TimelineMax
  10. I've been trying to work up a 'shaking' effect on elements, using RoughEase. Rotations, x, y all get stuck at the end and don't return to their original spots, as yoyo:true, repeat:1 would seem to indicate they would. (centPoint is stageWidth/2, stageHeight/2) —I'm sure I'm missing something but I was curious whether doing yoyo and repeat with transformAroundPoint and RoughEase was a problem in some way… private function makeNewShakeUpTimeline($objects:Array):TimelineMax { var tl:TimelineMax = new TimelineMax; var centPoint:Point = new Point(TTConstants.FULL_WIDTH/2,TTConstants.FULL_HEIGHT/2); var dirx:String = Math.random() > .5 ? "+=20" : "-=20"; var diry:String = Math.random() > .5 ? "+=20" : "-=20"; tl.add(TweenMax.to($objects,.5,{transformAroundPoint:{point:centPoint},rotation:dirx,yoyo:true,repeat:1,x:dirx,y:diry, ease:RoughEase.ease.config({clamp:false,points:50,strength:3})}),0); dirx= Math.random() > .5 ? "+=10" : "-=10"; diry = Math.random() > .5 ? "+=10" : "-=10"; tl.add(TweenMax.to($objects,.25,{transformAroundPoint:{point:centPoint},rotation:dirx,yoyo:true,repeat:3,x:dirx,y:diry, ease:RoughEase.ease.config({clamp:false,points:40,strength:2})}),.5); dirx= Math.random() > .5 ? "+=5" : "-=5"; diry = Math.random() > .5 ? "+=5" : "-=5"; tl.add(TweenMax.to($objects,.25,{transformAroundPoint:{point:centPoint},rotation:dirx,yoyo:true,repeat:3,x:dirx,y:diry, ease:RoughEase.ease.config({clamp:true,taper:"out",points:30,strength:1})}),.75); return tl; }
  11. As I understand it, a Timeline is set up so that it uses the values of variables at the time the timeline is created. Thus, if n=100 tl.to(mc,1,{x:n}); will move mc to x = 100. What happens if I do var n:int = 100; tl.addCallback(function() {n = 200}); tl.to(mc,1,{x:n}); More importantly, what if I want the timeline to use values that are determined at the time the timeline plays? (Yes, I could do a test of above, but I'm trying to understand this once and for all, conceptually — I'm setting up complex timelines with many moving parts and subcalls, and trying to understand what is called/evaluated now and what is called/evaluated later). Thanks for any insight(s)!
  12. I tried it with a simple FLA at my end, it worked fine. I will assume that it's a side-effect of something elsewhere in my code. I suppose, though, since I was getting two different results, I wanted to check whether I was understanding the manner in which callbacks interact, in terms of timing and being placed at specific points in the timeline, with the tweens, etc. As I understand it, although callbacks take up zero space in the timeline, if you try to sequence things with the placement param ("+=n"), things will be kept in sequence. (Sorry if some of these are basic queries — I feel like I did when I was first learning German; it all makes sense in the end, but making sense of the grammar/API, and the exceptions -- finding the big picture -- takes a while)
  13. This is another no-brainer that's puzzling me. If someone could show me the error of my ways I'd be grateful. In this code tl.to(startButton,0.25,{autoAlpha:1}, "+=1"); tl.addCallback(waitForStartButtonPush,"+=0.01"); tl.to(startButton,0.25,{autoAlpha:0}, "+=.01"); where "tl" is a timelinemax appended to the main timeline and 'startButton' is a movieclip on stage, followed by private function waitForStartButtonPush():void { _mainTimeline.pause(); startButton.addEventListener(MouseEvent.CLICK,startButtonClick,false,0,true);} the issue I was having is that the startButton was only tweening partway to autoAlpha== 1. I solved this by putting the autoAlpha tween inside waitForStartButtonPush(), before I paused the main timeline, but I was unclear why it wasn't working the first way — why is the call to mainTImeline.pause getting called partway through the tween? It may be something in the way I've ordered my timelines, but I wanted to know if there's a reason I'm missing in the way I'm timing things.
  14. Makes sense, but I think it would be nice to have something like TimelineMax.defaultEngine = TweenMax as an option. I fully agree that one should keep it as light and flexible as one can, by default, but it would be nice to have that option.
  15. Doh! Of course. When you chain calls, they're always evaluated left to right?
  16. I've been making good use of TimelineMax's convenience methods: timeline.to(....), etc. As I understand it, these are syntatic sugar for timeline.add(Tweenlite.to(...)), etc Is there a way to change it so that the convenience methods would instead use TweenMax? Ran into an issue where I was trying to use 'yoyo' but wasn't working…and it's because TweenLite doesn't offer 'yoyo', I believe. I offer it as a suggestion for future releases, if it's not currently implemented.
  17. This seems like it should be a no-brainer, but I've searched the API and can't see how to kill a Tween(Max) and force it to complete. I see how to kill ALL tweens and force to complete, or child tweens of a particular object and force them to complete, but for a TweenMax I didn't see the option to force to complete. Could someone point me in the right direction? Thanks!
  18. I am using a Coverflow AS3 animation (http://www.weberdesignlabs.com/2009/12/flash-10-coverflow/) that I've taken apart and modified somewhat. The basic structure is intact, though. The coverflow I'm doing needs to simulate a sort of random 'spin of the wheel' and then land on a predetermined end card. I'm doing this by simulating clicking left or right, and looping through the array of cards a couple of times before checking each one and then stopping when I've got the right one. "Simulating clicking left or right" means simply calling his 'previous click' or 'next click', which takes care of all all animation and housekeeping. As I'm under tight deadline, this seemed easiest — what I needed to do was allow for sufficient time for his animations to play out, so in the loop I'm using a TweenMax.delayedCall to wait for the nextclick/prevclick to finish before I call it again. That's what I meant when I said that I had to be able to update graphics. It works OK, but the client, while they like the effect, isn't happy with the way it plays out — they'd like the entire thing to have some nice easing in it — so that the cards flip through faster at the start and then do a Quad.easeOut as they move towards the end. I did it this way: adding a series of callbacks to at infinitesimally small intervals on a TimelineMax and then in each callback pause the TimelineMax, call the next/prev click,then resume it on end of the coverflow click animation. I calculate the number of callbacks to add by number of loops I want to go through the deck plus/minus the distance from where I'm at to where I want to end up. Seems pretty good.
  19. Is there any built-in functionality to the gs platform to allow the discrete tweening of variables? That is, if I want to tween a var from 0 to n in discrete, integral steps?
  20. I need to 'spin' a coverflow that will go from the start element to another random element after looping through the entire coverflow list a couple of times. That is, let's say you were spinning a wheel like the wheel of fortune (the game show) -- you have integers on the wheel that range from 0 to 8 (or whatever) -- you are staring at some random place (e.g. 3) and will simulate a random spin to another value (e.g. 6) -- you have different spin directions -- the user can spin left and right. In this case, it's not a wheel, so I can't use rotation — it's a coverflow, and I need to update the coverflow graphics each time an element changes (bring the new one to center, move the other ones to the side). My two questions are: 1) does it make sense to do this with some kind of discontinuous tweening? Perhaps I could use TimelineMax, but trying to make a smooth animation of the several tweens that would be added to the timeline seems a bit awkward. I'd have to calculate the TweenLite times based on where I started and ended. Is there any way to use some kind of rotation tween of the current element number? 2) what's the best way to do a complex graphics update mid tween? Sometime that takes longer than a split second? Perhaps, now that I consider it, a tween might not be the best way to go, or even a timeline — perhaps I simply have to move the index one element at a time, updating the graphics at each turn, and not rely on tweening to do it for me, but I was curious… Thanks for any help.
  21. Just downloaded the latest 'bonus' AS3 files and am getting strange TimelineMax errors, in particular it doesn't seem to grok 'to' and 'from" -- the funny thing is I haven't touched the code generating the error recently -- It just started when I grabbed the new libraries -- it's happening with TImelineMax .to() and .from() 1061: Call to a possibly undefined method from through a reference with static type com.greensock:TimelineMax. -- and stopped when I put the old libraries back
  22. Thanks. Very helpful. As per Jack's help, I believe the issue with the main code was that tweenFromTo() triggers listeners in the intervening code, which seek() got around -- that is calling seek() went to the right spot without calling the listeners in between. Jack sent me some code that skipped the listeners in the tweenFromTo() and it seems to have solved the problem.
×
×
  • Create New...