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

b-tween

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

b-tween

A simple but powerful tweening engine for Javascript.

  • 0.3.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
15K
decreased by-11.33%
Maintainers
1
Weekly downloads
 
Created
Source

b-tween

A simple but powerful tweening engine for Javascript.

Install

npm i b-tween

Usage

ES Module
import BTween from 'b-tween';
const tween = new BTween({
  from: {
    left: 0
  },
  to: {
    left: 700
  },
  duration: 500,
  easing: 'bounceOut',
  onUpdate: (keys) => {
    // You can do everything with keys
    block.style.left = keys.left + 'px';
  }
});
tween.start();
Commonjs
const BTween = require('b-tween');
...
Browser

https://unpkg.com/b-tween/dist/b-tween.umd.js

<script src="https://unpkg.com/b-tween/dist/b-tween.umd.js"></script>
<script>
  const tween = new BTween({
    ...
  });
  tween.start();
</script>

Api

new Tween(options)

options.from (object)
options.to (object)
options.duration (number)
options.delay (number)
options.easing (string)
  • linear
  • quadIn
  • quadOut
  • quadInOut
  • cubicIn
  • cubicOut
  • cubicInOut
  • quartIn
  • quartOut
  • quartInOut
  • quintIn
  • quintOut
  • quintInOut
  • sineIn
  • sineOut
  • sineInOut
  • bounceIn
  • bounceOut
  • bounceInOut
options.onStart ( function(keys) {} )
options.onUpdate ( function(keys) {} )
options.onFinish ( function(keys) {} )

Start Animation

const tween = new Btween({...});
tween.start();

LICENSE

MIT © PengJiyuan

Keywords

FAQs

Package last updated on 24 Jul 2019

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