Jump to content
Search Community

Tweaking the bounce ease

eerdepeer test
Moderator Tag

Recommended Posts

I really need some help here. Tried to figure this out myself, but I can't. :(

 

I've successfully created a nice little tween with this code: TweenLite.from(sm.origin, 1, {x:500, ease:Bounce.easeOut, delay:1});

The problem is that the bounce ease is too wide. The mc comes from x:500 and goes to x:-50 (for about) and then stops at x:0.

I'd like this ease to relax a bit, but still bounce in the end. The speed and the origin distance need to stay these values.

 

I tried to tweak the bounce by adding some figures: TweenLite.from(sm.origin, 1, {x:500, ease:Bounce.easeOut(2, 2, 2, 2), delay:1});

But this doesn't help. The ease becomes linear. (I also don't have any idea what these figures mean)

 

Hope someone else does...

Link to comment
Share on other sites

Wow, thanks for fixing that so quickly! This custom ease isn't what I'm looking for actually, the tweening method is too soft/round.

 

Is there maybe another way to let my mc's bounce with less amplitude With the bounce ease, my mc's move bounce too far over the x-axys at the ending of the tween. It's a tougher job to get this done than I thought. :roll:

Link to comment
Share on other sites

Yeah, CustomEase isn't really meant for sharp turns like that. You could either create your own version of the Bounce ease and tweak the equations (if you're not good at math, this may be unrealistic) or just break your bounce down into several separate tweens, one for each curve on the bounce. In fact, I'd probably use a bezier tween and simply adjust the y values and durations (assuming you're doing a tween on the y property). Dump 'em into a TimelineLite so you can easily sequence them and then control it as a whole, like:

mc.y = 0;
var bounce:TimelineLite = new TimelineLite();
bounce.append( new TweenMax(mc, 0.5, {y:300, ease:Quad.easeIn}) );
bounce.append( new TweenMax(mc, 0.7, {bezier:[{y:100},{y:300}], ease:Linear.easeNone}) );
bounce.append( new TweenMax(mc, 0.5, {bezier:[{y:200},{y:300}], ease:Linear.easeNone}) );
bounce.append( new TweenMax(mc, 0.3, {bezier:[{y:260},{y:300}], ease:Linear.easeNone}) );

Link to comment
Share on other sites

  • 1 month later...
  • 2 years later...

here is how the source will look if you want the object to bounce just once:

 

package com.greensock.easing {
public class Bounce {
 public static function easeOut (t:Number, b:Number, c:Number, d:Number):Number {
  if ((t/=d) < (1/2.75)) {
   return c*(7.5625*t*t) + b;
  } else if (t < (2/2.75)) {
   return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
  } else
  return c;
 }
 public static function easeIn (t:Number, b:Number, c:Number, d:Number):Number {
  return c - easeOut(d-t, 0, c, d) + b;
 }
 public static function easeInOut (t:Number, b:Number, c:Number, d:Number):Number {
  if (t < d*0.5) return easeIn (t*2, 0, c, d) * .5 + b;
  else return easeOut (t*2-d, 0, c, d) * .5 + c*.5 + b;
 }
}
}

 

the only problem is that such ease will run some time at the end of the tween without modifying the props.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...