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.
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:
you can see it, due to the high abstraction of transformjs, can be easily used with tweenjs, without any pressure.
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.
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