这是 实验性技术
检查 浏览器兼容性表格 要小心谨慎在生产中使用这之前。

getComputedTiming() 方法在 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
auto value is replaced with the appropriate EffectTiming.fill 值。

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

句法

var currentTimeValues = animation.getComputedTiming();
					

参数

None.

返回值

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 动画 ). (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
current time of the animation in milliseconds. If the KeyframeEffect is not associated with an 动画 , its value is null .
progress
Indicates how far along the animation is through its current iteration with values between 0 and 1 。返回 null if the animation is not running or its KeyframeEffect isn't associated with an 动画 .
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 动画 .

规范

规范 状态 注释
Web 动画
The definition of 'AnimationEffect.getComputedTiming()' in that specification.
工作草案 编者草案。

浏览器兼容性

The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. 更新 GitHub 上的兼容性数据
桌面 移动
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
getComputedTiming Chrome 75 Edge 79 Firefox 63 IE No Opera 62 Safari 13.1 WebView Android 75 Chrome Android 75 Firefox Android 63 Opera Android 54 Safari iOS 13.4 Samsung Internet Android 11.0

图例

完整支持

完整支持

不支持

不支持

另请参阅

元数据

  • 最后修改:
  1. AnimationEffect
  2. 方法
    1. getComputedTiming()
    2. getTiming()
    3. updateTiming()