<style>
  html { overflow-x: hidden; }

  .text-9xl { font-size: 18rem; }
</style>

{% macro animated_image(width, height) %}
  <div data-component="ScrollAnimationWithEase"
    data-option-ease="outExpo"
    data-option-play-range="[0.1,0.6]"
    data-option-from="{{ {
      y: 500,
      scale: 0.5,
      opacity: 0
    }|json_encode }}">
    <img data-ref="target"
      src="https://picsum.photos/{{ width }}/{{ height }}"
      alt=""
      width="{{ width }}"
      height="{{ height }}" />
  </div>
{% endmacro %}

<div class="h-96 p-10 space-y-4 text-center text-gray-800">
  Scroll down
</div>
<div class="h-screen p-10" style="contain: content;">
  <div class="grid gap-10 grid-cols-5">
    <div>
      <div data-ref="target" class="space-y-10">
        {{ _self.animated_image(400, 600) }}
        {{ _self.animated_image(400, 500) }}
        {{ _self.animated_image(400, 550) }}
      </div>
    </div>
    <div data-component="ScrollAnimation"
      data-option-from="{{ { y: 160 }|json_encode }}"
      data-option-to="{{ { y: -160 }|json_encode }}">
      <div data-ref="target" class="space-y-10">
        {{ _self.animated_image(400, 400) }}
        {{ _self.animated_image(400, 450) }}
        {{ _self.animated_image(400, 580) }}
      </div>
    </div>
    <div data-component="ScrollAnimation"
      data-option-from="{{ { y: 320 }|json_encode }}"
      data-option-to="{{ { y: -320 }|json_encode }}">
      <div data-ref="target" class="space-y-10">
        {{ _self.animated_image(400, 440) }}
        {{ _self.animated_image(400, 460) }}
        {{ _self.animated_image(400, 560) }}
        {{ _self.animated_image(400, 610) }}
      </div>
    </div>
    <div data-component="ScrollAnimation"
      data-option-from="{{ { y: 160 }|json_encode }}"
      data-option-to="{{ { y: -160 }|json_encode }}">
      <div data-ref="target" class="space-y-10">
        {{ _self.animated_image(400, 530) }}
        {{ _self.animated_image(400, 520) }}
        {{ _self.animated_image(400, 620) }}
      </div>
    </div>
    <div>
      <div data-ref="target" class="space-y-10">
        {{ _self.animated_image(400, 480) }}
        {{ _self.animated_image(400, 540) }}
        {{ _self.animated_image(400, 590) }}
      </div>
    </div>
  </div>
</div>
<div {{
  html_attributes({
    data_component: 'ScrollAnimation',
    data_option_to: { scale: 1.1 },
    class: 'z-10 relative bg-gray-200',
    style: { contain: 'content' },
  })
  }}>
  <div data-ref="target"
    class="flex items-center justify-around w-full max-w-xl h-screen mx-auto text-9xl font-extrabold text-blue-800">
    <span {{
      html_attributes({
        data_component: 'ScrollAnimation',
        data_option_to: { x: - 300, y: - 100, rotate: - 80, scale: 2 }
      })
      }}>
      <span class="block pointer-events-none" data-ref="target">D</span>
    </span>
    <span {{
      html_attributes({
        data_component: 'ScrollAnimation',
        data_option_to: { x: - 150, y: - 50, rotate: - 40, scale: 1.5 }
      })
      }}>
      <span class="block pointer-events-none" data-ref="target">E</span>
    </span>
    <span {{
      html_attributes({
        data_component: 'ScrollAnimation',
        data_option_to: { x: 150, y: - 50, rotate: 40, scale: 1.5 }
      })
      }}>
      <span class="block pointer-events-none" data-ref="target">M</span>
    </span>
    <span {{
      html_attributes({
        data_component: 'ScrollAnimation',
        data_option_to: { x: 300, y: - 100, rotate: 80, scale: 2 }
      })
      }}>
      <span class="block pointer-events-none" data-ref="target">O</span>
    </span>
  </div>
</div>
<div {{
  html_attributes({
    data_component: 'ScrollAnimation',
    data_option_damp_factor: 0.1,
    data_option_from: { scale: 0 },
    class: 'relative bg-gray-200',
    style: { height: '300vh' }
  })
  }}>
  <div class="sticky top-0 left-0 flex items-center justify-center w-full h-screen text-center overflow-hidden">
    <p class="text-4xl font-extrabold text-gray-800">
      Lorem ipsum dolor sit amet
    </p>
    <div class="absolute top-full left-1/2 w-2 h-2 -mt-1 -ml-1">
      <div data-ref="target"
        class="absolute top-1/2 left-1/2 bg-blue-600 rounded-full mix-blend-darken transform scale-0"
        style="width: 250vmax; height: 250vmax; margin-top: -125vmax; margin-left: -125vmax;"></div>
    </div>
  </div>
</div>
<div class="h-screen"></div>
