Git Product home page Git Product logo

jstween's Introduction

js tween

简单好用的tween类,api参考tweenmax。可对一般对象或者Dom对象使用。

API

全局tween方法

JT.get(target, param);
JT.set(target, params);
JT.fromTo(target, duration, fromParams, toParams);
JT.from(target, duration, fromParams);
JT.to(target, duration, toParams);
JT.kill(target, [toEnd]);
JT.killAll([toEnd]);
JT.pause(target);
JT.pauseAll();
JT.play(target);
JT.playAll();
JT.reverse(target);
JT.reverseAll();
JT.restart(target);
JT.restartAll();

param为字符串,
Params为数组,

其中几个属性比较特殊: ease设置缓动,
delay设置延时时间,
repeat设置重复次数,
repeatDelay设置每次重复的间隔延时时间,
yoyo设置重复时反向,
isPlaying设置是否立即播放,
onStart设置运动开始的返回函数,
onStartParams设置开始返回函数的参数,
onIteration设置运动循环中每个运动完成的返回函数,
onIterationParams设置运动完成返回函数的参数,
onEnd设置运动完成的返回函数,
onEndParams设置返回函数的参数
onUpdate设置每帧渲染时的返回函数,
onUpdateParams设置每帧渲染时返回函数的参数,

tween实例方法:

tween.play(); 播放
tween.pause(); 暂停
tween.reverse(); 倒播
tween.restart(); 重播
tween.kill([toEnd]); 删除,参数设置是否直接去到终点并出发onEnd

全局call方法

JT.call(delay, callback, callbackParams);
JT.killAllCalls();
JT.pauseAllCalls();
JT.playAllCalls();
JT.restartAllCalls();

call实例方法:

tween.play(); 播放
tween.pause(); 暂停
tween.restart(); 重播
tween.kill(); 删除

缓动类

JT.Linear
JT.Quad
JT.Cubic
JT.Quart
JT.Quint
JT.Sine
JT.Expo
JT.Circ
JT.Elastic
JT.Back
JT.Bounce

除了JT.Linear只有None一项,其他均有In,InOut,Out三项选择。

以上方法和参数均是参考TweenMax的方式,有使用经验者会很容易上手。

jstween's People

Contributors

shrekshrek avatar

Watchers

Mike Dai avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.