Re: Moving TimelineEngineThread into Toolkit specific code

  • From: Kirill Grouchnikov <kirillcool@yahoo.com>
  • To: dev@trident.kenai.com
  • Subject: Re: Moving TimelineEngineThread into Toolkit specific code
  • Date: Wed, 22 Jul 2009 20:56:21 -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=mUeL4LEiw4DmiPa2kt/ON2gKAqBYCzmHfVOJztTZkb7ZwSy+B6gfxhyfSEzyRqesPsJAgjd/HKYU7by08SY3hcD8vaJA1c2aUTxF1t2/IvWuEKuULbapZYO4ngrs5M7plh3LsJkGMTJ03CFW+c1azttpePX+8cuPX2W0+xEe25E=;

The first drop of 1.1dev (in SVN / downloads) allows providing a custom pulse source with TridentConfig.getInstance().setPulseSource() API.

Here is an example of setting a custom pulse source that fires updates every 100 milliseconds:

public class CustomPulseSource {
    private float value;

    public void setValue(float newValue) {
        SimpleDateFormat sdf = new SimpleDateFormat("mm:SSS");
        System.out.println(sdf.format(new Date()) + " : " + this.value + " -> "
                + newValue);
        this.value = newValue;
    }

    public static void main(String[] args) {
        TridentConfig.getInstance().setPulseSource(
                new TridentConfig.PulseSource() {
                    @Override
                    public void waitUntilNextPulse() {
                        try {
                            Thread.sleep(100);
                        } catch (InterruptedException ie) {
                            ie.printStackTrace();
                        }
                    }
                });
        CustomPulseSource helloWorld = new CustomPulseSource();
        Timeline timeline = new Timeline(helloWorld);
        timeline.addPropertyToInterpolate("value", 0.0f, 1.0f);
        timeline.play();

        try {
            Thread.sleep(3000);
        } catch (Exception exc) {
        }
    }
}

Let me know if this addresses your scenario.

Thanks
Kirill


From: Paul Byrne <Paul.Byrne@Sun.COM>
To: dev@trident.kenai.com
Sent: Tuesday, June 23, 2009 8:52:27 AM
Subject: Moving TimelineEngineThread into Toolkit specific code


Hi Kirill,

One thing we do in Wonderland which is a little different from other UI toolkits is to control the systems framerate explicitly. This helps with responsiveness on slower system and preserves resources on higher powered systems. As a result it's more efficient to trigger animation updates on a frame cycle rather than a timer (or timed sleep).  On principal how would you feel moving the TimelineEngineThread into the toolkit specific code ?

I'm just bouncing around ideas at the moment, not formally requesting a change :-)

Rgds

Paul



Re: Moving TimelineEngineThread into Toolkit specific code

Kirill Grouchnikov 07/23/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