Jump to content

Codepen Notification

You didn't provide a codepen sample that illustrates the problem. It really helps us quickly identify problems. This isn't mandatory, but it will get you better/faster results. Would you like to add one?

how to change a tween without breaking the animation?

Started by hemmoleg, Nov 12 2014 09:43 AM - - - - -

4 replies to this topic
hemmoleg

Post #1 by hemmoleg , 12 November 2014 - 09:43 AM

hey,

 

in essence my problem is as follows: i have an movieclip and a button, if you click the button the mc moves 100px to the left. what i want is: i want to be able to click the button again while the mc is already moving, so the mc would end up 200px to the left. so i think i somwhow need to update the tween on the mc with a differen target position. i konw i could just replace the already running tween but then the animation would look bad since i am using easing for the movement.

how can i update the tween with a new tartget position without screwing the animmation?


  • Back to top

Carl
  • Carl
  • 5,626 Likes (Superhero)
  • 7,859 posts

Post #2 by Carl , 12 November 2014 - 02:51 PM

Hi and welcome to the GreenSock forums,

 

It sounds like TweenMax.updateTo() will suit your purposes.

 

If you need to update your tween constantly check out the DynamicPropsPlugin example: http://greensock.com/tweenmax-as 

DynamicPropsPlugin is a bonus plugin for Club GreenSock members: http://greensock.com/club/


  • Back to top

hemmoleg

Post #3 by hemmoleg , 12 November 2014 - 04:02 PM

thx for the answer. unfortunately it doesnt work as i would like it to. the thing is, for easing i use Quad.easeInOut so when i call updateTo() the mc moves to the right coordinates but the easing (accelerating and decelerating) starts all over again and this is exactly what i meant by "breaking the animation". so what happens is: i click the button, mc starts to accelerate, i click the button again, mc stops and starts to accelerate again. Is there a way to have a smooth transition there?


  • Back to top

knalle

Post #4 by knalle , 22 January 2017 - 06:31 PM

seeking the same as hemmoleg asked quite a few years ago :)

 

I'm also changing direction (zoom in/out) and the

updateTo does not solve - guess we seek a more physical behavior with deacceleration+acceleration when changing midtween.


  • Back to top

Carl
  • Carl
  • 5,626 Likes (Superhero)
  • 7,859 posts

Post #5 by Carl , 29 January 2017 - 02:17 AM

It sounds like you are looking for additive animation, which will allow you to blend 2 animations in opposing directions together.

Play with this demo here: http://codepen.io/osublake/pen/PPmJpL/

 

Very informative post here with some interesting ideas and demos: https://greensock.co...tive-animation/

 

The good news: decent chance this will be possible in the JS version of GSAP

Bad news: we have no intention of doing anything with the ActionScript tools. The codebase hasn't been touched in a few years as demand is so low. 


  • Back to top




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

3rd Party Advertisement