Re: [css3-animations] running animations before document load event

On Tuesday 2009-12-22 09:32 -0800, Simon Fraser wrote:
> On Dec 22, 2009, at 8:51 AM, L. David Baron wrote:
> 
> > http://dev.w3.org/csswg/css3-animations/#animation-behavior- says:
> >  # The start time of an animation is the latter of two moments: the
> >  # time at which the style is resolved that specifies the
> >  # animation, or the time the document's load event is fired.
> > 
> > This seems somewhat problematic to me, since pages often want to be
> > usefully interactive before the load event has fired.  (For example,
> > the load event could be delayed due to a slow-loading advertisement
> > image, or while waiting for the photo in the center of a flickr page
> > to load, etc.)
> > 
> > That said, I see the value in synchronizing animations that are
> > specified in the style present when the document loads, so this
> > behavior seems like it may be a reasonable default (although perhaps
> > DOMContentLoaded would be a better default).
> 
> WebKit originally delayed the start of all CSS animation until the page load
> event fired, to match the SVG implementation. More recently we changed
> it to run animations as soon as we create renderers for the elements
> being animated.

Updating the spec to say that sounds like a fine solution.  Then
people who want the synchronization can start their animations at an
appropriate time (e.g., DOMContentLoaded, onload, etc.).

> Does this need API? If the author wants animations to start as soon
> as possible, they just declare them in the style that will apply to
> the element as soon as it appears.

Agreed; that solution sounds better than adding an API.

-David

-- 
L. David Baron                                 http://dbaron.org/
Mozilla Corporation                       http://www.mozilla.com/

Received on Tuesday, 22 December 2009 17:37:19 UTC