amphtml icon indicating copy to clipboard operation
amphtml copied to clipboard

amp-animation & friends use incorrect keyframe easings on Safari 13.1

Open Ichigo3d opened this issue 6 years ago • 5 comments

Description: Drop-in ads story animation works slow in Safari browser

Steps:

  1. launch local server on version 2004071640410
  2. open link http://localhost:8000/examples/amp-story-auto-ads.amp.html
  3. swipe to left until Drop-in story ads
  4. observe result.

Actual result: drop-in story ads animation works slow.

Expected result: drop-in story ads animation works should works fast.

Ichigo3d avatar Apr 14 '20 20:04 Ichigo3d

/invite @Ichigo3d

alanorozco avatar Apr 14 '20 20:04 alanorozco

An invitation to join ampproject has been sent to @Ichigo3d. I will update this thread when the invitation is accepted.

amp-invite-bot avatar Apr 14 '20 20:04 amp-invite-bot

This on Safari 13.1 onwards since the WebAnimation API is now native

The discrepancy with other platforms is that Safari won't interpret easing in individual keyframes when the keyframes include transform.

This test case should do a stepped jump and then ease to the initial position. In Safari, this is a linear animation instead.

<div class="animated"></div>
<script>
  document.querySelector(".animated").animate(
    [
      {
        transform: "translateY(0px)",
        easing: "step-start",
      },
      {
        transform: "translateY(200px)",
      },
      {
        transform: "translateY(0px)",
      },
    ],
    {
      iterations: Infinity,
      duration: 2000,
    }
  );
</script>
Correct Incorrect (no easings)

Same problem with the amp-story drop animation described in this issue, case reproduced and isolated here.

We can rewrite amp-story preset keyframes so they don't use individual easings, but this would still be a problem with any <amp-animation> that uses this feature.

I'm working on finding a web platform test to provide a bug to WebKit. From AMP's side, we either force using the polyfill or wait for this to be resolved.

alanorozco avatar Apr 14 '20 20:04 alanorozco

Filed WebKit bug https://bugs.webkit.org/show_bug.cgi?id=210526 Force polyfill as workaround in #27773

alanorozco avatar Apr 15 '20 06:04 alanorozco

The invitation to @Ichigo3d was accepted!

amp-invite-bot avatar Jun 24 '20 15:06 amp-invite-bot