This week, my main goal was instead of using PathAnimation classes, make the required connections in the animation engine so that simulated animations are part of the animation engine, and make it possible to have more than one simulated shape in a slide. I did this by mostly cloning PathAnimation classes and doing some changes to the SlideImpl.
Here’s a video demonstarting the status of the project at the end of Week 3 (PathAnimation is overriden by SimulatedAnimation for the demo):
i use arch btw.
Box2DWorld was meant to be shared by the all simulated animations so it is now constructed in SlideImpl classes and passed down to the animations with maContext by reference.
Changed a little the way the world is constructed, first the current state of the slide is constructed by Box2DWorld class, creating all the shapes in the world as static bodies. Then when a simulated animation starts it changes the body that belongs to the animation’s shape to a dynamic one, and a static one when animation ends.
Since there were a lot of animations sharing the same Box2DWorld, old approach of having the simulated animations just step through the box2d simulation wouldn’t work (SimulatedAnimation class would just step the box2d world without having knowledge about other animations, meaning the animation would take place twice as fast for two parallel animations) , so I’ve added a flag to create a lock mechanism on whether an animation is the “stepper” for a given Box2DWorld or not. If an simulated animation is the “stepper” (holds the lock) only that animation is able to step through the box2d world.
Simulated animations become the stepper if there isn’t any other one at their call operator (which is called on every update). End stop being the at their end() function.
This makes it possible to have animations with different durations, going in parallel without any problems.
Starting Week 4 by researching how will I make these animations saveable through SMIL hierarchies, if you have any pointers, please contact me on irc or by e-mail!