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

tweedle.js

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tweedle.js

Tweedle.js is a fork of tween.js made to fit my needs.

  • 2.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4K
decreased by-10.8%
Maintainers
1
Weekly downloads
 
Created
Source

Tweedle.js

npm i tweedle.js

What is a tween?

A tween is an easy way to animate something. You tell a property to be at a certain value after so many seconds and look at it go!

API documentation

Source code

How do I use this?

If you are on the browser, use the umd package and use the global TWEEDLE to find what you need (or the es modules if you understand that kind of black magic). If you are using npm you can import just what you need (we also have typescript support out of the box).
The overall syntax is this:

const myObject = { x:0, y:0 };
new Tween(myObject).to({ x:100, y:100 }, 2500).start();

You can probably see that tweens are meant to be chain called and all functions return themselves so you can keep

But that's only half the trouble as Tweedle won't move time forward on itself. See, every tween that you don't assign a group, it belongs to the shared group and you must remember to update that group for your tweens to work.

const tweenLoop = () => {
	Group.shared.update();
	requestAnimationFrame(tweenLoop);
}
tweenLoop();

Easings, Interpolations, Events, Chains, Deep objects, and more!

Tweedle supports all of Robert Penner easing functions, has Interpolation for bezier curves, colors and rotations, fires events onStart, onUpdate, onLoop, onEnd, can chain tweens so they start right after the previous one ends, allows to modify deep properties of objects and many more features that I need to write demos and tests for.
Feel free to dive the API documentation and read more there since all functions are documented.

Helping Tweedle

Tweedle uses Jest for testing and I was considering using PixiJS to do some demos.
I am releasing this right now as is since it is quite functional and stable even when I don't have the tests to prove so.
Feel free to send me your demos or tests (even if the tests fail and you can't put the effort to make it pass, I still find that valuable!)


Tweedle.js is my fork of tween.js made with ♥ to fit my needs at Killabunnies.

Keywords

FAQs

Package last updated on 05 Apr 2023

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