Movatterモバイル変換


[0]ホーム

URL:


MDN Web Docs

Animation

BaselineWidely available

TheAnimation interface of theWeb Animations API represents a single animation player and provides playback controls and a timeline for an animation node or source.

EventTarget Animation

Constructor

Animation()

Creates a newAnimation object instance.

Instance properties

Animation.currentTime

The current time value of the animation in milliseconds, whether running or paused. If the animation lacks atimeline, is inactive or hasn't been played yet, its value isnull.

Animation.effect

Gets and sets theAnimationEffect associated with this animation. This will usually be aKeyframeEffect object.

Animation.finishedRead only

Returns the current finished Promise for this animation.

Animation.id

Gets and sets theString used to identify the animation.

Animation.overallProgressRead only

Returns a number between0 and1 indicating the animation's overall progress towards its finished state.

Animation.pendingRead only

Indicates whether the animation is currently waiting for an asynchronous operation such as initiating playback or pausing a running animation.

Animation.playStateRead only

Returns an enumerated value describing the playback state of an animation.

Animation.playbackRate

Gets or sets the playback rate of the animation.

Animation.readyRead only

Returns the current ready Promise for this animation.

Animation.replaceStateRead only

Indicates whether the animation is active, has been automatically removed after being replaced by another animation, or has been explicitly persisted by a call toAnimation.persist().

Animation.startTime

Gets or sets the scheduled time when an animation's playback should begin.

Animation.timeline

Gets or sets thetimeline associated with this animation.

Instance methods

Animation.cancel()

Clears allkeyframeEffects caused by this animation and aborts its playback.

Animation.commitStyles()

Commits the current styling state of an animation to the element being animated, even after that animation has been removed. It will cause the current styling state to be written to the element being animated, in the form of properties inside astyle attribute.

Animation.finish()

Seeks either end of an animation, depending on whether the animation is playing or reversing.

Animation.pause()

Suspends playing of an animation.

Animation.persist()

Explicitly persists an animation, preventing it from beingautomatically removed when another animation replaces it.

Animation.play()

Starts or resumes playing of an animation, or begins the animation again if it previously finished.

Animation.reverse()

Reverses playback direction, stopping at the start of the animation. If the animation is finished or unplayed, it will play from end to beginning.

Animation.updatePlaybackRate()

Sets the speed of an animation after first synchronizing its playback position.

Events

cancel

Fires when theAnimation.cancel() method is called or when the animation enters the"idle" play state from another state.

finish

Fires when the animation finishes playing.

remove

Fires when the animation isautomatically removed by the browser.

Accessibility concerns

Blinking and flashing animation can be problematic for people with cognitive concerns such as Attention Deficit Hyperactivity Disorder (ADHD). Additionally, certain kinds of motion can be a trigger for Vestibular disorders, epilepsy, and migraine, and Scotopic sensitivity.

Consider providing a mechanism for pausing or disabling animation, as well as using theReduced Motion Media Query (or equivalentuser agent client hintSec-CH-Prefers-Reduced-Motion) to create a complimentary experience for users who have expressed a preference for no animated experiences.

Specifications

Specification
Web Animations
# the-animation-interface

Browser compatibility

See also

Help improve MDN

Learn how to contribute.

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp