12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- /**
- * Created by admin on 2018-06-14.
- */
- import { TimelineLite, Sine, TweenMax,Power0 } from './TweenMax.min'
- var em = {};
- em.bumpToY = function (obj, time, addScale, returnFunc) {
- var originScale = obj.scale.y;
- TweenMax.to(obj.scale, time, {ease:Power0.easeNone, y:originScale + addScale, onComplete:(function () {
- TweenMax.to(obj.scale, time, {ease:Power0.easeNone, y:originScale, onComplete:(function () {
- if(returnFunc) returnFunc();
- }).bind(this)});
- }).bind(this)});
- };
- em.bumpFromToX = function (obj, time, minScale, maxScale, endScale, returnFunc) {
- TweenMax.fromTo(obj.scale, time, {x:minScale}, {x:maxScale, onComplete:(function () {
- TweenMax.to(obj.scale, time/2, {x:endScale, onComplete:(function () {
- if(returnFunc) returnFunc();
- }).bind(this)});
- }).bind(this)});
- }
- em.floatByY = function (obj, time, dist, repeatTime, returnFunc) {
- var originY = obj.y;
- (function upTween() {
- TweenMax.to(obj, time*0.25, {ease:Power0.easeNone, y:originY - dist, onComplete:downTween.bind(this)});
- })();
- function downTween() {
- TweenMax.to(obj, time*0.5, {ease:Power0.easeNone, y:originY + dist, onComplete:originTween.bind(this)});
- }
- function originTween() {
- TweenMax.to(obj, time*0.25, {ease:Power0.easeNone, y:originY, onComplete:(function () {
- if(repeatTime >= 1) {
- repeatTime--;
- em.floatByY(obj, time, dist, repeatTime, returnFunc);
- }
- else if(returnFunc) returnFunc();
- }).bind(this)});
- }
- }
- export default em;
|