Coder Social home page Coder Social logo

intersection-observer's Introduction

GSAP ScrollTrigger

Problems

  • Chú ý khi muốn trigger animation ở các element sát góc màn hình (có thể event sẽ không được trigger nếu giá trị top/bottom của Trigger chưa chạm đến vị trí của element)
  • Thêm dependency: Khoảng 23kb

Advance

  • Hỗ trợ animation với css properties clip-path
  • Sử dụng với hoạt ảnh phức tạp (nhiều bước) mà không cần customize nhiều vì Gsap đã hỗ trợ.

Intersection Observer

Problems

  • Phải customize nhiều với hoạt ảnh phức tạp
  • Không hỗ trợ tốt với animation sử dụng clip-path, có thể sẽ không hoạt động trong trường hợp:
clip-path: polygon(0 0, 0 0, 0 100%, 0 100%) => clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%)

Advance

  • Có thể viết 1 custom hook để tái sử dụng
  • Không phải thêm dependency

=> Với 1 trang web chỉ cần các animation đơn giản như thay đổi position / opacity => Dùng Intersection Observer. Với Object phức tạp hơn thì nên sử dụng ScrollTrigger.

intersection-observer's People

Contributors

gerichilli avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.