Re: Mousedriven hover-animations in SVG/SMIL-animation

As far as I understand the problem, the intended behaviour
is possible for the first mouseover/mouseout (can be seen
better with larger dur values and an animation of fill instead
of opacity. But with the second mouseover, the first 
animation restarts and does not start with the value from
the previous turn of the same animation, which is only
possible, if the animation repeats, not if it is restarted.

The fun with interactivity and animation is, that the
priorities change with restarts, this gets interesting with 
the specific behaviour of to-animations.

If one assumes in a first simple approach, that there are no 
restarts until the mouseover animation is finished, one can 
avoid discontinuities using something like this (in most current
viewers):

   <rect width="100" height="100" fill="blue">
     <animate attributeName="fill" 
       begin="mouseover" dur="2.5s" to="green" fill="freeze" />
     <animate attributeName="fill" 
       begin="mouseout" dur="2.5s" to="blue" fill="freeze" />
   </rect>

or as a better approach:

  <rect width="100" height="100" fill="green" x="110">
     <animate attributeName="fill" dur="2.5s" to="red"
         begin="mouseover"  end="mouseout;indefinite" fill="freeze" />
     <animate attributeName="fill" dur="2.5s" to="green"
         begin="mouseout" end="mousover;indefinite" fill="freeze"/>
   </rect>


This/there is another trick with to-animations and a preliminary
end (using end, repeatDur, max etc), because it is
specified, that frozen to-animations freeze the final state of 
the animation, including contributions from underlying values:

'If a to-animation is frozen anywhere within the simple duration
(e.g., using a repeatCount of "2.5") , the value for F(t) when the 
animation is frozen is the value computed for the end of the 
active duration. Even if other, lower priority animations are 
active while a to-animation is frozen, the value for F(t) does not change.'
http://www.w3.org/TR/2001/REC-smil-animation-20010904/#FromToByAndAdditive

Obviously the correct appearance for the frozen effect depends on a 
correct implementation of to-animations (which is currently not
the case for Opera 8.x 9.0x, 9.1x, 9.2x, 9.50 alpha/beta, 
as we already know ... bug-185982 ;o)

Currently it is not effective to care much about to-animations for authors,
until they are implemented correctly ;o)

Received on Wednesday, 7 November 2007 14:54:11 UTC