
Here is the script with GraphicsBuilder 0.4.5
The interesting bits happen from line 18 through 37, the code resembles the JavaFX a lot until you define the animation and the mouse trigger. Though both examples have the same behavior there is a slight difference on how the animations are defined and triggered. JavaFX uses the dur keyword along with the linear parameter to define an animation on an attribute (red) which happens to be bound. GraphicsBuilder on the other hand defines the animation once per cell using the
animate()
but has the problem of exposing the internals of animations in order to trigger said animations. In GraphicsBuilder, animations are defined by a set of bindings, if the animation does not start by default the bindings are not bound per se. You'll have to check if the animation is bound the first time and call bind()
to trigger it, then call start, stop, pause
constructs that should take care of the internals workings and bound state for you.This example shows that JavaFX has a more compact way of defining quick animations, and now that dur will be taking a step back to give way to keyframe and timeline based animations GraphicsBuilder will have to step up.
Another minor inconvenience that starts to bother me is having to register each of GraphicsBuilder's extensions (even though the script code is autogenerated by graphicsPad), GraphicsRenderer already takes care of that for you, I guess there should be a shortcut for GraphicsBuilder too. Rest assured that the next version will solve these problems.
Keep on Groovying!