To the extent possible under law, the editors have waived all copyright and related or neighboring rights to this work. In addition, as of 10 September 2014, the editors have made this specification available under the Open Web Foundation Agreement Version 1.0, which is available at http://www.openwebfoundation.org/legal/the-owf-1-0-agreements/owfa-1-0. Parts of this work may be from another specification document. If so, those parts are instead covered by the license of that specification document.
Motion paths allow authors to animate any graphical object along an author specified path.
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.
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.
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].
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.
Add more details and examples.
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:
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?
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?
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.
See the section “Motion processing” for how to process a motion position.
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:
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.
Note: The rotation described here does not override or replace any rotation defined by the transform property.
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.
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.
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.
More natural names requested for auto and reverse.
See the section “Motion processing” for how to process a motion rotation.
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.
Let position be the coordinate pair at the distance distance on path.
Let rotate be the computed value of motion-rotation due to path.
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 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:
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.
Name | Value | Initial | Applies to | Inh. | %ages | Media | Animatable | Computed value |
---|---|---|---|---|---|---|---|---|
motion-path | <basic-shape> | <path()> | <url> | none | none | All elements. In SVG, it applies to container elements excluding the defs element and all graphics elements | no | n/a | visual | no | as specified |
motion-position | <length> | <percentage> | 0 | All elements. In SVG, it applies to container elements excluding the defs element and all graphics elements | no | refer to the total path length | visual | yes | as specified |
motion-rotation | [ auto | reverse ] && <angle> | auto | All elements. In SVG, it applies to container elements excluding the defs element and all graphics elements | no | n/a | visual | yes | as specified |
motion | <motion-path> && <motion-position> && <motion-rotation> | see individual properties | All elements. In SVG, it applies to container elements excluding the defs element and all graphics elements | no | see individual properties | visual | see individual properties | see individual properties |