HTML5技术

swing with transformjs - 【当耐特】

字号+ 作者:H5之家 来源:H5之家 2016-12-01 17:00 我要评论( )

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 an

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.

(element).Tween sineInOutEase .)..sineInOutEase).sineInOutEase)).sineInOutEase).sineInOutEase);

Online demo:
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.

    (element).(a) (.alloyFlow ([ () .sineInOut)sineInOut) () sineInOut) () .sineInOut)sineInOut) () sineInOut)() ] }).start();

    Online demo:
    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:
    Github :https://github.com/AlloyTeam/AlloyTouch/tree/master/transformjs
    

     

    1.本站遵循行业规范,任何转载的稿件都会明确标注作者和来源;2.本站的原创文章,请转载时务必注明文章作者和来源,不尊重原创的行为我们将追究责任;3.作者投稿可能会经我们编辑修改或补充。

    相关文章
    • 和transformjs一起摇摆 - 【当耐特】

      和transformjs一起摇摆 - 【当耐特】

      2016-12-01 18:00

    • 移动Web利器transformjs入门 - 【当耐特】

      移动Web利器transformjs入门 - 【当耐特】

      2016-11-30 12:00

    • 网页热力图 heatmap js - GoneWithWind

      网页热力图 heatmap js - GoneWithWind

      2016-06-29 14:00

    • Java Swing快速构建窗体应用程序 - JackWang-CUMT

      Java Swing快速构建窗体应用程序 - JackWang-CUMT

      2015-11-22 19:07

    网友点评