W3C home > Mailing lists > Public > www-style@w3.org > February 2010

Re: [transitions/animations] stepped timing function proposal

From: Simon Fraser <smfr@me.com>
Date: Tue, 23 Feb 2010 14:14:51 -0800
Cc: "www-style@w3.org list" <www-style@w3.org>
Message-id: <3F6DB34B-D7AF-4FE7-823B-BEC9730BD7C6@me.com>
To: Dean Jackson <dino@grorg.org>
On Jan 19, 2010, at 2:50 PM, Dean Jackson wrote:

> I propose a new value for the "animation-timing-function" property, allowing a value to jump instantly from one keyframe to another, rather than be interpolated.
> 
> A good example of why this is useful is the progress spinner on OSX which could be implemented as an infinite rotation. Also, this feature is in SMIL/SVG [1] as calcMode="discrete". However, I think we should consider going one step beyond what SMIL suggested and allow the step to happen either at the beginning or end of the keyframe.
> 
> jump-start
>  There is no interpolation. The property instantly changes to the end value as soon as the animation begins.
> 
> jump-end
>  There is no interpolation. The property remains at its start value until the animation ends, at which point it instantly changes to the end value.

I prefer:

step-start, step-end;

I'd also like to extend this proposal to allow the author to specify that the change occurs in a number of discrete, equal steps, rather than just one. This would be achieve by allowing a two new functional values in the transition-timing-function property:

step-start(<number>), step-end(<number>)

step-start(1) is equivalent to step-start, and step-end(1) is equivalent to step-end. The functional version does not need to have the same name; suggestions are welcome.

To explain further, step-start(N) causes the value to change in a series of N steps of equal size. The first step occurs the instant that the transition starts (which is after the delay, if transition-delay is non-zero). The next N-1 steps occur at regular time intervals over the duration of the transition. The property reaches its final value D/N seconds before the end of the transition period, where D is the duration.

step-end(N) causes the value to change in a series of N steps of equal size. The first step occurs D/N seconds into the transition, where D is the duration, and the remaining steps occur at regular intervals over the remainder of the duration. Thus, the last step occurs at the end of the transition period.

Both step-start and step-end exist so that an author can create symmetrical transitions, for example when entering and leaving a :hover state.

A good use case for step-wise timing functions is in recreating the Mac OS X spinning progress indicator:
<http://www.codeproject.com/KB/progress/AsyncProgressControl/CircularControl.JPG>
This is a circular image that has 12 tick marks. When animating, it doesn't rotate smoothly, but jumps around in 24 steps. There is no way to recreate that effect with CSS transitions or keyframe animations (without unwieldy keyrame hacks) unless we have step-wise timing functions.

David Baron previously suggested that we support transition-delay to non-animatable properties:
<http://lists.w3.org/Archives/Public/www-style/2009Nov/0328.html>

Non-animatable properties could also be affected by transitions if the timing function is one of the single-step variants, which would give the author control over when the change happens in relation to other properties that may be transitioning.

Simon
Received on Tuesday, 23 February 2010 22:15:45 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:24 GMT