SVGAnimationElement: beginEvent event

Baseline 2025
Newly available

Since December 2025, this feature works across the latest devices and browser versions. This feature might not work in older devices or browsers.

The beginEvent event of the SVGAnimationElement interface is fired when the element local timeline begins to play. It will be raised each time the element begins the active duration (i.e., when it restarts, but not when it repeats).

It may be raised both in the course of normal (i.e., scheduled or interactive) timeline play, as well as in the case that the element was begun with a DOM method.

This event is not cancelable and does not bubble.

Syntax

Use the event name in methods like addEventListener(), or set an event handler property.

js
addEventListener("beginEvent", (event) => { })

onbegin = (event) => { }

Event type

A TimeEvent. Inherits from Event.

Event TimeEvent

Event properties

TimeEvent.detail Read only

A long that specifies some detail information about the Event, depending on the type of the event. For this event type, indicates the repeat number for the animation.

TimeEvent.view Read only

A WindowProxy that identifies the Window from which the event was generated.

Examples

Animated circle

html
<svg xmlns="http://www.w3.org/2000/svg" width="300px" height="100px">
  <title>SVG SMIL Animate with Path</title>
  <circle cx="0" cy="50" r="50" fill="blue" stroke="black" stroke-width="1">
    <animateMotion path="M 0 0 H 300 Z" dur="5s" repeatCount="indefinite" />
  </circle>
</svg>

<hr />

<ul></ul>
css
ul {
  height: 100px;
  border: 1px solid #dddddd;
  overflow-y: scroll;
  padding: 10px 30px;
}
js
let svgElem = document.querySelector("svg");
let animateElem = document.querySelector("animateMotion");
let list = document.querySelector("ul");

animateElem.addEventListener("beginEvent", () => {
  let listItem = document.createElement("li");
  listItem.textContent = "beginEvent fired";
  list.appendChild(listItem);
});

animateElem.addEventListener("repeatEvent", (e) => {
  let listItem = document.createElement("li");
  let msg = "repeatEvent fired";
  if (e.detail) {
    msg += `; repeat number: ${e.detail}`;
  }
  listItem.textContent = msg;
  list.appendChild(listItem);
});

Event handler property equivalent

Note that you can also create an event listener for the begin event using the onbegin event handler property:

js
animateElem.onbegin = () => {
  console.log("beginEvent fired");
};

Specifications

Specification
Scalable Vector Graphics (SVG) 2
# BeginEvent

Browser compatibility

desktop mobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
beginEvent event
Chrome – Partial support
Chrome 31 – 34 (Release date: 2013-11-12)
footnote Partial support
footnote The onbegin event handler property is not supported.
Chrome – Full support
Chrome 35 (Release date: 2014-05-20)
footnote Full support
Edge – Full support
Edge 79 (Release date: 2020-01-15)
footnote Full support
Firefox – Partial support
Firefox 6 – 92 (Release date: 2011-08-16)
footnote Partial support
footnote The onbegin event handler property is not supported.
Firefox – Full support
Firefox 93 (Release date: 2021-10-05)
footnote Full support
Opera – Partial support
Opera 18 – 21 (Release date: 2013-11-19)
footnote Partial support
footnote The onbegin event handler property is not supported.
Opera – Full support
Opera 22 (Release date: 2014-06-03)
footnote Full support
Safari – Partial support
Safari 10 – 26.1 (Release date: 2016-09-20)
footnote Partial support
footnote The onbegin event handler property is not supported.
Safari – Full support
Safari 26.2 (Release date: 2025-12-12)
footnote Full support
Chrome Android – Partial support
Chrome Android 31 – 34 (Release date: 2013-11-14)
footnote Partial support
footnote The onbegin event handler property is not supported.
Chrome Android – Full support
Chrome Android 35 (Release date: 2014-05-20)
footnote Full support
Firefox for Android – Partial support
Firefox for Android 6 – 92 (Release date: 2011-08-16)
footnote Partial support
footnote The onbegin event handler property is not supported.
Firefox for Android – Full support
Firefox for Android 93 (Release date: 2021-10-05)
footnote Full support
Opera Android – Partial support
Opera Android 18 – 21 (Release date: 2013-11-20)
footnote Partial support
footnote The onbegin event handler property is not supported.
Opera Android – Full support
Opera Android 22 (Release date: 2014-06-17)
footnote Full support
Safari on iOS – Partial support
Safari on iOS 10 – 26.1 (Release date: 2016-09-13)
footnote Partial support
footnote The onbegin event handler property is not supported.
Safari on iOS – Full support
Safari on iOS 26.2 (Release date: 2025-12-12)
footnote Full support
Samsung Internet – Partial support
Samsung Internet 2 – 2.1 (Release date: 2014-10-17)
footnote Partial support
footnote The onbegin event handler property is not supported.
Samsung Internet – Full support
Samsung Internet 3 (Release date: 2015-04-10)
footnote Full support
WebView Android – Partial support
WebView Android 4.4.3 – 4.4.3 (Release date: 2014-06-02)
footnote Partial support
footnote The onbegin event handler property is not supported.
WebView Android – Full support
WebView Android 37 (Release date: 2014-09-03)
footnote Full support
WebView on iOS – Partial support
WebView on iOS 10 – 26.1 (Release date: 2016-09-13)
footnote Partial support
footnote The onbegin event handler property is not supported.
WebView on iOS – Full support
WebView on iOS 26.2 (Release date: 2025-12-12)
footnote Full support

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
Partial support
Partial support
Has more compatibility info.

See also