First take on TridentBuilder - No Fluff Just Stuff

First take on TridentBuilder

Posted by: Andres Almiray on February 22, 2009

If you're into desktop Java chances are you are aware that Kirill Grouchnikov recently announced that he is working on an animation library named Trident. Though there is no official release yet I decided to give it a try during the weekend, adding a bit of Groovy sugar into the mix, resulting in TridentBuilder. The following video is a remake of Trident's first demo (based on a Flex demo made by Chet Haase)



As you can observe not only does the rendering panel draw a shape when the mouse is pressed but also when it is being dragged (btw those shapes are stars, available from jSilhouette). The code looks like your basic builder stuff, I won't bore you with the details of the actual rendering (regular Java2D stuff). First the ShapePanel plus the timeline that updates the background gradient (from white to light gray and back, indefinitely)
Now the tricky part of creating a new shape based on the mouse event coordinates and triggering another timeline to animate its opacity and rotation
Notice how the callback is defined in this case, as you may know Groovy does not support defining anonymous inner classes (yet) but closures plus the builder pattern can take care of that (more so builders based on FactoryBuilderSupport). Trident's API is very simple at the moment yet powerful. I'm thrilled to know that Kirill is behind it as he pays close attention to detail and quality.

Keep on Groovying!
Andres Almiray

About Andres Almiray

Andres is a Java/Groovy developer and a Java Champion with more than 20 years of experience in software design and development. He has been involved in web and desktop application development since the early days of Java. Andres is a true believer in open source and has participated on popular projects like Groovy, Griffon, and DbUnit, as well as starting his own projects (Json-lib, EZMorph, GraphicsBuilder, JideBuilder). Founding member of the Griffon framework and Hackergarten community event. https://ch.linkedin.com/in/aalmiray

Why Attend the NFJS Tour?

  • » Cutting-Edge Technologies
  • » Agile Practices
  • » Peer Exchange

Current Topics:

  • Languages on the JVM: Scala, Groovy, Clojure
  • Enterprise Java
  • Core Java, Java 8
  • Agility
  • Testing: Geb, Spock, Easyb
  • REST
  • NoSQL: MongoDB, Cassandra
  • Hadoop
  • Spring 4
  • Cloud
  • Automation Tools: Gradle, Git, Jenkins, Sonar
  • HTML5, CSS3, AngularJS, jQuery, Usability
  • Mobile Apps - iPhone and Android
  • More...
Learn More »