Well, thanks to the guys on the GoASAP list, I’ve started coming up with an API that most of us are used to seeing/using with packages like Tweener and Fuse. The change is that you literally create the propertyChanges array for Tween3D in the arguments to pass to the constructor. No parsing has to be done in the constructor at all – just set the propertyChanges array to what’s passed in the constructor.
So, what used to look like this:
[as]
var tween:Tween3D = new Tween3D(target, 1, Equations.easeOutCubic, .5);
tween.x = 0;
tween.y = 50;
tween.rotationZ = 0;
tween.start();
[/as]
Now looks like this:
[as]
tween = new Tween3D(target, [Go3D.x(0), Go3D.y(50), Go3D.rotationZ(0)], 1, Equations.easeOutCubic, .5);
tween.start();
}[/as]
you can still create a Tween3D object and set the properties outside of the constructor if you want to of course.
The coolest part is that this abstracts the property objects. You can create 1 or multiple property classes that return property objects. So, in this sample, Go3D is a “properties class” that has static methods called x, y, z, rotationX, rotationY, rotationZ and they all return a Go3DProperty object that Tween3D uses. Now imagine that all of this is strongly typed, it’s fast and in a large scale development environment with many devs you could lock down what properties are tweenable as well as other logic and rules around doing this type of work. It’s complete abstracted out from the tweening/sequencing itself.
I’ve updated the rolodex files as well as put the new source out:
Same demo, new code
The new createTween method now looks like this:
[as]
protected function createTween():void
{
sequence = new SequenceCA();
sequence.addEventListener(GoEvent.COMPLETE, handleSequenceComplete, false, 0, true);
tween_0 = new Tween3D(target, [Go3D.x(0), Go3D.y(50), Go3D.rotationZ(0)], 1, Equations.easeOutCubic);
sequence.addStep(tween_0);
sequence.lastStep.advance = new OnDurationComplete(.2); // advance early/overlap
tween_0b = new Tween3D(target, [Go3D.z(200)], 1, Equations.easeOutCubic);
sequence.addStep(tween_0b, true); // 2nd param groups it with previous step. param is “addToLastStep”
tween_1 = new Tween3D(target, [Go3D.x(-10), Go3D.y(85), Go3D.rotationZ(15)], 1, Equations.easeOutCubic);
sequence.addStep(tween_1);
sequence.lastStep.advance = new OnDurationComplete(.25); // advance early/overlap
tween_2 = new Tween3D(target, [Go3D.rotationX(0), Go3D.rotationY(0)], 1, Equations.easeOutBounce);
sequence.addStep(tween_2);
}
[/as]



May 14, 2008 at 1:48 am
[...] Simple Papervision Tweening (Although I know John Grden is working on a kickass Go3D system) [...]
October 2, 2008 at 2:53 am
now you just need to tween the drop shadow to look like the card is falling onto the table
December 16, 2009 at 3:21 pm
[...] GoASAP / Fuse http://www.mosessupposes.com/ http://www.mosessupposes.com/Fuse/ http://rockonflash.wordpress.com/2008/05/07/update-on-go3d-api-much-more-simple/ http://go.mosessupposes.com/?p=32 Tweening engine http://code.google.com/p/actuate/ Unity 3D – [...]