You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-dev@xmlgraphics.apache.org by Cameron McCormack <ca...@mcc.id.au> on 2008/05/28 08:43:19 UTC

Re: svn commit: r656363 - /xmlgraphics/batik/trunk/sources/org/apache/batik/anim/timing/TimedE lement.java

Hi Dieter.

dvholten@apache.org:
> Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/anim/timing/TimedElement.java
> URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/anim/timing/TimedElement.java?rev=656363&r1=656362&r2=656363&view=diff
> ==============================================================================
> --- xmlgraphics/batik/trunk/sources/org/apache/batik/anim/timing/TimedElement.java (original)
> +++ xmlgraphics/batik/trunk/sources/org/apache/batik/anim/timing/TimedElement.java Wed May 14 12:05:10 2008
> @@ -799,11 +799,11 @@
>              boolean atLast;
>              if (isActive) {
>                  t = currentInterval.getBegin() + repeatDuration - lastRepeatTime;
> -                atLast = lastRepeatTime + d == currentInterval.getBegin() + repeatDuration;
> -            } else {
> -                // Interval previousInterval = (Interval) previousIntervals.getLast();
> -                t = previousInterval.getEnd() - lastRepeatTime;
> -                atLast = lastRepeatTime + d == previousInterval.getEnd();
> +                atLast = lastRepeatTime + d == currentInterval.getBegin() + repeatDuration;    // cam, given that d can
> +            } else {                                                                           // be infinite, nan or value
> +                // Interval previousInterval = (Interval) previousIntervals.getLast();         // does this always make sense?
> +                t = previousInterval.getEnd() - lastRepeatTime;                                // at least i would use >=
> +                atLast = lastRepeatTime + d == previousInterval.getEnd();                      // <- same here
>              }
>              if (atLast) {
>                  // Trace.print("element frozen" + (isActive ? " (but still active)" : "") + ", sampling last value");

I think in most normal uses of the animation at the moment (because we
don’t have time container and no media for which dur="media" would make
sense) that d will be only either a value or Infinity, but not NaN.

The behaviour of a frozen, indefinite animation should be the starting
value, e.g. with:

  <svg xmlns='http://www.w3.org/2000/svg' width='100' height='100'>
    <rect width='0' height='100'>
      <animate attributeName='width' from='50' to='100' dur='indefinite'
               begin='0s' end='1s' fill='freeze'/>
    </rect>
  </svg>

then the width should stay at 50.  atLast is set to false when d is
Infinity, so when the animation is actually sampled, the right behaviour
should fall out:

  sampledAt(t % d, d, currentRepeatIteration);

Since t will be 1.0 and currentRepeatIteration will be 0, it’ll call:

  sampledAt(1.0, Float.POSITIVE_INFINITY, 0);

which eventually in InterpolatingAnimation.sampledAt() will determine
that the unitTime is 0, thus using the starting value.

Do you agree?

-- 
Cameron McCormack ≝ http://mcc.id.au/

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-dev-help@xmlgraphics.apache.org