# w3c/csswg-drafts

[css-values-4][css-transitions-1][web-animations-1] Define interpolat…

`…ion and animation of basic value types. r=birtles`
fantasai committed Sep 24, 2018
1 parent e67e18b commit e3b15849d0c2f0677cffaa0561f3660593ce4ea3
Showing with 221 additions and 0 deletions.
1. +221 −0 css-values-4/Overview.bs
 @@ -339,6 +339,101 @@ Property value examples

Combining Values: Interpolation, Addition, and Accumulation

Some procedures, for example transitions and animations, combine two CSS property values. The following combining operations-- on the two computed values Va and VB yielding the computed value Vresult-- are defined:
interpolation
Given two property values Va and VB, produces an intermediate value Vresult at a distance of p along the interval between Va and Va such that p = 0 produces Va and p = 1 produces Vend. The range of p is (−∞, ∞) due to the effect of timing functions. As a result, this procedure must also define extrapolation behavior for p outside [0, 1].
Given two property values Va and VB, returns the sum of the two properties, Vresult. For addition that is not commutative (for example, matrix multiplication) Va represents the first term of the operation and VB represents the second. Note: While addition can often be expressed in terms of the same weighted sum function used to define interpolation, this is not always the case. For example, interpolation of transform matrices involves decomposing and interpolating the matrix components whilst addition relies on matrix multiplication.
accumulation
Given two property values Va and VB, returns the result, Vresult, of combining the two operands such that VB is treated as a delta from Va. For accumulation that is not commutative (for example, accumulation of mismatched transform lists) Va represents the first term of the operation and VB represents the second.
Note: For many types of animation such as numbers or lengths, accumulation is defined to be identical to addition. A common case where the definitions differ is for list-based types where addition may be defined as appending to a list whilst accumulation may be defined as component-based addition. For example, the filter list values ''blur(2)'' and ''blur(3)'', when added together would produce ''blur(2) blur(3)'', but when accumulated would produce ''blur(5)''.
These operations are only defined on computed values. (As a result, it is not necessary to define, for example, how to add a <> value of ''15pt'' with ''5em'' since such values will be resolved to their canonical unit before being passed to any of the above procedures.) If a value type does not define a specific procedure for addition or is defined as not additive, its addition operation is simply Vresult = Va. If a value types does not define a specific procedure for accumulation, its accumulation operation is identical to addition.

Textual Data Types

@@ -687,6 +782,22 @@ Integers: the <> type The first digit of an integer may be immediately preceded by - or + to indicate the integer's sign.

Combination of <>

Interpolation of <> is defined as Vresult = round((1 - p) × Va + p × Vb); that is, interpolation happens in the real number space as for <>s, and the result is converted to an <> by rounding to the nearest integer, with values halfway between adjacent integers rounded towards positive infinity. Addition of <> is defined as Vresult = Va + Vb