(三)TweenMax运动效果

2020-04-17 10:42:29

参考地址 TweenMax运动效果

(1)本机知识点

  • 运动效果
    实例化对象.set() 立刻运动到指定地点,不用加时间

(2) 设置其他缓动效果

  • Linear 线性

  • Back 变化

  • Bounce 弹跳变化

  • Circ 圆形变化

  • Cubic 立方体变化

  • Elastic 橡皮圈变化

  • Expo 爆炸变化

  • Quad 变化

  • Quint 变化

  • Sine 正弦变化

(3) set 立刻运动 代码如下

<!DOCTYPE html><html lang="en"><head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <script src="js/jquery.min.js"></script>
  <script src="js/TweenMax.min.js"></script></head><body>
  <style>
    * {
      margin: 0px;
      padding: 0px;
    }
    
    #box {
      width: 100px;
      height: 100px;
      background: red;
      position: absolute;
      left: 0px;
      top: 100px;
    }  </style>
  <div id="box"></div>
  <button id="btn">按钮</button></body><script>
  $(function() {
    var TweenMax = new TimelineMax(); //必须创建对象
    $("#btn").click(() => {
      TweenMax.set("#box", {
        x: 400
      })
    })

  })</script></html>

(4)运动效果

<!DOCTYPE html><html lang="en"><head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <script src="js/jquery.min.js"></script>
  <script src="js/TweenMax.min.js"></script></head><body>
  <style>
    * {
      margin: 0px;
      padding: 0px;
    }
    
    #box {
      width: 100px;
      height: 100px;
      background: red;
      position: absolute;
      left: 0px;
      top: 100px;
    }  </style>
  <div id="box"></div>
  <button id="btn">按钮</button></body><script>
  $(function() {
    var TweenMax = new TimelineMax(); //必须创建对象
    $("#btn").click(() => {
      //   TweenMax.set("#box", {
      //     x: 400
      //   })
      TweenMax.to("#box", 2, {
        x: 400,
        //ease: Back.easeIn,
        //ease: Back.easeOut,
        ease: Back.easeInOut,
      })
    })

  })</script></html>


  • 2017-02-13 17:50:05

    cURL error 60: SSL certificate problem: unable to get local issuer certificate

    Drupal 8 version uses Guzzle Http Client internally, but under the hood it may use cURL or PHP internals. If you installed PHP cURL on your PHP server it typically uses cURL and you may see an exception with error Peer certificate cannot be authenticated with known CA certificates or error code CURLE_SSL_CACERT (60).

  • 2017-02-16 08:09:01

    HTML中PRE和p的区别

    pre 元素可定义预格式化的文本。被包围在 pre 元素中的文本通常会保留空格和换行符。而文本也会呈现为等宽字体。 <pre> 标签的一个常见应用就是用来表示计算机的源代码。

  • 2017-02-16 15:14:14

    动态加载js和css

    开发过程中经常需要动态加载js和css,今天特意总结了一下常用的方法。

  • 2017-02-17 17:11:24

    mysql插入数据后返回自增ID的方法c

    产生的ID 每次连接后保存在服务器中。这意味着函数向一个给定客户端返回的值是该客户端产生对影响AUTO_INCREMENT列的最新语句第一个 AUTO_INCREMENT值的。这个值不能被其它客户端影响,即使它们产生它们自己的 AUTO_INCREMENT值。这个行为保证了你能够找回自己的 ID 而不用担心其它客户端的活动,而且不需要加锁或处理