Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@casualbot/tweenjs

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@casualbot/tweenjs

A derivative of the TweenJS from https://github.com/tweenjs/tween.js library that incorporates play and pause methods

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
increased by100%
Maintainers
1
Weekly downloads
 
Created
Source

Tween-Play-Pause

This is a derivative of the Tween.JS library by Sole on Github.com. For more documentation head over to their repository.

JavaScript tweening engine for easy animations, incorporating optimised Robert Penner's equations.

// Start position coordinates
var coords = { x: 0, y: 0 };

//Time tween will animate from start point to end point in milliseconds 
var duration = 1000; 

// End coordinates 
// End Position coords can also be an array of positions 
// var endX = [0, 100, 200, 300]; var endY = [0, 100, 200, 300];
// Ex:  .to({ x: endX, y: endY }, duration) ...

var endCoords = { x: 100, y: 100 };

var tween = new TWEEN.Tween(coords)
	.to(endCoords, duration)
	.onUpdate(function() {
	    //Show position of Tween
		console.log(this.x, this.y);
		//Animate the coords using x and y passed through
		coords.x = this.x;
		coords.y = this.y;
	})
	.start();

requestAnimationFrame(animate);

function animate(time) {
	requestAnimationFrame(animate);
	TWEEN.update(time);
}

//Play Tween
tween.play();

//Pause Tween
tween.pause();

Installation

Download the library and include it in your code:

<script src="js/Tween.js"></script>

More advanced users might want to...

Use npm
npm install tween-play-pause

Keywords

FAQs

Package last updated on 22 Jun 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc