滚动条动画

使用到的js库

jquery.js
ScrollMagic.js 
gsap.js

页面引入js

使用动画

 

转换滚动数据的函数调用说明:

 函数:

function handleProgress({ start, end, progress, portions = 100, progressCallback, initStart, initEnd }) {
    if (progress < start) {
      initStart && initStart()
    }
    if (progress > end) {
      initEnd && initEnd()
    }
    // 区间内触发
    if (progress >= start && progress <= end) {
      // 把起点变成0
      let progressNum = progress - start;
      // 滚动区间距离值
      let interval = end - start;
      progressCallback && progressCallback(progressNum / (interval / portions))
    }
  }

 

调用函数:

 

 

 

posted @ 2024-01-26 11:17  大厨的笔记  阅读(9)  评论(0编辑  收藏  举报