Giter Club home page Giter Club logo

motion's Introduction

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 experience. 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/

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

JavaScript Components 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'
	'rem', // unit. supports 'rem' and 'px'. default is 'rem'
    16 // unit size in pixel. default is 16.
));

// 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'
	'rem', // unit. supports 'rem' and 'px'. default is 'rem'
    16 // unit size in pixel. default is 16.
));

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

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]

motion's People

Contributors

kant avatar seejamescode avatar shixiedesign avatar wonilsuh avatar wonilsuhibm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

motion's Issues

add move() method

For easier application of motion.

.move(element, property, distance, size, ...);

Expressive Motion (UI)

Expressive Motion (UI) dose not provide correct Easing: cubic-bezier parameters, it mixed up with "Ease in" and "Ease out" between.

In Design System

motion(exit, expressive) cubic-bezier(0.4, 0.14, 1, 1)
motion(entrance, expressive) cubic-bezier(0, 0, 0.3, 1)

But in generator
Ease out: Easing: cubic-bezier(0, 0, 0.3, 1)
Ease in: Easing: cubic-bezier(0.4, 0.14, 1, 1)

Dist broken?

Hi there,

I'm trying to use do import getCurve from '@ibm/motion/getCurve.js'; from the dist build but it looks like the build is broken. It's referencing the files ./constants.js and ./getMotion.js which are not available in the dist build:
https://github.com/IBM/motion/blob/master/dist/index.js#L15-L21
https://github.com/IBM/motion/blob/master/dist/getCurve.js#L11-L13

I'm not too familiar with gulp and browserify unfortunately so can't point out exact what's broken in the build pipeline.

The exact error I'm getting is:

These relative modules were not found:

* ./getMotion.js in ./~/@ibm/motion/dist/index.js
* ./constants.js in ./~/@ibm/motion/dist/index.js, ./~/@ibm/motion/dist/getCurve.js
* ./constants in ./~/@ibm/motion/dist/getDuration.js
* ./helpers in ./~/@ibm/motion/dist/getDuration.js

Add CSS components

So that curves can be applied at css level without having to call the getCurve() method.

Punctuation

Just change IBM motion to IBM Motion wherever stated.

Remove Babel as a dependency

Before a commit is made, the dist files should be compiled with Babel.

That will remove any non-dev dependencies.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.