web-animations / web-animations-js

JavaScript implementation of the Web Animations API
http://web-animations.github.io
Apache License 2.0
3.77k stars 408 forks source link

Offset must be number? #212

Open ycmjason opened 5 years ago

ycmjason commented 5 years ago

According to the mdn doc, offset could be written in an array of numbers. Here is an example in the doc:

element.animate({
  opacity: [ 0, 0.9, 1 ],
  offset: [ 0, 0.8 ], // Shorthand for [ 0, 0.8, 1 ]
  easing: [ 'ease-in', 'ease-out' ],
}, 2000);

I was trying to do exactly the same but it throws an error:

TypeError: Keyframe offsets must be numbers.

Is this a new feature that has not been polyfilled or am I expecting wrong thing from this lib?

birtles commented 5 years ago

Yes, arrays of offsets are a more recent addition to the spec (added just under 2 years ago) so I suspect the polyfill has not been updated to support that yet.