Jump to content
Search Community

How to make "random" Tweens?

cerulean test
Moderator Tag

Recommended Posts

I'm making a first-person view game in which I'm driving, say, a car.  I'd like to simulate hitting a bump, and my inclination is to tween the Z and X rotations of the scene, but I'd like to do it in that crazy, random    way when you hit a bump — that is a lot to the left, say, back to the right, then a bit to the left, hard to the right, finally settling down and down back to center.

 

Is there a good way to do this using TweenMax and its associated eases and libraries?  I could build something by hand, generating all sorts of random dampened tweens at onCompletes, but wonder if there's a simpler way to do this.  I have 'shockingly green' membership (through my client) —

 

Also, this relates to my earlier post — most of these tweens would need a nice Quad on the way out, a bounce on the way back.  How to change ease for yoyo'd tweens?

 

Thanks!

Link to comment
Share on other sites

You have 2 ways

 

1: create a RoughEase:

Notice the eratic shake

http://www.snorkl.tv/2010/10/use-tweenlites-easevisualizer-to-create-a-roughease-for-a-cool-flicker-effect/ The same concept could be applied to x/y

 

2: create a function that returns a TimelineLite()

 

 

 

function crash(mc):TimelineLite {
var tl:TimelineLite = new TimelineLite();
tl.to(mc, someRandomDuration, {x:someRandomValue})
.to(mc, someRandomDuration, {x:someRandomValue})
.to(mc, someRandomDuration, {x:someRandomValue})
.to(mc, someRandomDuration, {x:someRandomValue})
.to(mc, someRandomDuration, {x:someRandomValue})

return tl

}

//crash the car
crash(car_mc)
 

If you took some care in creating those random values within certain bounds, you could certainly achieve a realistic effect

 

Similar to your previous post, yes the physics libraries could make it look more realistic.

instead of using random values in each tween you could progressively decrees the velocity or increase the friction. 

 

Lots of possibilities.

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...