Search the Community
Showing results for tags 'pause'.
-
I'm trying to build a web banner using TweenNano but one of the requirements is that the ad has to stop animating after 30secs. I've been trying to implement the code, but I keep getting errors and I'm not a seasoned enough flash developer to know what the deal is: import com.greensock.*; import com.greensock.easing.*; import flash.events.MouseEvent; import flash.net.URLRequest; var animateTxt = function begin():void { TweenNano.to(seeOthers, 1.5, {alpha:1, delay: 0, ease:Quad.easeInOut}); TweenNano.to(seeOthers, 1.5, {alpha:0, delay:3, ease:Quad.easeInOut}); TweenNano.to(shouldBe, 1.5, {alpha:1, delay:4.5, ease:Quad.easeInOut}); TweenNano.to(shouldBe, 1.5, {alpha:0, delay:7.5, ease:Quad.easeInOut, onComplete:begin}); } animateTxt(); var timer:Timer = new Timer(30000, 1); timer.addEventListener( TimerEvent.TIMER, function(evt:TimerEvent):void { trace('timer launched'); animateTxt.pause(); } ); startBtn.addEventListener(MouseEvent.CLICK, onStart); function onStart(e:MouseEvent):void { animateTxt.play(); } timer.start(); stop(); Any help would be GREATLY appreciated
-
I'm having a bit of trouble getting a set of chained timelines to pause as they complete. I want to have timelines to control a couple of objects on screen and then pause until the user hits the forward button to advance but I can't seem to get the pause to kick in. It just keeps running through both timelines. I'm guessing I'm using the wrong approach. Would love some help on this. $('.trigger-forward').click(function() { scene.play(); }); $('.trigger-backward').click(function() { scene.reverse(); }); var moment_1 = new TimelineMax({pause:true}); var moment_2 = new TimelineMax({pause:true}); moment_1.to("#scene_earth_move .earth", 2, {scale: 1.4}, 0) .to("#scene_earth_move h1", 1, {top: "40%"}, 0); moment_1.to("#scene_earth_move .earth", 2, {scale: 2}, 0) .to("#scene_earth_move h1", 1, {top: "80%"}, 0); var scene = new TimelineMax({paused:true}); scene.add(moment_1) .addPause() .add(moment_2); Thank you
-
Hi all, I've searched and searched to no avail for help with my problem. I need to be able to pause some animations while others continue to play. And then resume them again when needed. And this needs to be done with TweenMax (I cannot use TimelineMax). And AS2. Ideally, there would be an easy way to create a function that I pass the movieclip location & whether or not it should be paused. Something sort of like this? public function pauseMC (MC:MovieClip, State:Boolean):Void{ if (State){ MC.pause (); }else{ MC.resume (); } } Thanks for any help! -Zach
-
Hi I'm building an infinite horizontal image slider that slides when the user hovers over a 'next' or 'previous' buttons. The design requires the animation to gradually pause/resume with a subtle easing and not pause immediately. the only solution I found was to use an infinitely repeating tween for the slider, and attach a second tween to the buttons that tweens the 'timeScale' of the original tween with an easing. Is there a simpler native way to do so without creating a second tween? Thanks
-
I have a situation where a slideshow is dissolving between images. I am using TimelineMax and allowing the slideshow to loop endlessly. I need to give the user the ability to pause and restart the slideshow... easy enough using pause(). However I would like to make sure that if an image has already started tweening (dissolving into the next image), that the tween doesn't pause part way through... resulting in two semi-transparent images on top of each other. Is there a way to pause the timeline but allow any existing tweens to complete first?
-
Hi there, I'm having issues trying to add pauses and next/prev buttons to control the animation. I added pauses in the Timeline using addPause(), and addCallback to change the value of next label but i'm confused and it doesn't work... Here's my simplified code: var nextLabel:String=""; var tl:TimelineMax= new TimelineMax(); tl.addLabel("step1"); tl.addCallback(setNext,"step1",["step2"]) tl.append( new TweenMax(my_MC,2,{alpha:1})); tl.append( new TweenMax(my_MC,1,{x:200})); tl.addPause(); tl.addLabel("step2") tl.addCallback(setNext,"step2",["step3"]) tl.append( new TweenMax(my_MC,2,{alpha:.5})); tl.append( new TweenMax(my_MC,1,{x:400})); tl.addPause(); tl.addLabel("step3") tl.append( new TweenMax(my_MC,2,{alpha:1})); tl.append( new TweenMax(my_MC,1,{y:200})); function setNext(t):void{ nextLabel=t; } my_NextButton.addEventListener(MouseEvent.CLICK,goToStep) function goToStep(e:MouseEvent):void{ tl.play(nextLabel) } I think i'm not doing things in the correct order. Any advices ? Thanks !
-
Hi Guys! I hope this post finds you well. I am writting because i am using timelinemax in order to create an animation that has 3 stops in between in which the user has the ability to either continue to the next point or go back. All my tweens are working well, and now is time to add the pauses. I thought about just adding them to the onComplete and calling it a day. Yet when reversing they were not firing... This made me find out about onReverseComplete which worked like a charm expect that when going backwards the onComplete was firing as well pausing my animation before it could even get started. After a second click on the back button, the animation started playing backwards correctly. Bceause of this effect, i decided to try adding a callback but to my surprise i ran into the same problem. Then i went to the docs and found information about the addPause function. Including this piece of text: "Remember, the virtual playhead moves to a new position on each tick (frame) of the core timing mechanism, so it is possible, for example for it to be at 0.99 and then the next render happens at 1.01, so if your callback was at exactly 1 second, the playhead would (in this example) move slightly past where you wanted to pause. Then, if you reverse(), it would run into that callback again and get paused almost immediately. However, if you use the addPause() method, it will calibrate things so that when the callback is hit, it'll move the playhead back to EXACTLY where it should be. Thus, if you reverse() it won't run into the same callback again." This is what is happening to me currently and thought this was the right fix. The problem now is that when i add the pauses this way: this.timeline.add( TweenMax.to(this.map.mapPoint,0.5,{frame:this.map.mapPoint.totalFrames, ease:Linear.easeNone}) ); this.timeline.add( TweenMax.from(this.map.line1,1,{scaleX:0, ease:Quint.easeInOut})); // this.timeline.add( TweenMax.to(this.map,1,{x:2286,y:-157, ease:Quint.easeInOut}) ); this.timeline.addPause() // this.timeline.add( TweenMax.to(this.map,15,{x:-57,y:778, ease:SlowMo.ease.config(0.9,0.3)}) ); The animations pauses correctly, but if i try to use resume() or play(). The animation doesnt move at all. Only works at this point if i call reverse() Any ideas what might be happening? thanks a ton alex
-
Hi - In a banner I'm working on, I have a secondary timeline which controls an object sliding up and down on my screen. The secondary timeline works properly, but I'd also like to be able to pause the main timeline when the secondary object slides up on the screen, and then resume playback of the main timeline once my object slides out of view. Here's my current code: <script> var tl = new TimelineLite(); tl.add( TweenLite.to("#studyDescription", 1, {top:20})); tl.to("bgMask", .5, {autoAlpha:1}); tl.pause(); var button = document.getElementById("openButton"); button.onclick = slideStudyUp; if (button.captureEvents) button.captureEvents(Event.CLICK); function slideStudyUp(){ tl.play(); } var closeButton = document.getElementById("closeButton"); closeButton.onclick = slideStudyDown; if (closeButton.captureEvents) closeButton.captureEvents(Event.CLICK); function slideStudyDown(){ tl.reverse(); } </script> I'm pretty sure that I just need to add something like "main timeline.pause()" to my slideStudyUp function, and "main timeline.play()" to my slideStudyDown function - but what's the correct way to reference the main timeline? Thanks!
-
I'm loading a large number of resources of all types with a single LoaderMax instance. Several times during loading I call pause() and then resume() a second or so later. At first it worked, but as my resource list changed, I started having failures. There were no errors reported, I just never received a complete on the load. I found a single swf file with some audio inside that I was loading, which when removed from the load, fixed the problem. The swf is fine, and if I simply remove the pause() and resume() calls, I can load the swf without issue. One thing I noticed is that I get a report of Flash decompressing the swf file twice. I have verified that it is only loaded once, and with pause() and resume() removed, it only decompresses once. [sWF] C:\_projects\game\bin-debug\assets\swfs\Soundtrack.swf - 1,502,520 bytes after decompression [sWF] C:\_projects\game\bin-debug\assets\swfs\Soundtrack.swf - 1,502,520 bytes after decompression Is it possible that pause() and resume() are interacting with the Flash Player's swf decompression somehow? Resuming before it's fully paused or something? Any ideas what's going on here? Thanks! Craig
-
Hi all, I have a timeline controlling several tweens. I can pause and resume it with no problem. However when I call the addPause(X) method, X being a number, I can't resume or play the timeline anymore after that. Thanks for your help
-
Hi, I am trying to create a timeline that contains an ending pause of x seconds: now I can add a delay between tweens, a delay before a specific tween, but... how do I set a delay before onComplete is triggered? I could add a dummy tween at the end of the timeline, with a delay, but it look ugly to me. Am I missing the specific trick? Thanks
-
Hi everyone, I am using TweenLite.ticker.addEventListener("tick", updateGameState); to update the state of my game. The updateGameState function is called as it should be but when I leave the game screen and remove the listener using TweenLite.ticker.removeEventListener("tick", updateGameState); the ticker continues to tick and the time / frames continue to count. When I re-register my updateGameState function to the ticker then the current time is not zero. I would like to stop or pause the ticker while I leave / enter the game screen, in order to keep track of the game state. Is there a way to do this? Or am I to the wrong path?
-
I'm trying to use exportRoot(); in an iOS app. If the app is in the background for a length of time, the timeline can no longer resume. Is it possible that the timeline is lost in garbage collection? My pause screen is still visible and the buttons are still available. But nothing resumes. If you leave and come back quickly it's fine. Anything I can try to make it hold the timeline for as long as the app is in the background? --- EDIT ---- Sorry, looks like I was calling the exportRoot twice and that was the source of my trouble.
- 1 reply
-
- ios
- garbage collection
-
(and 2 more)
Tagged with:
-
Hello.. in the DOC's there is the addPause() method which Carl brought to my attention after reading Carl's answer on this post.. http://forums.greensock.com/topic/8472-right-way-to-put-pause-marker-inside-timeline/?view=findpost&p=33079 it got me thinking to see if there will be some type of mixture of addPause() with a delay / duration.. kind of like a addPauseDelay() method coming in the future? so say in the middle of my timeline, i want to pause the timeline for say 5 seconds and then continue... right now im adding a to() method with an empty {} properties object like this to add a pause with a duration: tl.add( TweenMax($("#element"), 5, {}) ); in the future are we gonna see any time of pause with a delay / duration? thx
-
I came across a peculiar problem with Greensock today whilst playing with a 'pause' function for a game. The purpose of the two following functions are: When the pause button (in this case it's a sprite named it 'menu') is pressed it causes all existing TweenMax instances to pause in place. It also sets the stage's framerate to 0, making all display objects pause in place. I've been told this is the best method pausing the game. When the button is pressed again, it should resume all the tweens from where they were initially paused. However, the problem is these tweens jump to their finishing position regardless of when they were paused, so when I resume the game the tween finishes abruptly. The strange thing is, if the framerate isn't changed (resumes at 30, for example), the Tweens resume from where they originally paused. Am I just being stupid and missing something obvious? AS3: protected function pauseGame(event:MouseEvent):void { menu.removeEventListener(MouseEvent.CLICK, pauseGame); menu.addEventListener(MouseEvent.CLICK, resumeGame); TweenMax.pauseAll(true, true); stage.frameRate = 0; } protected function resumeGame(event:MouseEvent):void { menu.removeEventListener(MouseEvent.CLICK, resumeGame); menu.addEventListener(MouseEvent.CLICK, pauseGame); TweenMax.resumeAll(true, true); stage.frameRate = 30; }
-
Hi, I'm creating an animation on the stage (a base class) made up of subclasses which return a TimelineLite for their animations. The problem seems to be that creating a timelineLite auto-plays the timeline that was created, rather than just being available for the parent timeline. Its a wierd one, because it creates wierd movement only apparent for the first 5-10s (period of an individual animation). Is there a better way to create a timeline or tween object and pass it up the chain for use later? This is pretty much the code I use now: Thanks, (I'm loving greensock library) Don have a great day
-
i was trying to figure out, if possible, how to chain an instance of multiple tweens. For example: var tween1 = TweenMax.to('#image1', 3, {css:{scale:1.5}, ease:Linear.easeNone}); var tween2 = TweenMax.to('#slide1', 3, {css:{opacity:1}, ease:Linear.easeNone}); The above works.. but couldn't i just chain them, like below? var tween1 = TweenMax.to('#image1', 3, {css:{scale:1.5}, ease:Linear.easeNone}) .to('#slide1', 3, {css:{opacity:1}, ease:Linear.easeNone}); But when i try this, the browser throws an error: TypeError: TweenMax.to(...).to is not a function The reason i'm asking is because if i have to pause the animation i have to basically use the below: $('#slider').on("mouseenter",function(){ tween1.pause(); tween2.pause(); }).on("mouseleave",function(){ tween1.resume(); tween2.resume(); }); I have to declare pause and resume twice. If i had multiple tweens in one instance, i could declare pause() and resume() only once. How do i create an instance (reference variable) for multiple tweens? Thanks ahead of time for any help!
-
I want to slide each element in my div one after the other having some pause after each item slides. Below is my code attached. $(function () { $('.tick').each(function () { var $self = $(this); var t1 = new TimelineLite(); t1.to($self, .5, { x: 100, ease: Cubic.easeInOut }); t1.pause(); t1.resume(); }); what it does is: It slides all the items at a time. Why isn't it pausing after each item slides... What is the issue in the code? Thanks & Regards, Bunnie
-
Hello, I have a timeline, which is supposed to pause at certain points. From there I either want to go forward or backwards one step to the next pause-point by clicking on buttons. So in my timeline I put tl.call(pauseTL) at this points and the function pauseTL doesn't do anything else than tl.pause(). The problem now is, if I change direction of playback at this points I have to click twice in order for this to work. So if I click the backbutton while timeline is paused and I have been going forward before it only works when I click for the second time. Any ideas? Thank you for your help.
-
Hi, I've previously used pauseAll and resumeAll when entering a pause state of a game to halt animation. With the GSAP JS pauseAll works fine, but resumeAll doesn't resume any of the animations that we're paused, I notice the docs suggest both methods are deprecated. Are there any other suggested solutions short of manually resuming all tweens individually? Thanks Rob
-
I'm pausing timelines with pause() and resuming them with resume(). However, is as if the timeline is dragged out when it resumes, and labels no longer line up with the tweens contained in the timeline. I've traced most of the properties, and the only ones that seem to be different are duration and totalDuration which are increased by the amount of time spent while the timeline was paused. The startTime does not change. Is this behavior normal? How can I make it so that my tweens and timelines are the right length and the labels line up after pausing and resuming? At the same time, I'm also calling TweenMax.pauseAll() and TweenMax.resumeAll(), could this be affecting the timelines(I did not give them any parent)? I'm using AS3 version 1.64 of the Tweening Platform v11. Thanks for any help.
-
Hello, I might be a right n00b here but why can't I get this to work, and am I going the right way about this? When I take out the itemAnim.pause(); it works fine. Long and short of it I'm I'm making a basic game where I've got about 14 items that I want going off at different times and each item have hoverover features and other on click commands etc. Here is the code stripped down... var itemArray:Array=new Array(item1,item2); for (var i:int = 0; i < itemArray.length; i++) { itemArray[i].addEventListener(MouseEvent.CLICK, addClick); } var item1Anim:TimelineLite = new TimelineLite(); item1Anim.insertMultiple([new TweenLite(item1, 5, {y:"800", ease:Linear.easeNone})], 0, TweenAlign.START); var item2Anim:TimelineLite = new TimelineLite(); item2Anim.insertMultiple([new TweenLite(item2, 5, {y:"800", ease:Linear.easeNone})], 2, TweenAlign.START); function addClick(event:MouseEvent):void { var lastclicked = event.target.name; var itemAnim = lastclicked + "Anim"; trace (itemAnim); itemAnim.pause(); //this is the bugger that throws out the code... } Thanks for any help Kind regards Gary test.fla.zip
-
Hi I am working on an AS3 slideshow developed with TweenLite10 I need to be able to pause/resume the slideshow Is there an example/tutorial explaining how to add TweenMax10 pause() / resume() functionality to a project? Thanks
- 5 replies
-
- TweenLite10
- TweenMax10
-
(and 5 more)
Tagged with: