Utils in gsap

gsap提供的函数

  • checkPrefix()
    添加浏览器适配前缀
    1
    2
    // 会根据浏览器自动添加前缀, 如WebkitFilter,MozFilter,如果不需要适配则返回默认值filter
    gsap.utils.checkPrefix("filter");
  • clamp()
    限制数字范围
    1
    2
    // 限制数字在0到100之间
    gsap.utils.clamp(0, 100, -12) // 0;
  • distribute()
  • getUnit()
    获取单位
    1
    gsap.utils.getUnit('20px') // px;
  • interpolate()
  • mapRange()
  • normalize()
  • pipe()
  • random()
  • selector()
  • shuffle()
  • snap()
  • splitColor()
  • toArray()
    类数组(array-like)转化为数组
    1
    gsap.utils.toArray('.box') // 返回Element[];
  • unitize()
  • wrap()
  • wrapYoyo()

本文作者: 孟 虎
本文链接: https://menghu1994.github.io/blog/2024/04/Animation/GSAP/utils/
版权声明: 本博客所有文章除特别声明外,均采用 CC BY-SA 4.0 协议 ,转载请注明出处!