Saturday, May 05, 2007

Tweening in papervision

I have been messing with Papervision ( it is awesome ) but to my disappointment, there is no tween engine(which is understandable). Papervision is all about getting your 3d models into flash and creating your 3d world. This is huge and they need lots of praise but now that you have all these 3d things in here we need to do something with them. Most people are just doing enterframes with math equations to have things move around. This is perfect for games and things that always need to be moving but I'm more inclined to impress and then pause everything to let it soak in. To do this we need a tween class. In AS2 by far my favorite is Fuse but the AS3 version is not ready yet, so people have been using Tweener with Papervision. I have to say it has some really nice features and is written quite well. The coolest thing is bezier tweens (basicly curve to a new position). This is huge in a 3d word, giving you the ability to do things like fly throughs.

camera.x = -1200;
camera.y = 1500;
camera.z = -1650;

// Target moves on the path first
camera.target.x = -1200;
camera.target.y = 1500;
camera.target.z = -1650;
Tweener.addTween(camera.target, {x:200, y:350, z:325,
_bezier:[{x:1725, y:75, z:950}, {x:-161, y:305, z:674}],
time:10, transition:"linear"});

// Animate camera position
Tweener.addTween(camera, {x:200, y:350, z:325,
_bezier:[{x:1725, y:75, z:950}, {x:-161, y:305, z:674}],
time:10, delay:0.5, transition:"linear"});

Pretty cool. I'm trying to put some demos together to show at the flash meeting but I'll post something when I have it. Also to note I like how Tweener deals with events and special properties, it is very flexible.

Labels: , ,

1 Comments:

Blogger valeeum said...

This is a great post! Did you ever get any demo files put together demonstrating tweening with papervision? I would love to see an example of this in action.

11:47 AM  

Post a Comment

Subscribe to Post Comments [Atom]

<< Home