AnimationEffect.getComputedTiming() - Web APIs 编辑

Experimental

This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

The getComputedTiming() method of the AnimationEffect interface returns the calculated timing properties for this animation effect.

Although many of the attributes of the returned object are common to the EffectTiming contained in the object returned by the AnimationEffect.getTiming() method, the values returned by this object differ in the following ways:

duration
Returns the calculated value of the iteration duration. If EffectTiming.duration is the string auto, this attribute will return 0.
fill
The auto value is replaced with the appropriate EffectTiming.fill value.

These values are comparable to the computed styles of an Element returned using window.getComputedStyle(elem).

Syntax

var currentTimeValues = animation.getComputedTiming();

Parameters

None.

Return Value

A ComputedEffectTiming dictionary object, which contains the following properties:

endTime
The end time of the animation in milliseconds from the animation's start (if the KeyframeEffect is associated with an Animation). (Also includes EffectTiming.endDelay in that calculation.)
activeDuration
The length of time in milliseconds that the animation's effects will run. This is equal to the iteration duration multiplied by the iteration count.
localTime
The current time of the animation in milliseconds. If the KeyframeEffect is not associated with an Animation, its value is null.
progress
Indicates how far along the animation is through its current iteration with values between 0 and 1. Returns null if the animation is not running or its KeyframeEffect isn't associated with an Animation.
currentIteration
The number of times this animation has looped, starting from 0. Returns null if the animation is not running or its KeyframeEffect isn't associated with an Animation.

Specifications

SpecificationStatusComment
Web Animations
The definition of 'AnimationEffect.getComputedTiming()' in that specification.
Working DraftEditor's draft.

Browser compatibility

BCD tables only load in the browser

See also

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:69 次

字数:4796

最后编辑:6年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文