component-tween

WebJar for component-tween

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

component-tween
Last Version

Last Version

1.2.0
Release Date

Release Date

Type

Type

jar
Description

Description

component-tween
WebJar for component-tween
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/component/tween

Download component-tween

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/component-tween/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>component-tween</artifactId>
    <version>1.2.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/component-tween/
implementation 'org.webjars.npm:component-tween:1.2.0'
// https://jarcasting.com/artifacts/org.webjars.npm/component-tween/
implementation ("org.webjars.npm:component-tween:1.2.0")
'org.webjars.npm:component-tween:jar:1.2.0'
<dependency org="org.webjars.npm" name="component-tween" rev="1.2.0">
  <artifact name="component-tween" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='component-tween', version='1.2.0')
)
libraryDependencies += "org.webjars.npm" % "component-tween" % "1.2.0"
[org.webjars.npm/component-tween "1.2.0"]

Dependencies

compile (4)

Group / Artifact Type Version
org.webjars.npm » component-clone jar 0.2.2
org.webjars.npm : component-emitter jar 1.2.0
org.webjars.npm : component-type jar 1.1.0
org.webjars.npm » ease-component jar 1.0.0

Project Modules

There are no modules declared in this project.

tween

Motion tween component using ease.

Installation

$ component install component/tween

Example

var Tween = require('tween');
var raf = require('raf');
var button = document.querySelector('button');

var tween = Tween({ rotate: 0, opacity: 0 })
  .ease('out-bounce')
  .to({ rotate: 360, opacity: 1  })
  .duration(800);

tween.update(function(o){
  button.style.opacity = o.opacity;
  button.style.webkitTransform = 'rotate(' + (o.rotate | 0) + 'deg)';
});

tween.on('end', function(){
  animate = function(){};
});

function animate() {
  raf(animate);
  tween.update();
}

animate();

API

Tween(obj:Object|Array)

Initialize a new Tween with obj.

Tween#reset()

Reset the tween.

Tween#to(obj:Object|Array)

Tween to obj and reset internal state.

 tween.to({ x: 50, y: 100 })

Tween#duration(ms:Number)

Set duration to ms [500].

Tween#ease(fn:String|Function)

Set easing function to fn.

 tween.ease('in-out-sine')

Tween#update(fn:Function)

Set update function to fn or when no argument is given this performs a "step".

Tween#stop()

Immediately stop the tween and emit "stop" and end" events. tween.stopped is then marked as true.

License

MIT

org.webjars.npm

Components

modular components for component

Versions

Version
1.2.0