Motion Path Module Level 1

Unofficial Proposal Draft, 10 September 2014

This version:
http://dirkschulze.github.io/specs/motion-1/
Editor:
(Adobe Systems Inc.)

Abstract

Motion paths allow authors to animate any graphical object along an author specified path.

Table of Contents

This document is obsolete. This specification is not being actively maintained, and must not be used as a guide for implementations. It must be considered obsolete. For the replacement spec, please see http://dev.w3.org/fxtf/motion-1/.

1 Introduction

This section is not normative.

Authors have possibilities to position objects like elements, boxes or containers relative to each other or absolutely in their own coordinate system. CSS Transforms extend these possibilities with a set of transform functions allowing authors to mutate the object’s local coordinate system. With CSS Animations and CSS Transitions, these static placements can change over a given period of time. Both kind of animations are powerful to express transitions in time but not suitable to describe transitions of location of an object over time.

This specification allows authors to specify an motion path. The object can be transitioned along this motion path over a given period of time. The time may be static if no animation was specified.

In the following example, a schematic of an air plane is animated along a motion path. The plane faces in the direction of the motion path at each position on the path.

Example Motion Path

A black plane at different positions on a blue dotted motion path, rotated in the direction of the path.

A motion path may consist of a <basic-shape> like <circle()>, <inset()> or <polygon()>. To allow authors to specify curves and sub-paths, this specification adds the <path()> function in addition to the existing <basic-shape> functions. The <path()> function takes an SVG Path string as input [SVG11]. As a third option, authors can reference an SVG graphics element by <url> which is used as motion path.

2 Module interactions

This specification defines a set of CSS properties that affect the visual rendering of elements to which those properties are applied. These effects are applied after elements have been sized and positioned according to the Visual formatting model from [CSS21]. Some values of these properties result in the creation of a stacking context.

Some CSS properties in this specification manipulate the user coordinate system of the element by transformations. These transformations are pre-multiplied to transformations specified by the transform property or deriving properties.

The term object bounding box follows the definition in SVG 1.1 [SVG11].

3 Values

This specification follows the CSS property definition conventions from [CSS21]. Basic shapes are defined in CSS Shapes Module Level 1 [CSS-SHAPES]. Value types not defined in these specifications are defined in CSS Values and Units Module Level 3 [CSS3VAL]. Basic shapes are extended by the <path()> basic shape function.

In addition to the property-specific values listed in their definitions, all properties defined in this specification also accept CSS-wide keywords such as inherit as their property value [CSS3VAL]. For readability it has not been repeated explicitly.

4 Motion Paths

Add more details and examples.

4.1 Motion path: The motion-path property

Name:motion-path
Value:<basic-shape> | <path()> | <url> | none
Initial:none
Applies to:All elements. In SVG, it applies to container elements excluding the defs element and all graphics elements
Inherited:no
Media:visual
Computed value:as specified
Percentages:n/a
Animatable:no

Specifies the motion path the element gets positioned at. The exact element’s position on the motion path is determined by the motion-position property. A motion path is either a specified path with one or multiple sub-paths or the geometry of a not styled basic shape. Each shape or path must define an initial position and an initial direction.

In this specification a direction (or rotation) of 0 degree is equivalent to the direction of the positive x-axis, so 0 degree points to the right side.

Values have the following meanings:

<basic-shape>
The motion path is a basic shape as specified in CSS Shapes [CSS-SHAPES]. The initial position and the initial direction for basic shapes are defined as follows:
<circle()>
<ellipse()>
The initial position is defined by the point where a virtual tangent to the circle/ellipse would reach the top vertical position. The initial direction is 0 degree.
<inset()>
The initial position is defined by the left top corner of the rectangle. The initial direction is 0 degree.
<polygon()>
The initial position is defined by the first coordinate pair of the polygon. The initial direction is defined by the vector connecting the initial position with the next following coordinate pair that isn’t equal to the initial position. If there is no such unequal coordinate pair, the initial direction is defined with 0 degree.
path() = path(<string>)

The <string> represents an SVG Path data string. The path data string must be conform to the grammar and parsing rules of SVG 1.1 [SVG11]. The initial position is defined by the first “move to” argument in the path string. For the initial direction follow SVG 1.1 [SVG11].

There have been requests to support <length> and <percentage> units for coordinates as well. Should we support them?

<url>
References an SVG graphics element and uses it’s geometry as motion path. See SVG 1.1 for more information about the initial position and initial direction [SVG11].
none
No motion path gets created.

A computed value of other than none results in the creation of a stacking context [CSS21] the same way that CSS opacity [CSS3COLOR] does for values other than 1, unless the element is an SVG element with out an associated CSS layout box.

A reference that fails to download, is not a reference to an SVG graphics element element, or is non-existent is ignored. No motion path and no stacking context is created.

See the section “Motion processing” for how to process a motion path.

Which coordinate system do we use for elements with associated layout box? The canvas boundaries? The viewport boundaries? An element reference box? Do we need to allow keywords to specify this box?

4.2 Position on motion path: The motion-position property

Name:motion-position
Value:<length> | <percentage>
Initial:0
Applies to:All elements. In SVG, it applies to container elements excluding the defs element and all graphics elements
Inherited:no
Media:visual
Computed value:as specified
Percentages:refer to the total path length
Animatable:yes

A distance that describes the position along the specified motion path.

Should the property be renamed to motion-distance instead? After all, the author defines a distance and not a point, even though the result will be an element positioned at the distance on the motion path.

<percentage>
<length>
The distance from the initial position of the shape or path to the position of the element. Percentages are relative to the total path length including all sub-paths.
What happens if the position is negative or exceeds the motion path length?

See the section “Motion processing” for how to process a motion position.

4.3 Rotation at point: The motion-rotation property

Name:motion-rotation
Value:[ auto | reverse ] && <angle>
Initial:auto
Applies to:All elements. In SVG, it applies to container elements excluding the defs element and all graphics elements
Inherited:no
Media:visual
Computed value:as specified
Percentages:n/a
Animatable:yes

Defines the direction of the element while positioning along the motion path.

Values have the following meanings:

auto
Indicates that the object is rotated (over time if motion-position is animated) by the angle of the direction (i.e., directional tangent vector) of the motion path. If specified in combination with <angle>, the computed value of <angle> is added to the computed value of auto.
reverse

Indicates that the object is rotated (over time if motion-position is animated) by the angle of the direction (i.e., directional tangent vector) of the motion path plus 180 degrees. If specified in combination with <angle>, the computed value of <angle> is added to the computed value of reverse.

This is the same as specifying auto 180deg.

<angle>
Indicates that the element has a constant rotation transformation applied to it by the specified rotation angle. See definitions of auto or reverse if specified in combination with either one of the keywords. For the purpose of this argument, 0deg points to the right side in the direction of the positive x-axis, and positive angles represent clockwise rotation, so 90deg point toward the bottom.

Note: The rotation described here does not override or replace any rotation defined by the transform property.

The following three examples use the shape of a plane. The red dot in the middle of the shape indicates the origin of the shape.
Shape with its origin

A red dot in the middle of a plane shape indicates the shape’s origin.

In the first example, the motion-rotation property is set to auto. The shape’s point of origin is placed at different positions along the motion path. The shape is rotated based on the gradient at the current position and faces the direction of the motion path at this position.

Motion Path with auto rotation

A black plane at different positions on a blue dotted motion path, rotated in the direction of the path.

In this example, the motion-rotation property is set to reverse. The plane faces the opposite direction of the motion path at each position on the motion path.

Motion Path with reverse auto rotation

A black plane at different positions on a blue dotted motion path, rotated in the opposite direction of the path.

The last example sets the motion-rotation property to -45deg. The shape is rotated by -45 degree once and keeps the rotation at each position on the motion path.

Motion Path with fixed rotation

A black plane at different positions on a blue dotted path, rotated by a fixed amount of degree.

More natural names requested for auto and reverse.

See the section “Motion processing” for how to process a motion rotation.

4.4 Motion shorthand: The motion property

Name:motion
Value:<motion-path> && <motion-position> && <motion-rotation>
Initial:see individual properties
Applies to:All elements. In SVG, it applies to container elements excluding the defs element and all graphics elements
Inherited:no
Media:visual
Computed value:see individual properties
Percentages:see individual properties
Animatable:see individual properties

This is a shorthand property for setting motion-path, motion-position and motion-rotation. Omitted values are set to their initial values.

4.5 Motion processing

If motion-path specifies a valid basic shape, path or references a valid SVG graphics element:
  1. Let path be the geometry of the specified basic shape, path or SVG graphics element reference.
  2. Let totalLength be the total length of path with all sub-paths.
  3. Let distance be the compute value of motion-position:
    If distance is < 0:
    Set distance to 0.
    If distance is > totalLength:
    Set distance to totalLength.
  4. Let position be the coordinate pair at the distance distance on path.

    Do we need to say how to get the position in more detail?

  5. Create the supplemental transformation matrix transform to the local coordinate system of the element.
  6. Translate transform by position.
  7. Let rotate be the computed value of motion-rotation due to path.

    This should be far more explicit.

  8. Post-multiply the rotation rotate to transform.
  9. Post-multiply transform to the local coordinate system of the element.
Otherwise:
Do nothing.

Do we need to specify an origin of the element in motion so that it can be positioned accordingly before the motion? Something like motion-origin? Should we reuse transform-origin? (Probably not since the z coordinate doesn’t make any sense.)

Conformance

Conformance requirements are expressed with a combination of descriptive assertions and RFC 2119 terminology. The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in the normative parts of this document are to be interpreted as described in RFC 2119. However, for readability, these words do not appear in all uppercase letters in this specification.

All of the text of this specification is normative except sections explicitly marked as non-normative, examples, and notes. [RFC2119]

Examples in this specification are introduced with the words “for example” or are set apart from the normative text with class="example", like this:

This is an example of an informative example.

Informative notes begin with the word “Note” and are set apart from the normative text with class="note", like this:

Note, this is an informative note.

References

Normative References

[CSS-SHAPES]
Vincent Hardy; Rossen Atanassov; Alan Stearns. CSS Shapes Module Level 1. 20 June 2013. W3C Working Draft. URL: http://www.w3.org/TR/2013/WD-css-shapes-1-20130620/
[CSS21]
Bert Bos; et al. Cascading Style Sheets Level 2 Revision 1 (CSS 2.1) Specification. 7 June 2011. W3C Recommendation. URL: http://www.w3.org/TR/2011/REC-CSS2-20110607
[CSS3VAL]
Håkon Wium Lie; Tab Atkins; Elika J. Etemad. CSS Values and Units Module Level 3. 30 July 2013. W3C Candidate Recommendation. (Work in progress.) URL: http://www.w3.org/TR/2013/CR-css3-values-20130730/
[RFC2119]
S. Bradner. Key words for use in RFCs to Indicate Requirement Levels. URL: http://www.ietf.org/rfc/rfc2119.txt
[SVG11]
Erik Dahlström; et al. Scalable Vector Graphics (SVG) 1.1 (Second Edition). 16 August 2011. W3C Recommendation. URL: http://www.w3.org/TR/2011/REC-SVG11-20110816/

Informative References

[CSS3COLOR]
Tantek Çelik; Chris Lilley; L. David Baron. CSS Color Module Level 3. 7 June 2011. W3C Recommendation. URL: http://www.w3.org/TR/2011/REC-css3-color-20110607

Index

Property index

NameValueInitialApplies toInh.%agesMediaAnimatableComputed value
motion-path<basic-shape> | <path()> | <url> | nonenoneAll elements. In SVG, it applies to container elements excluding the defs element and all graphics elementsnon/avisualnoas specified
motion-position<length> | <percentage>0All elements. In SVG, it applies to container elements excluding the defs element and all graphics elementsnorefer to the total path lengthvisualyesas specified
motion-rotation[ auto | reverse ] && <angle>autoAll elements. In SVG, it applies to container elements excluding the defs element and all graphics elementsnon/avisualyesas specified
motion<motion-path> && <motion-position> && <motion-rotation>see individual propertiesAll elements. In SVG, it applies to container elements excluding the defs element and all graphics elementsnosee individual propertiesvisualsee individual propertiessee individual properties

Issues Index

Add more details and examples.
There have been requests to support <length> and <percentage> units for coordinates as well. Should we support them?
Which coordinate system do we use for elements with associated layout box? The canvas boundaries? The viewport boundaries? An element reference box? Do we need to allow keywords to specify this box?
Should the property be renamed to motion-distance instead? After all, the author defines a distance and not a point, even though the result will be an element positioned at the distance on the motion path.
What happens if the position is negative or exceeds the motion path length?
More natural names requested for auto and reverse.
Do we need to say how to get the position in more detail?
This should be far more explicit.
Do we need to specify an origin of the element in motion so that it can be positioned accordingly before the motion? Something like motion-origin? Should we reuse transform-origin? (Probably not since the z coordinate doesn’t make any sense.)