Posted by pepe
on March 2, 2008 at 9:45 PM PST
Splines project now has its first incarnation within swash and the example chosen is the perfect one.
In a previous blog , Tim Bourdreau asked for the difference between splines project and java.awt.GeneralPath. Here i show some of the main reasons why generalPath could not be used:
- Path can be changed anytime and displayers update themselves upon modification. No hassle.
- Modifications on paths are very simple to operate
- Having seperate splines for each ordinate makes it easy to change direction of the thrown gear. Using GeneralPath would have been a nightmare.
- Sections of the splines are independent on each ordinate.
- Velocity of the gear can easily be set and changed.
Demo consists of a gear that can be thrown to the wall when pressing a button. Gear bounces on bottom of the zone then on the wall and bounces back. Wall position can be changed anytime (even when animation is running, which can be funny on some cases when the gear bounces two times on wall :) ) and you will see splines being adapted in realtime.
There are two goals in this demo; show why splines project is done like that and show how to animate within swash.
Kudos go to the java2D and swing teams. While the animation runs at 50fps, there are no hiccups and cpu used is at 0%. Antialias is at max, and the gear rotates so it ought to take power from my old prescott and my even older ATI 9600.
WebStart the demo !
Check the project page for swash
Check the project page for splines