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

additive

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

additive

Additive animations the MVVM way

  • 0.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

NOTE: This is a WIP (work in progress). Please refer to the github repo

additive

Additive animations the MVVM way

Install

$ npm install additive --save

Usage

First you require the bits and bobs:

var additive = require('additive');

Then you make a viewmodel, specifying the initial model value:

var value = additive.make({
  model: 0,
});

Then you can trigger a transition with:

// @NOTE: this function mutates the viewmodel
additive.animate(value, { to: 100 });

And get the current state with:

var state = additive.render(value);

Interpolation

Every viewmodel does contain an interpolation schema alongside the model. Note that interpolation schema is different from easing function, as interpolation schema is a property of the model, while easing function is a property of transition between two model values.

By default the model is considered to be a single linear number. additive provides several built-in interpolation schemas and means to compose compound schemas.

Built-in schemas:

  • Linear (linear space)
  • Spinor (surface of the circle, for 2D rotations)
  • [@TODO] Quaternions (surface of the sphere, for 3D rotations)
  • [@TODO] Color (color spaces)

Schema composition:

  • Object of schemas: { length: linear.schema, angle: spinor.schema }
  • Array of schemas: [ linear.schema, spinor.schema ]
  • Bag: composite.bag(linear.schema)
  • List: composite.list(linear.schema)

Easing

When applying a transition you can also specify an easing function to be used for this transition.

Default easing is a fast approximation of the default CSS easing. additive does not provide any built-in easing functions except for the default one. You can write your own easing functions or use existing modules.

Examples

You can find examples in the examples folder.

Running tests

$ npm run lint
$ npm run test

API

@TODO

License

ISC

Keywords

FAQs

Package last updated on 13 Nov 2015

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