Re: Possible limitations with Trident's implementation

  • From: Kirill Grouchnikov <kirillcool@yahoo.com>
  • To: dev@trident.kenai.com
  • Subject: Re: Possible limitations with Trident's implementation
  • Date: Thu, 16 Jul 2009 09:43:20 -0700 (PDT)
  • Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:X-YMail-OSG:Received:X-Mailer:References:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type; b=TaXZP/UHFdQrGV+DNz9i290JodcPZ/hg40EiFQM5aVDoXGcqr2QlC3nsyGvseFeMspbNI3wODD/tjK/OtG9IF1gAm3Ewtp/n7zgrmvjaVoAjDQNxCLA71wO/Ed4WNt+ZrLuLcB/qkyja+dOp8bIRXqEcdd0TXwne3raL5jDs6+s=;

Hi Burt

Before getting into the full functionality of your StatefulTimeline and TimelineChain, i would say that the specific scenario is perhaps better addressed with key frames [1]?

Something like this:

KeyValues values = KeyValues.create(BACKGROUND, ANIM, BACKGROUND, ANIM,
    BACKGROUND, ANIM, BACKGROUND);
KeyTimes times = new KeyTimes(0.0f, 0.05f, 0.1f, 0.15f, 0.2f, 0.25f, 1.0f);
timeline.addPropertyToInterpolate("background", new KeyFrames(values, times));

It might become a little awkward for bigger loop count, but then you can create a helper method to initialize the KeyValues and KeyTimes accordingly.

From your implementation of the TimelineChain it does look like you are not satisfied with what timeline scenario [2] provides. It indeed can only play the added timelines forward - no skipping, no backward, no looping. Is this something that you would like to see added to the TimelineScenario?

Thanks
Kirill

[1] http://kenai.com/projects/trident/pages/KeyFrameOverview
[2] http://kenai.com/projects/trident/pages/TimelineScenarioIntroduction


From: Burt Alexander <burt.alexander@gmail.com>
To: dev@trident.kenai.com
Sent: Thursday, July 16, 2009 2:24:09 AM
Subject: Possible limitations with Trident's implementation

Hi Kirill, I'm moving this discussion to the dev mailing list as requested.  And as the title of this email suggests, the limitations may very well lie with my current understanding of Trident.

Out of the box, Trident didn't work (wrt its usage) as I expected it to work; as I mentioned I could not work out how to chain Timelines together in the manner I wished.  As I also mentioned I've come up with a solution for this (and based on our discussion & the thinking it triggered, I've improved upon it; pls look at the latest version of TimelineChain and my subclass of Timeline - StatefulTimeline - within my Java 5/Swing version of your 1.0 release, for the details).

The simplest use I make of TimelineChain is in my startup splash screen.  With the animation I wish to transition between two colours quickly for a couple of times, then return to the original colour much more slowly.  Here's how I accomplish this with TimelineChain:


    private void animateBackground() {
        chain = new TimelineChain(getContentPane());

        // Play from the original colour to another,
        // looping twice.
        chain.addTimeline(200, null, RepeatBehavior.REVERSE, 2);
        chain.addTransition("background", ANIM);

        // Play to the second colour as quickly
        chain.addTimeline(200);
        chain.addTransition("background", ANIM);

        // Slowly return to the original colour
        chain.addTimeline(2000);
        chain.addTransition("background", BACKGROUND);

        chain.play();
    }

TimelineChain only ever calls the 'play()' method on Timeline.  Using StatefulTimeline I am able to construct a Timeline object that determines which of its 'play' methods to invoke based upon its state, upon execution of its 'play()' method.

How would you recommend I accomplish the same functionality using just the Trident classes?

I'm unsure what you meant when you said "I'm not quite comfortable with exposing this functionality to the application".  StatefulTimeline does not expose anything which isn't already exposed, rather it provides the ability to define repeat behaviour, loop counts and skips prior to the invoking of 'play()' - which is how I'd expect to use it.

I am getting long in the tooth; perhaps I'm just set in my ways ;>)  Thank you for your time & thanks again for the library.


       Burton.



Possible limitations with Trident's implementation

Burt Alexander 07/16/2009

Re: Possible limitations with Trident's implementation

Kirill Grouchnikov 07/16/2009

Re: Possible limitations with Trident's implementation

Burt Alexander 07/17/2009
  • Mysql
  • Glassfish
  • Jruby
  • Rails
  • Nblogo
Terms of Use; Privacy Policy;
© 2010, Oracle Corporation and/or its affiliates
(revision 20120127.ac94057)
 
 
Close
loading
Please Confirm
Close