npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@ibm/motion

v0.3.1

Published

motion definitions for IBM

Downloads

24

Readme

IBM motion

This package includes various tools to help with applying motion to user interfaces.

Introduction

Designing and applying consistent motion for a system of components, pages or interfaces, and / or across multiple platforms can be challenging. What makes things even more challenging is the fact that most of these experiences are also dynamic and responsive.

Motion in interface design is defined by many things such as the property that is being animated, path, choreography - this package primarily addresses two very fundamental elements that directly impacts the quality of a motion - the acceleration curve (AKA easing, timing), and the duration of the motion.

Core concepts

Motion modes

This package recognizes that there is a need for multiple types of motion for different moments. Currently it supports two type of motions for different moments - the productive motion that is efficient and quick, ideal for micro interactions, and the expressive motion for more conversational exprience. Much attention has been given to maintaining consistency between these two modes - even though they use different acceleration curves and different duration, they feel the same.

Dynamic duration

The duration should change depending on the distance (or the amount of scaling or fading). The duration also should be influenced by the size of the element - a larger element should slow down a bit. This package supports both. Furthermore, this package uses a non-linear algorithm when calculating the duration that makes an element move slightly faster when the distance is larger to maintain perceived consistency.


Warning: IBM Motion is in development and things may change. Look out for a stable release later this year (2018).

Installation and build

$ npm install @ibm/motion

Demo site

This package includes a simple demo site.

$ npm install
$ gulp
$ npm start

Guidelines

Note: detailed motion guide will be published with the aforementioned stable release.

Transition timing function classes (easing)

This package provides classes that sets the transition-timing-function and transition-duration rules on your element.

Motion generator

A tool to make it easy to use IBM Motion is available at: https://ibm.github.io/motion/

|---|---|---|

JavascriptcComponents of this package

getDuration() method

Calculate recommended duration based on various factors including distance, size.

import getDuration from '@ibm/motion/getDuration.js';
console.log(getDuration(
	200, // distance of motion in pixels
	20, // size (area) of the element being animated. set to 20 for the standard size
	'move', // property. 'move', 'scale', 'fade'
	'mechanical', // motion mode. 'natural', 'mechanical'
	'easeInOut', // easing. 'easeInOut', 'easeIn', 'easeOut'
	7 // motion definition version. supports 6 and 7
));

// returns a float value, duration in ms.

getCurve() method

Calculate recommended bezier curve based on various factors including distance, size.

import getCurve from '@ibm/motion/getCurve.js';
console.log(getCurve(
	200, // distance of motion in pixels
	20, // size (area) of the element being animated. set to 20 for the standard size
	'move', // property. 'move', 'scale', 'fade'
	'mechanical', // motion mode. 'natural', 'mechanical'
	'easeInOut', // easing. 'easeInOut', 'easeIn', 'easeOut'
	7 // motion definition version. supports 6 and 7
));

// returns a string value - the cubic-bezier curve definition for the CSS `transition-timing-function` rule.

getMotion() method

Generate a full JavaScript object that contains durations and curves based on various factors including distance, size.

import getMotion from '@ibm/motion/getMotion.js';
console.log(getMotion(
	200, // distance of motion in pixels
	20, // size (area) of the element being animated. set to 20 for the standard size
	'move', // property. 'move', 'scale', 'fade'
	'mechanical', // motion mode. 'natural', 'mechanical'
	'easeInOut', // easing. 'easeInOut', 'easeIn', 'easeOut'
	7 // motion definition version. supports 6 and 7
));

// returns an object that contains both the duration and curve, as well as a few other informations about the motion.

Motion Classes

This package includes classes for easier implementation of IBM motions.

Transition timing function classes (easing)

These classes follow this pattern:

ibm-motion-[motion mode:expr|prod]-[property:move|scale|rotate|fade]-[ease-in-out|ease-in|ease-out]

Examples:

ibm-motion-expr-move-ease-in-out

Transition duration classes

These classes allow you to simply use classes to approximate the dynamic duration instead of using the JavaScript function to calculate on the fly.

The classes for move use distance of the travel and follow this pattern:

ibm-motion-[motion mode:expr|prod]-[property:move|scale|fade|rotate]-dur-[distance steps:10|25|50|75|100|200|400|800|1600|3200]

The classes for fade use amount of opacity change and follow this pattern:

ibm-motion-[motion mode:expr|prod]-[property:move|scale|fade|rotate]-dur-[distance steps:25|50|75|100]

The classes for rotate use amount of angle change and follow this pattern:

ibm-motion-[motion mode:expr|prod]-[property:move|scale|fade|rotate]-dur-[distance steps:30|60|90|120|150|180|270|360]

The classes for scale uses the size change as the differentiator and follows this pattern:

ibm-motion-[motion mode:expr|prod]-[property:move|scale|fade|rotate]-dur-[width*height steps:64|256|1024|4096|16384|65536|262144|1048576|4194304|16777216]