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

primrose-tween

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

primrose-tween

Small Tweening Library.

  • 1.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

primrose-tween

A tiny (~4KB) and versatile tweening library for JavaScript/TypeScript. This library was built to be usable both with Node and for web-based applications.

Quickstart

To quickly begin using Primrose for web-based applications, clone this repository and add the primrose.min.js file to your project. To access the API, simply add the script to the required HTML file.

<script type="text/javascript" src="path/to/primrose.min.js"></script>

Otherwise Primrose can be installed via NPM:

npm install --save primrose-tween

And included in a project as needed:

import { Primrose } from 'primrose-tween'; // TypeScript
const { Primrose } = require('primrose-tween'); // JavaScript

Functionality

Below is the current functionality for Primrose tweening. Only the from and to options are required. All instance methods return a reference to the instance so they can be chained from creation. The auto factory is highly useful for generating auto-playing tweens, as well as the promisified create and auto methods.

import { Primrose } from 'primrose-tween';

const options = {
    from: { alpha: 0 },     // Initial Values (must be an object reference of numerics) [REQUIRED]
    to: { alpha: 1 },       // Final Values (same as `from`) [REQUIRED]
    duration: 2000,         // Animation Duration (defaulted to 2000ms)
    onUpdate: (val) => {},  // User specified update method where `val` is the current tween values
    onComplete: () => {}    // Callback after tween completion.
};

const instance = Primrose.start(opts); // Tween instance creator.
const autoInst = Primrose.auto(opts); // Pre-started instance.

instance.start(); // Starts the tween if not already started
instance.pause(); // Pauses the tween.
instance.reset(); // Resets the tween to its beginning.

License

Primrose is licensed under the MIT license.

Keywords

FAQs

Package last updated on 19 Feb 2022

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