본문 바로가기
Js

lottieFiles

by 영감은어디에 2024. 7. 15.

https://lottiefiles.com/interactivity

 

Lottie Player - Interactivity Guide

This is a quick demo for using the Lottie interactivity library with the Lottie Web Player component and the Lottie Player to add interactivity to your applications

lottiefiles.com

 


 

<div class="container c1">
    <lottie-player id="test" class="fingerprint" src="data/123.json"></lottie-player>
</div>

<script src="https://unpkg.com/@lottiefiles/lottie-interactivity@latest/dist/lottie-interactivity.min.js"></script>
<script src="https://unpkg.com/@lottiefiles/lottie-player@1/dist/lottie-player.js"></script>

 

스크롤 

LottieInteractivity.create({
    player: '#test',
    mode: 'scroll',
    actions: [
        {
            visibility:[0.2, 0.7], //컨테이너의 20% 일때 시작 70%일때 끝
            type: 'seek',
            frames: [0, 90],
        },
    ]
});

마우스오버

  LottieInteractivity.create({
    player: '#eleventhLottie',
    mode: 'cursor',
    actions: [
      {
          type: "hover",
          forceFlag: false
      }
    ]
  });

 


마우스오버 (마우스떼면 멈춤)

LottieInteractivity.create({
    player: '#test',
    mode: 'cursor',
    actions: [
      {
          position: { x: [0, 1], y: [0, 1] },
          type: "loop",
          frames: [1, 90]
      },
      {
          position: { x: -1, y: -1 },
          type: 'stop',
          frames: [0],
      }
    ]
});

 

'Js' 카테고리의 다른 글

replace(), 유튜브 클릭시 오토플레이  (0) 2024.07.17
숫자 카운터  (0) 2024.07.17
hasClass를 이용한 이미지 체인지  (0) 2024.07.17
throttle(), clone()  (0) 2024.07.17
Lottie.js, scroll 연동  (0) 2024.07.15
swiper.on('slideChange'), letters  (1) 2024.07.14
gsap, draggable, photoswipe  (0) 2024.07.10
백그라운드 영상과 swiper 연계  (0) 2024.07.09