The end
attribute defines an end value for the animation that can constrain the active duration.
Five elements are using this attribute: <animate>
, <animateColor>
, <animateMotion>
, <animateTransform>
, and <set>
Default value | None |
---|---|
Value | <end-value-list> |
Animatable | No |
The <end-value-list>
is a semicolon-separated list of values. Each value can be one of the following:
<offset-value>
load
or DOMContentLoaded
event). Negative values are valid.<syncbase-value>
begin
or end
to identify whether to synchronize with the beginning or active end of the referenced animation element. An optional offset value as defined in <offset-value>
can be appended.<event-value>
focus
, blur
, focusin
, focusout
, activate
, auxclick
, click
, dblclick
, mousedown
, mouseenter
, mouseleave
, mousemove
, mouseout
, mouseover
, mouseup
, wheel
, beforeinput
, input
, keydown
, keyup
, compositionstart
, compositionupdate
, compositionend
, load
, unload
, abort
, error
, select
, resize
, scroll
, beginEvent
, endEvent
, and repeatEvent
. An optional offset value as defined in <offset-value>
can be appended.<repeat-value>
repeat()
with an integer value specifying the number of repetitions as parameter. An optional offset value as defined in <offset-value>
can be appended.<accessKey-value>
accessKey()
with the character to be input as parameter. An optional offset value as defined in <offset-value>
can be appended.<wallclock-sync-value>
wallclock()
with a time value as parameter. The time syntax is based upon the syntax defined in ISO 8601.indefinite
SVGAnimationElement.endElement()
method call.<svg width="120" height="120" viewBox="0 0 120 120" xmlns="http://www.w3.org/2000/svg" version="1.1"> <!-- animated rectangles --> <rect x="10" y="35" height="15" width="0"> <animate attributeType="XML" attributeName="width" to="100" begin="0s" end="8s" fill="freeze" /> </rect> <rect x="10" y="60" height="15" width="0"> <animate attributeType="XML" attributeName="width" to="75" begin="0s" end="6s" fill="freeze" /> </rect> <rect x="10" y="85" height="15" width="0"> <animate attributeType="XML" attributeName="width" to="50" begin="0s" end="4s" fill="freeze" /> </rect> <!-- grid --> <text x="10" y="20" text-anchor="middle">0s</text> <line x1="10" y1="25" x2="10" y2="105" stroke="grey" stroke-width=".5" /> <text x="35" y="20" text-anchor="middle">2s</text> <line x1="35" y1="25" x2="35" y2="105" stroke="grey" stroke-width=".5" /> <text x="60" y="20" text-anchor="middle">4s</text> <line x1="60" y1="25" x2="60" y2="105" stroke="grey" stroke-width=".5" /> <text x="85" y="20" text-anchor="middle">6s</text> <line x1="85" y1="25" x2="85" y2="105" stroke="grey" stroke-width=".5" /> <text x="110" y="20" text-anchor="middle">8s</text> <line x1="110" y1="25" x2="110" y2="105" stroke="grey" stroke-width=".5" /> <line x1="10" y1="30" x2="110" y2="30" stroke="grey" stroke-width=".5" /> <line x1="10" y1="105" x2="110" y2="105" stroke="grey" stroke-width=".5" /> </svg>
<svg width="120" height="120" viewBox="0 0 120 120" xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink"> <!-- animated rectangle --> <rect x="10" y="35" height="15" width="0"> <animate attributeType="XML" attributeName="width" from="0" to="100" begin="0s" end="endButton.click" dur="8s" repeatCount="indefinite" fill="freeze" /> </rect> <!-- trigger --> <rect id="endButton" style="cursor:pointer;" x="19.5" y="62.5" rx="5" height="25" width="80" fill="#EFEFEF" stroke="black" stroke-width="1" /> <text x="60" y="80" text-anchor="middle" style="pointer-events:none;">Click me.</text> <!-- grid --> <text x="10" y="20" text-anchor="middle">0s</text> <line x1="10" y1="25" x2="10" y2="55" stroke="grey" stroke-width=".5" /> <text x="35" y="20" text-anchor="middle">2s</text> <line x1="35" y1="25" x2="35" y2="55" stroke="grey" stroke-width=".5" /> <text x="60" y="20" text-anchor="middle">4s</text> <line x1="60" y1="25" x2="60" y2="55" stroke="grey" stroke-width=".5" /> <text x="85" y="20" text-anchor="middle">6s</text> <line x1="85" y1="25" x2="85" y2="55" stroke="grey" stroke-width=".5" /> <text x="110" y="20" text-anchor="middle">8s</text> <line x1="110" y1="25" x2="110" y2="55" stroke="grey" stroke-width=".5" /> <line x1="10" y1="30" x2="110" y2="30" stroke="grey" stroke-width=".5" /> <line x1="10" y1="55" x2="110" y2="55" stroke="grey" stroke-width=".5" /> </svg>
<svg width="120" height="120" viewBox="0 0 120 120" xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink"> <!-- animated rectangles --> <rect x="10" y="35" height="15" width="0"> <animate attributeType="XML" attributeName="width" from="0" to="100" begin="0s" end="accessKey(e)" dur="8s" repeatCount="indefinite" fill="freeze" /> </rect> <!-- trigger --> <text x="60" y="80" text-anchor="middle" style="pointer-events:none;">Hit the "s" key</text> <!-- grid --> <text x="10" y="20" text-anchor="middle">0s</text> <line x1="10" y1="25" x2="10" y2="55" stroke="grey" stroke-width=".5" /> <text x="35" y="20" text-anchor="middle">2s</text> <line x1="35" y1="25" x2="35" y2="55" stroke="grey" stroke-width=".5" /> <text x="60" y="20" text-anchor="middle">4s</text> <line x1="60" y1="25" x2="60" y2="55" stroke="grey" stroke-width=".5" /> <text x="85" y="20" text-anchor="middle">6s</text> <line x1="85" y1="25" x2="85" y2="55" stroke="grey" stroke-width=".5" /> <text x="110" y="20" text-anchor="middle">8s</text> <line x1="110" y1="25" x2="110" y2="55" stroke="grey" stroke-width=".5" /> <line x1="10" y1="30" x2="110" y2="30" stroke="grey" stroke-width=".5" /> <line x1="10" y1="55" x2="110" y2="55" stroke="grey" stroke-width=".5" /> </svg>
This example is embed in an iFrame. If you want to activate the key events, you have to click on it first.
Specification | Status | Comment |
---|---|---|
SVG Animations Level 2 The definition of 'end' in that specification. | Editor's Draft | No change |
Scalable Vector Graphics (SVG) 1.1 (Second Edition) The definition of 'end' in that specification. | Recommendation | Initial definition |
© 2005–2020 Mozilla and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/end