• Resolved egornmore

    (@egornmore)


    Hi! I am playing around with amp-fx-collection components and noticed that it has a weird appearance on page first load (no cache). I can see the image in the first milliseconds then it disappears and amp-fx fade-in animation starts (video attached). How can I avoid displaying images before amp-fx?

    Video: https://streamable.com/u7kzcy

    HTML:
    <img src="'. $image_url[0] .'" height="800" width="1700" alt="'. $attributes["image_alt"] .'" amp-fx="fade-in" data-duration="2000ms" />

    • This topic was modified 3 years, 5 months ago by egornmore.
Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Support Milind More

    (@milindmore22)

    Hello @egornmore

    Thank you for the support topic, the amp-fx-collection may be conflicting with amp-img‘s lazy loading feature.

    I will recommend adding the image in a container div and adding amp-fx animations on the container.

    eg :

    <div amp-fx="fade-in" data-duration="2000ms">
      <img src="'. $image_url[0] .'" height="800" width="1700" alt="'. $attributes["image_alt"] .'" amp-fx="fade-in" data-duration="2000ms" />
    </div>
    Thread Starter egornmore

    (@egornmore)

    Hello @milindmore22

    Tested with container div – same issue. I can do it in a bit tricky way by creating an overlaying absolute div with body background color and fade-out. Does amp-fx-collection has fade-out animation? Thanks for your time

    Plugin Support Milind More

    (@milindmore22)

    Can you please check this example with data-easing="ease-in-out"

    if you wanted to add keyframe based custom animations please check the amp-animation component.

    Thread Starter egornmore

    (@egornmore)

    Hi @milindmore22
    I’ve checked the example provided, it’s done the same way as I’ve tried before. Also, I’ve tried keyframes animation with the amp-animation component, unfortunately still a blink issue on load. The only solution that works ok is to create an overlaying div with fade-out animation (see screenshot), then it looks like the image is fading in (video attached). Do you know if there is a way to use animation-direction with amp-fx? I need ‘fade-out’ animation rather than fade-in in particular solution.

    • This reply was modified 3 years, 4 months ago by egornmore.
    Plugin Support Milind More

    (@milindmore22)

    Hello @egornmore

    I checked docs for amp-fx-collection but it seems that there is no fade-out animation.

    Can you try data-easing=”ease-out” on overlay and data-easing=”ease-in” on image.

    So fade-in animation will begin quickly on overlay and slow down at the end but on the image it starts slowly and ends quickly, creating a fade-out effect.

    Hope this helps!

    Thread Starter egornmore

    (@egornmore)

    Hello @milindmore22
    I’ve tried your solution, now it appears smoothly and disappears smoothly. I can’t make it work with ‘amp-fx’. I’ll just leave it with overlaying div CSS fadeout solution for now, maybe will post a GIT feature request for adding amp-fx ‘fade-out’ or fixing lazyload + amp-fx conflict later. Thanks for your time.

    Plugin Support Milind More

    (@milindmore22)

    Hello @egornmore

    Thank you for your patience, I tried to help the best I can, but I will recommend approaching the AMP core team on slack #using-amp channel or on StackOverflow regarding how you can use a specific component.

    I will mark this topic as resolved, feel free to open a new support topic if you need further assistance.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Image appearance on first load (amp-fx)’ is closed to new replies.