Jump to content
Search Community

bosonandtennille

Members
  • Posts

    8
  • Joined

  • Last visited

bosonandtennille's Achievements

0

Reputation

  1. This has been driving me crazy for a long time. I am trying to do something fairly simple: reset a timeline to its initial values after it has played and stopped and then start it at some point after the very beginning without having the sprite it's controlling flash visible with pre-tween properties. Simple code example: mysprite.visible = false; // this is so it won't show at its initial location before the tween has started var tl = new TimelineMax(); tl.append(TweenMax.fromTo(mySprite, 1, {visible:true,x:-100}, {x:0,onComplete:startAgain})); tl.play(); function startAgain() { mySprite.visible = false; // so it won't flash in the current location then update to the tween location. tl.gotoAndPlay(0.002); // this is not zero so I can synch with a different tween } The problem here is that although the visible=true from the first tween in the fromTo() constructor works the first time through, it doesn't when the gotoAndPlay is called from startAgain() and the sprite remains invisible. But if I set it to visible before calling gotoAndPlay() in startAgain() it's initially in the wrong place and there is a flash. I don't care if my approach is totally wrong, I just want to know the best practice for resetting the initial values of a timeline/tween and also flipping visibility on after they get set up.
  2. I was trying to set the filter directly on the sprite as the starting value which didn't work. As a parameter of the tween passed to fromTo() it did. Thank you!
  3. I'm trying to start a tween with a nonzero blur value, but the image fails to draw at all. Is there some reason you can't do that? I can end the tween with the same nonzero blur value just fine. Anyone have suggestions about creating a nice blur transition like the one at gamespot.com at the top?
  4. Somehow I missed a couple of those. So, assuming I had labels at the beginnings of the tweens I want to synch I could do something like: timeOffset = timeLine1.currentTime - timeLine1.getLabelTime(myTimeLine.currentLabel); timeLine2.gotoAndPlay(timeLine2.getLabelTime(labelToSynchWith) + timeOffset);
  5. My timelines have labels at the key points so I was thinking of doing something like (pseudocaode): timeCorrection = myTimeLine.currentTime - myTimeLine.timeOfLastLabelPassed() And using timeCorrection to offset the second timeline like this (pseudocode): idealStartTime = otherTimeLine.labelTime('startlabel'); otherTimeLine.gotoAndPlay(idealStartTime + timeCorrection); But since the only label to time function I could find was getting the array of all labels with their times I decided to use a less reusable technique where I cache the idealStartTime when I'm originally constructing the timelines and later calculating the correction based on that. It works but it's not as elegant as I would like. It might be interesting to think about what functions would look like that would make this kind of arbitrary inter-timeline tween synching easier. Or maybe I'm the only one doing this.
  6. Because I'm trying to synch a single tween from one timeline with a single tween in a different temporal position on another timeline. I guess that's really the core question: is there a way for a tween to start another tween in a different timeline (or no timeline) at the same time it is starting itself? I sort of assumed that's what onStart() was especially good for. I'll try this for proof of concept. It's not great because the relationship of the other tween isn't always the same from situation to situation and I need a general, perhaps label based solution. gotoAndPlay(label) had the same problem of not starting at the same time. Sadly they play programatically in ways that change based on user interaction so this won't work.
  7. Ahh, that explains it, thank you! My timelines are separate because this code is a simplified version of a system where each sprite needs a unique timeline. In addition the empty tween I've inserted between the arrive and depart tweens won't always be empty in the actual application. So sadly I can't use your simplification. So is there a way to handle this with two independent timelines so I can start a tween in one at the same time a tween starts in the other? I tried using an oncomplete in the previous tween instead but that seemed to have the same behavior.
  8. I've got two sprites of identical size, both the full dimensions of the stage. I want the first to exit the stage with the same tween as the second one enters the stage with no visual gap between them. The following code creates two simple sprites and creates for each an identical three tween timeline. The first tween brings the sprite on, the second pauses for a few seconds and does nothing, then the third sends the sprite off and restarts the timeline of the other sprite. This loops. The problem is that there is a varying visual gap between the the sprites as one tweens off and the next tweens on. You can paste this example code into a new empty flash movie and watch it: import com.greensock.*; import com.greensock.easing.*; // Just create 2 colored rect sprites the size of the stage and position them off the top of the stage var a1s = createShape(0x000077, stage.stageWidth, stage.stageHeight); var a2s = createShape(0x003300, stage.stageWidth, stage.stageHeight); var a1 = new Sprite(); a1.addChild(a1s); var a2 = new Sprite(); a2.addChild(a2s); a1.y = stage.stageHeight * -1; a2.y = stage.stageHeight * -1; addChild(a1); addChild(a2); // Now create two timelines to drop them down with a bounce in sequence with a 4 second pause between // the end of the pause phase for each restarts the timeline of the other var t1 = new TimelineLite({paused:true}); var t2 = new TimelineLite({paused:true}); t1.append(new TweenLite(a1,2,{ y:0, ease:Bounce.easeOut})); t1.append(new TweenLite(a1,4,{ })); t1.append(new TweenLite(a1,2,{onStart:function() { t2.currentProgress=0; },y:stage.stageHeight, ease:Bounce.easeOut})); t2.append(new TweenLite(a2,2,{ y:0, ease:Bounce.easeOut })); t2.append(new TweenLite(a2,4,{ })); t2.append(new TweenLite(a2,2,{onStart:function() { t1.currentProgress=0; },y:stage.stageHeight, ease:Bounce.easeOut})) t2.gotoAndPlay(t2.duration); t1.gotoAndPlay(0); function createShape( color: int, w: int, h: int ): Shape { var shape: Shape = new Shape(); shape.graphics.beginFill( color ); shape.graphics.drawRect( 0, 0, w, h ); shape.graphics.endFill(); return shape; }
×
×
  • Create New...