SVG Animation Profile 1: Keyframes and Easing
A deterministic SVG animate subset with value lists, explicit key times, and cubic Bézier easing.
SVG Animation Profile 1: Keyframes and Easing
Status: Accepted source profile.
SVG Animation Profile 1 extends SVG Animation Profile 0 with ordered keyframe values, authored key times, and cubic Bézier easing. It is a cumulative profile: every source accepted by Profile 0 is accepted by Profile 1 and must produce the same sampled values, including the same binary32 bits.
All Profile 0 rules remain normative unless this document replaces them. In
particular, Profile 1 inherits its Base and Sample policies, retained-source
contract, targets and properties, exact nanosecond timeline, repeat and fill
behavior, replacement-only composition, whole-document failure, diagnostics,
and trust boundary. This document replaces only Profile 0's animation
attribute vocabulary and its Values and interpolation section. Where
Profile 0 says from, to, or frozen to, Profile 1 generalizes those terms
to the first or final effective keyframe.
The vocabulary and broad behavior follow the SVG animation value attributes, which in turn use the SMIL animation-function model. Profile 1 deliberately narrows that model where this document says so.
SVG Animation Profile 2 is the cumulative extension for several ordered replacement effects on one target/property pair.
Scope of the extension
Profile 1 adds values, keyTimes, and keySplines to Profile 0's admitted
<animate> attributes. calcMode may be absent, linear, or spline.
The complete value forms are:
| Authored form | Profile 1 meaning |
|---|---|
values="v" | one constant keyframe |
values="v0;v1;..." | an ordered keyframe sequence |
from="v0" to="v1" | the two-keyframe sequence v0;v1 |
any values plus from or to | values selects the form; from and to are ignored |
Presence of the values attribute selects the values form before its contents
are parsed. Consequently, an empty or malformed values attribute fails
Profile 1 and never falls back to otherwise valid from and to attributes.
Conversely, ignored from and to attributes do not have to be valid target
values. This is SVG's precedence rule, not a conflict-repair rule: the
values definition
states that from, to, and by are ignored when a values list is used.
When values is absent, both from and to remain required exactly as in
Profile 0. by is outside Profile 1 even when SVG would ignore it beside
values; a lone to and a lone from are outside as well.
discrete and paced calculation, addition, accumulation, and every other
animation family deferred by Profile 0 remain deferred. In particular,
Profile 1 does not broaden the target element or property set.
Keyframe values
values is a semicolon-separated list. XML whitespace around each value and
separator is ignored. One final semicolon, optionally followed by whitespace,
is ignored; an empty interior item or more than one empty trailing item is an
error. This follows SVG's values-list parsing.
The validity of a one-item list is independently exercised by the
single-value web-platform-test.
Each item is parsed once under Profile 0's target-specific value and binary32
rules. Every item must be finite and valid for the animated property: sizes
remain non-negative and opacity remains in [0, 1]. The parsed bit pattern is
the keyframe value. Parsing or interpolating another item cannot change it.
A list has either one item or at least two:
- A one-item list is a constant animation. It is admitted only with absent or
linearcalcModeand withoutkeyTimesorkeySplines. The exact stored value contributes throughout every active interval and is the frozen value. This is a deliberate Profile 1 restriction: a constant has no interval to time or ease. - A list with at least two items supplies one value for every key time. The first value applies at simple progress zero and the final value is the terminal frozen value.
Key times
For N >= 2 keyframes, omitted keyTimes defines the exact offsets
t[i] = i / (N - 1), for i = 0 ... N - 1.Thus both linear and spline modes divide the simple duration into N - 1
equal intervals when no key times are authored, matching the SMIL calculation
mode rules.
An explicit keyTimes value is a semicolon-separated list of SVG numbers.
Whitespace around items and separators and one final semicolon are accepted;
the trailing-semicolon behavior has dedicated web-platform-test
coverage.
Each token is interpreted as its exact base-ten rational value, not first
rounded through binary floating point.
For N >= 2, an explicit list must satisfy all of these rules:
- it contains exactly
Noffsets; - every offset is in
[0, 1]; - the first offset is exactly
0and the last is exactly1; and - each offset is strictly greater than its predecessor.
SVG permits equal neighboring offsets by requiring only a non-decreasing list. Profile 1 deliberately requires strict increase. This removes zero-duration segments and gives every accepted simple progress one unambiguous interval while retaining SVG behavior for the admitted domain.
Let simple progress be the exact rational p. For 0 <= p < 1, interval
selection chooses the unique i satisfying
t[i] <= p < t[i + 1].If p equals t[i], the sampled result is the exact stored bits of keyframe
i; interpolation is not evaluated. At an internal repeat boundary, Profile
0's timing rule starts the next iteration at p = 0, so the first keyframe is
selected. At final active end, remove contributes nothing and freeze
contributes the exact final keyframe bits.
Linear interpolation
Absent calcMode means linear. Within the selected interval, segment-local
progress is the exact rational
q = (p - t[i]) / (t[i + 1] - t[i]).For neighboring stored binary32 values a and b, the sampled value is the
exact mathematical result
a + (b - a) × qrounded once to IEEE 754 binary32 using round-to-nearest, ties-to-even. No intermediate binary floating-point rounding participates. Exact key times use the stored keyframe bits directly, including signed-zero bits.
SVG says keySplines is ignored unless calcMode="spline" (SVG
keySplines).
Profile 1 follows that rule: a syntactically valid keySplines attribute on a
linear animation does not affect timing, interpolation, or list-count
validation. The strict source policy still validates every present tuple and
coordinate; malformed syntax or an out-of-range coordinate remains an error.
Spline interpolation
calcMode="spline" retains the same keyframe values, key times, and interval
selection as linear mode. It replaces the segment-local progress q with an
eased progress e before the final property interpolation.
For N >= 2, keySplines is required and contains exactly N - 1 control
point tuples, one per interval. keyTimes remains optional; when it is absent,
the equal offsets above apply. The combination of authored splines and
implicit equal times is part of the SMIL calculation-mode
model.
The spline-values web-platform-test
provides a reference case with explicit times.
Tuples are separated by semicolons. A tuple has four SVG numbers
x1 y1 x2 y2; commas, whitespace, or a mixture of both may separate its
coordinates. XML whitespace around tuples and one final semicolon are
accepted. Empty tuples, the wrong number of coordinates, or the wrong number
of tuples are errors. The mixed-separator web-platform-test
is a representative grammar oracle.
Every coordinate, including y1 and y2, must lie in [0, 1]. This is SVG's
control-point domain and is intentionally narrower than CSS
cubic-bezier(),
whose y coordinates may escape the unit interval. SVG's y restriction is
covered directly by web-platform-tests.
The exact authored decimal is checked against [0, 1] before numeric storage;
binary32 rounding cannot repair an out-of-domain control. Each admitted
coordinate is then parsed once into finite IEEE 754 binary32 using Profile 0's
round-to-nearest, ties-to-even source-number rule. The exact rational value of
that stored binary32 bit pattern participates in the cubic calculations below;
the authored decimal is not reparsed during sampling. Signed zero is
semantically zero for the control-point domain and diagonal comparison.
For one tuple, define the cubic coordinate function
C(a, b, u) = 3(1-u)^2 u a + 3(1-u) u^2 b + u^3.
Bx(u) = C(x1, x2, u)
By(u) = C(y1, y2, u)The implied endpoints are (0, 0) and (1, 1). Eased progress is By(u)
where u solves Bx(u) = q.
Profile 1 fixes inversion rather than leaving a tolerance or machine math library as hidden input:
q = 0returnse = 0, andq = 1returnse = 1exactly.- If
x1 = y1andx2 = y2, the curve lies on the diagonal and returnse = qexactly. - Otherwise begin with the exact rational bracket
[0, 1]. At each step, evaluateBxat the exact midpoint. Equality returnsByat that midpoint immediately. A result belowqreplaces the lower bound; a result aboveqreplaces the upper bound. - After 128 unequal comparisons, evaluate
Byat the exact midpoint of the final bracket. That rational result ise.
The final property value is the exact mathematical interpolation
a + (b - a) × e, rounded once to binary32 with ties-to-even. The inversion,
cubic evaluation, and property interpolation use the exact rational values of
the already parsed keyframe and control-point bits and perform no intermediate
binary floating-point rounding. These rules make direct seek, sequential
playback, and different conforming implementations agree without sharing a
tolerance, iteration-by-error exit, or platform math library.
Bounded source domain
Profile 1 places finite limits on the new source vocabulary so validation and sampling have a portable resource bound:
- a
valueslist contains at most 4,096 keyframes; - a
keySplineslist contains at most 4,095 tuples, including when linear mode ignores the tuples semantically; - each spline-control token is at most 128 bytes after XML-whitespace separation;
- a spline-control decimal exponent is in the inclusive range
[-128, 128]; - each XML-whitespace-trimmed
keyTimestoken is at most 128 bytes; - a
keyTimesdecimal exponent is in the inclusive range[-128, 128]; and - after exact decimal reduction, each
keyTimesnumerator and positive denominator fits the unsigned 64-bit integer domain.
These are deliberate Profile 1 restrictions, not claims about SVG's general limits. Exceeding any limit is a source-profile error discovered during atomic validation, not a sample-time fallback or partial animation.
Validation and diagnostics
Profile 0's atomic Sample policy applies to the complete Profile 1 inventory. In addition to inherited failures, Profile 1 rejects:
- a missing value form, or
fromwithouttowhenvaluesis absent; - an empty, internally empty, mistyped, non-finite, or out-of-domain keyframe;
- interpolation metadata on a one-keyframe constant;
- a malformed, out-of-range, non-endpoint, non-increasing, or wrong-length
explicit
keyTimeslist; calcModeother than absent,linear, orspline;- a missing or wrong-length spline list in spline mode; or
- a malformed or out-of-range spline control point.
A diagnostic identifies the animation and source location, the attribute and
list index when applicable, the required count or domain, and the observed
value. Value-form selection happens before validation, so diagnostics for a
present malformed values attribute must not claim that from or to was
missing.
Conformance
Profile 1 adds these laws to Profile 0's conformance contract:
- every Profile 0 source samples bit-identically under Profile 1;
valueswins overfromandto, and malformedvaluesnever falls back;- a one-value animation is bit-constant across active time and freeze;
- implicit equal times and their explicitly authored equivalents agree;
- every interior key time is probed immediately before, exactly at, and immediately after the boundary, with exact keyframe bits at equality;
- equal, descending, non-zero-first, non-one-last, and wrong-count key times fail atomically;
- valid spline syntax without authored key times uses equal intervals;
- linear mode is unchanged by a valid
keySplinesattribute; - diagonal splines and segment endpoints take their exact fast paths;
- non-trivial splines match reference vectors produced by the 128-step exact inversion contract;
- each source limit is tested at its admitted edge and immediately beyond it; and
- the final frozen value is the last keyframe, not an ignored
toattribute.
The applicable web-platform-tests SVG animation suite remains a semantic oracle. Profile 1's strict-increase rule, exact rational boundaries, binary32 bit rules, and fixed spline inversion are profile conformance requirements, not browser-differential tolerances. Browser and profile conformance results therefore remain separate, as required by Profile 0.
Deferred families
Profile 1 resolves only Profile 0's keyframe-list and easing deferral.
Profile 2 separately resolves replacement sandwiches.
Profile 3 separately resolves addition and accumulation.
Profile 4 separately resolves live-underlying scalar effects and a bounded
typed transform family.
Profile 5 separately resolves straight-sRGB solid-fill paints.
calcMode="discrete", calcMode="paced", by, lone-to animation,
transforms, motion paths, colors and paints,
additional SVG targets and properties, indefinite timing, event timing, CSS
animation, and optimized execution remain outside this profile.
SVG Animation Profile 4: Underlying Effects and Transforms
A deterministic SVG animation subset for live underlying-value effects and typed transform-list animation.
SVG Animation Profile 6: Path Geometry
A deterministic SVG animation subset for compatible path morphing and explicit discrete path replacement.