Share Posted June 23, 2010 Hi I have the following camera.z = -800 cameraZoomTween = new TweenMax(camera, 10, {z: (5000, ease: Linear.easeNone}); cameraZoomTween.pause(); on mouse move the TweenMax plays or reverses based on direction. switch (getVerticalDirection()) { case "up": if (!mouseOverInPlane) { TweenLite.to(cameraZoomTween, 1, {timeScale: 1, onStart: cameraZoomTween.play}); } else { TweenLite.to(cameraZoomTween, 0.2, {timeScale: 0.01, onComplete: cameraZoomTween.pause}); } break; case "down": if (!mouseOverInPlane) { //cameraZoomTween.reverse(true); TweenLite.to(cameraZoomTween, 1, {timeScale: 1, onStart: cameraZoomTween.reverse}); } else { TweenLite.to(cameraZoomTween, 0.2, {timeScale: 0.01, onComplete: cameraZoomTween.pause}); } break; case "none": TweenLite.to(cameraZoomTween, 2, {timeScale: 0.01, onComplete: cameraZoomTween.pause}); break; } This works great. However I also have buttons that take the camera out of that Tween position. My problem lies now that when I go back to the mouse movement the camera sort of jumps immediately to the previous position (from where the tween was interrupted), and what Id like if possible is sort of update that tween closer to the current position. So basically lets say, my tweening is playing and camera is at z: 1000, and a click a button to to send the camera at position 5000. When I resume the tween it goes back to position 1000 when instead I'd like it to resume from position 5000. I hope it makes sense, I have really tried my best without bothering you guys but I am pulling my hair on this one. Thanks Fernando Link to comment Share on other sites More sharing options...
Share Posted June 23, 2010 Why not just create a new tween that incorporates the new position? I'm not sure I understand the problem/objective, but there's also an updateTo() method that you may find useful as well as dynamicProps plugin (Club GreenSock members only). Link to comment Share on other sites More sharing options...
Author Share Posted June 23, 2010 Hi I have the dynamic props plugin, will take a look into it now. However to explain myself better... I have this tween cameraZoomTween = new TweenMax(camera, 10, {z: 5000, ease: Linear.easeNone}); on mouse move up the screen, I do cameraZoomTween.play() and mouse move down the screen cameraZoomTween.reverse() This works well but then I click in my nav to take the camera to a particular position animating also x, y and zoom. TweenMax.to(camera, 0.5, {zoom: selectedZoom, focus: selectedFocus, x: 300, y: 500, z: 1000, ease: Quint.easeOut}); Then it just jumps suddenly... I tried cameraZoomTween.updateTo({zoom: selectedZoom, focus: selectedFocus, x: 300, y: 500, z: 1000}) And it jumps to in addition too this I just don't know how to go back to the original tween. Because every time I click in a nav button it takes me to a whole different position. So basically i need to maintain original tween updated in mouse position and then when I clicked in a button it takes me out of that tween into a new one, then when I go back (or close that item) it should resume where it left off. Why not just create a new tween that incorporates the new position? So what does it mean, do I create a new Tween like this cameraZoomUpdate = new TweenMax (camera, 1, {zoom: selectedZoom, focus: selectedFocus, x: 300, y: 500, z: 1000}) and if so can I switch back and forth between the cameraZoomTween and cameraZoomUpdate? Thanks for helping me out on this I almost got it working but this is the last bit that is missing. Link to comment Share on other sites More sharing options...
Share Posted June 23, 2010 Not sure this is the effect you're after, but you could just record the camera's position when you do your menu tween (let's say z is 1500), pause it and then do your new tween as normal. Let's say it goes to 5000. Then when you're done, you could tween back to that original value (1500 or whatever) and when that tween is complete, resume() the original. Link to comment Share on other sites More sharing options...
Author Share Posted June 24, 2010 Jack you are the man! I would name my next son Jack but I already have one called Jake... Thanks! Fernando. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now