Hi Thomas.

I'd like your thoughts on how I will implement animation ticking.
Currently (per the code currently in branches/anim), I have modified the
RunnableQueue so that it has a Runnable that will be called when the
queue is idle, thus avoiding some problems with unnecessarily flooding
the queue with Runnables.  (I may change this a bit eventually, though,
so that busy waiting isn't done when no animations are active.)  I came
across a problem, though, where it seemed like the AWT event dispatcher
thread was being starved of CPU, resulting in the canvas not being
updated in a timely fashion sometimes.  I've found that modifying the
runnable to sleep the UpdateQueue thread for a tiny amount of time let
the AWT thread get some time to update the canvas
(see o.a.b.bridge.SVGAnimationEngine.AnimationTickRunnable).

With this example document:

  <svg xmlns="http://www.w3.org/2000/svg";
       xmlns:xlink="http://www.w3.org/1999/xlink";
       version="1.1" width="400" height="400">
    <line x1="200" y1="0" x2="200" y2="400" stroke="red" stroke-width="150"/>
    <line id="Line1" x1="200" y1="0" x2="200" y2="400" stroke="black" 
stroke-width="50">
      <animate attributeName="stroke-width" begin="0s" dur="5s"
               from="0" to="100" additive="sum"/>
    </line>
    <line id="Line2" x1="0" y1="200" x2="400" y2="200" stroke="orange" 
stroke-width="0">
      <set attributeName="stroke-width" begin="5s" to="10"/>
    </line>
  </svg>

if the

  Thread.sleep(1);

line is removed, then at t = 10s, just as the 'animate' element finishes
and the 'set' element begins, the display is not updated to revert
Line1's width back to 50 and to show Line2 until a number of seconds
afterwards.  With the sleep line in, the update happens properly.

So my question: is this thread sleeping an inappropriate way to get
around the problem, and if so, any idea what a proper solution would be?

Thanks,

Cameron

-- 
 Cameron McCormack                      ICQ: 26955922
 cam (at) mcc.id.au                     MSN: cam (at) mcc.id.au
 http://mcc.id.au/                      JBR: heycam (at) jabber.org

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to