With the release 1.1 of Trident animation library available a couple of weeks ago, it’s time to start the development of version 1.2 (code-named Cookie Jar). The first 1.2dev drop has a few minor API enhancements, as well as a small new demo. This demo is based on the Flash mouse star trailer, and is slightly reminiscent of the Glitzer applet from Paul Schmidinger. Here is a video showing “Star Dust” in action:

The code is quite straightforward (see the test.swing.StarDust class). It has a looping timeline that spawns new stars. At every pulse this timeline checks the current location of the mouse. If the mouse is inside the panel, it creates a new Star object, as well as a matching Timeline object. The paintComponent() method of the panel iterates over all “live” stars and paints them based on their current position, size, rotation, alpha and color.

Here is the relevant code for the spawner timeline:

Timeline spawner = new Timeline();
spawner.addCallback(new UIThreadTimelineCallbackAdapter() {
   private float currHue = 0.0f;

   @Override
   public void onTimelinePulse(float durationFraction,
         float timelinePosition) {
      Point mouseLoc = MouseInfo.getPointerInfo().getLocation();
      SwingUtilities.convertPointFromScreen(mouseLoc, mainPanel);
      double currX = mouseLoc.getX();
      double currY = mouseLoc.getY();
      if ((currX < 0) || (currY < 0) || (currX > mainPanel.getWidth())
            || (currY > mainPanel.getHeight()))
         return;

      double outerStartSpan = 5;
      double outerFinalSpan = 20;
      Star star = new Star(currX, currY, outerStartSpan);

Here, we use the MouseInfo class to get the mouse location, and then create a Star object centered at that point. Then, we create a timeline to animate the star location, size, rotation and alpha:

Timeline starTimeline = new Timeline(star);
double angle = Math.random() * 2.0 * Math.PI;
double distance = 20.0 + 30.0 * Math.random();
starTimeline.addPropertyToInterpolate("x", currX, currX
	+ distance * Math.cos(angle));
starTimeline.addPropertyToInterpolate("y", currY, currY
	+ distance * Math.sin(angle));
starTimeline.addPropertyToInterpolate("alpha", 1.0f, 0.0f);
starTimeline.addPropertyToInterpolate("rotation", 0.0f,
	(float) (2 * Math.PI * Math.random()));
starTimeline.addPropertyToInterpolate("outerSpan",
	outerStartSpan, outerFinalSpan);
starTimeline.addPropertyToInterpolate("color", Color.white,
	new Color(Color.HSBtoRGB(currHue, 0.8f, 0.7f)));
currHue += 0.01f;

When the timeline for the specific star is created, it is simply played for 3 seconds. The main spawning timeline is looped indefinitely:

      starTimeline.setDuration(3000);
      starTimeline.play();
   }
});
spawner.playLoop(RepeatBehavior.LOOP);

If you have Java 6 or later on your machine, click on the button below to launch the WebStart demo of “Star Dust”:

Substance 6.0 roadmap

October 13th, 2009

Today I want to share my plans for the next major release of Substance look-and-feel library. I’ve started the development of version 6.0 (code-named Sonoma) about a week ago, and it’s time to talk about the major changes that are coming in this release.

  • Removal of deprecated methods / classes. All APIs detailed at the end of release notes for version 5.3 have been removed from the latest 6.0dev drop. If your application is using one or more of these APIs, consult the release notes to see what you should use instead.
  • Restructuring the code base. Due to lack of proper modularity in Java, some of the internal utility classes have been incorrectly viewed as published APIs by applications. Version 6.0 will have two major packages – substance.api and substance.internal. The application code can only use the api package, and the bundled test applications have been corrected to follow this guideline. For most applications this will require simple re-organization of import sections.
  • Renaming the main package. In a few days the main package will be renamed from org.jvnet.substance to org.pushingpixels.substance. For most applications this will require simple re-organization of import sections.
  • Moving animations to use Trident library. The internal animation engine from the Laf-Widget library will be replaced by the Trident animation library.

Smaller changes planned for Substance 6.0:

  • Polishing of existing skins and a few new skins
  • Support for custom decoration areas – pending performance evaluation
  • Improving performance of tables
  • Further support for High DPI mode

Applications using Substance will be mostly affected by package renaming and usage of Trident.

If your code is setting Substance via a fully-qualified class name, you will need to replace “org.jvnet.substance.skin…” with “org.pushingpixels.substance.api.skin…“. Otherwise you will just need to reorganize your imports section.

Switching to use Trident will require applications to add the matching trident.jar to the classpath (in addition to substance.jar). If you are running Substance-powered application in a signed WebStart environment, you will need to sign the Trident jar with the same key.

The latest 6.0dev drop of Substance contains some of the changes described above. The deprecated APIs have been removed, the packages are now organized in api / internal – but not yet under org.pushingpixels.substance, and custom animations in the test application are powered by Trident.

If you have any questions, comments, suggestions or objections, please open a discussion on the project forums or mailing lists.

Trident 1.1 official release

October 12th, 2009

I am thrilled today to announce the availability of the final release for version 1.1 of Trident animation library (code-named Bogeyman). Most of the new functionality in this version was driven by the user feedback, and includes the following:

In addition to the bundled sample applications, Trident has two blueprint projects. These projects show how to use Trident to drive complex animation scenarios in Internet-enabled rich applications that show graphic information on music albums. Project Onyx is the Swing implementation (see detailed walkthroughs), and Project Granite is the SWT implementation (see detailed walkthroughs).

New Onyx screens

If you have Java 7 installed on your machine, click the button below to launch the WebStart version of Project Onyx:

You are more than welcome to take Trident 1.1 for a ride and report any problems in the project mailing lists, forums or issue tracker.

While Trident requires Java 6 for both the compile and runtime, Emmanuel Bourg has shared his tips on what is required to compile and run version 1.1 of the library under Java 5 and Java 1.4 – complete with a patch for the relevant classes and the build script. While these tips are relevant for the current state of the codebase, Trident core may at any point switch to using Java 6 specific APIs if they are found to be beneficial to the development of the library.

Finally, release 1.1 has one known issue that was found a few hours before the final release was built. As the fix may potentially affect the stability of the library, i have decided to postpone it to the next release. The issue is with running looping timelines on Swing components. If a window hosting such a component is disposed, Trident will continue running the timeline. If the timeline results in updating visual properties of this component (directly or indirectly), the main AWT thread will never shut down – as described in the AWT threading documentation – and the VM will never quit. There are two workaround for this issue in version 1.1:

  • Use EXIT_ON_CLOSE mode instead of DISPOSE_ON_CLOSE
  • Override the Component.removeNotify of the relevant component and cancel / abort the timeline

I am excited today to announce the availability of the release candidate for version 1.1 of Trident animation library (code-named Bogeyman). Most of the new functionality in this version was driven by the user feedback, and includes the following:

In addition to the bundled simple applications, Trident has two blueprint projects. These projects show how to use Trident to drive complex animation scenarios in Internet-enabled rich applications that show graphic information on music albums. Project Onyx is the Swing implementation (see detailed walkthroughs), and Project Granite is the SWT implementation (see detailed walkthroughs).

New Onyx screens

If you have Java 7 installed on your machine, click the button below to launch the WebStart version of Project Onyx:

You are more than welcome to take Trident 1.1RC for a ride and report any problems in the project mailing lists, forums or issue tracker. The final release is scheduled for October 12. Only bugs will be fixed until that date.