<output id="qn6qe"></output>

    1. <output id="qn6qe"><tt id="qn6qe"></tt></output>
    2. <strike id="qn6qe"></strike>

      亚洲 日本 欧洲 欧美 视频,日韩中文字幕有码av,一本一道av中文字幕无码,国产线播放免费人成视频播放,人妻少妇偷人无码视频,日夜啪啪一区二区三区,国产尤物精品自在拍视频首页,久热这里只有精品12
      代碼改變世界

      swing with transformjs

      2016-11-29 10:39  【當耐特】  閱讀(918)  評論(0)    收藏  舉報

      Antecedent

      Facebook made a HTML5 game long time ago. The opening animation is a piece of software that is similar to tofu, the effect as shown below gif:

      Facebook was using easeljs and tweenjs of createjs to produce, based on the Canvas animation. The basic principle is: circular motion skewX scaleY of DisplayObject to implement software swing.
      Currently, transformjs also can do it, because the transformjs can also set the skewX and scaleY of dom element. First look at the way facebook.

      tweenjs + transformjs

      Note that the tweenjs here is a sub project under the createjs, it's net the tween.js project on the github.

      var element = document.querySelector("#test");
      Transform(element);
      element.originY = 100;
      element.skewX = -20;
      
      var Tween = createjs.Tween,
          sineInOutEase = createjs.Ease.sineInOut;
      Tween.get(element, {loop: true}).to({scaleY: .8}, 450, sineInOutEase).to({scaleY: 1}, 450, sineInOutEase);
      Tween.get(element, {loop: true}).to({skewX: 20}, 900, sineInOutEase).to({skewX: -20}, 900, sineInOutEase);
      
      

      Online demo: http://alloyteam.github.io/AlloyTouch/transformjs/example/soft2.html
      The code above is very simple. Here's a little explanation:

      • The initial skewX of element is -20 in order to keep step with scale
      • element's originY is 100, for the penguin's center bottom as the reference point
        you can see it, due to the high abstraction of transformjs, can be easily used with tweenjs, without any pressure.

      AlloyFlow + transformjs

      May the above code is not very understand the specific implementation of the process? To tell the truth, the first time to see the above code does not look at the clear process. Then use the AlloyFlow workflow to achieve the same way to achieve the same effect.

      var element = document.querySelector("#test");
      Transform(element);
      element.originY = 100;
      element.skewX = -20;
      
      function sineInOut(a) {
          return 0.5 * (1 - Math.cos(Math.PI * a));
      }
      
      var alloyFlow = new AlloyFlow({
          workflow: [
              {
                  work: function () {
                      To.go(element, "scaleY", .8, 450, sineInOut);
                      To.go(element, "skewX", 20, 900, sineInOut)
                  },
                  start: 0
              }, {
                  work: function () {
                      To.go(element, "scaleY", 1, 450, sineInOut)
                  },
                  start: 450
              }, {
                  work: function () {
                      To.go(element, "scaleY", .8, 450, sineInOut);
                      To.go(element, "skewX", -20, 900, sineInOut)
                  },
                  start: 900
              }, {
                  work: function () {
                      To.go(element, "scaleY", 1, 450, sineInOut);
                  },
                  start: 1350
              }, {
                  work: function () {
                      this.start();
                  },
                  start: 1800
              }
          ]
      }).start();
      
      

      Online demo: http://alloyteam.github.io/AlloyTouch/transformjs/example/soft.html
      Can see above the workflow there is a pile of work in accordance with the start of the time in order to execute, and finally in the 1800ms when the call this.start () will return to the starting point to start running again. Also need to explain why the choice of easing sineInOut. Can take a look at its easing image:

      SineInOut rate is slow to fast and then slow, just in line with the software's own binding force simulation.
      So, AlloyFlow is the artifact? And listen to the next single opening decomposition.

      Start using transformjs

      There are a lot of people ask, can transformjs do some cool effects?
      In fact, transformjs he just provided the basis of the transformation capability, not with the time, and the movement of the library coupling. Can be used in conjunction with any time movement library. So how cool you completely rely on creativity and imagination .
      Transformjs accounting to calculate the matrix3d assigned to the transform msTransform OTransform MozTransform webkitTransform DOM, to ensure hardware acceleration and compatibility at the same time, do not lose the programmable, point a praise.

      Home:http://alloyteam.github.io/AlloyTouch/transformjs/
      Github :https://github.com/AlloyTeam/AlloyTouch/tree/master/transformjs

      主站蜘蛛池模板: 野外做受三级视频| 女人高潮流白浆视频| 国产成人精品无码专区| 国产av熟女一区二区三区| 欧美人人妻人人澡人人尤物 | 成人无码午夜在线观看| 超碰人人超碰人人| 乱色欧美激惰| 精品国产亚洲一区二区三区| 国产婷婷综合在线视频中文| 暖暖影院日本高清...免费| 免费观看添你到高潮视频| 精品一区二区三区少妇蜜臀| 精品国产成人国产在线观看| 乱子伦视频在线看| 美女午夜福利视频一区二区| 国产va免费精品观看| 亚洲最大日韩精品一区| 欧美成人aaa片一区国产精品| 国产精品天干天干综合网| 国产最新AV在线播放不卡| 国产精品国产自产拍高清| 高清欧美性猛交xxxx黑人猛交| 国产无遮挡性视频免费看| 精品国产一区二区在线视| 夜爽8888视频在线观看| 91人妻熟妇在线视频| 亚洲综合久久一区二区三区 | 韩国三级+mp4| 少妇真人直播免费视频| 国产精品一区二区三区蜜臀| 亚洲高清免费在线观看| 久久中文字幕日韩无码视频| 国产福利午夜十八禁久久| 亚洲一区二区三区在线观看播放| 亚洲春色在线视频| 国产综合久久久久久鬼色| 久久综合亚洲鲁鲁九月天| 一区二区三区无码高清视频| 国产熟女精品一区二区三区| 国产精品亚洲二区在线播放|