Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 1,000,000+ packages pre-installed, including postcss-easings with all npm packages installed. Try it out:

require("postcss/package.json"); // postcss is a peer dependency. var postcssEasings = require("postcss-easings")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

postcss-easings v3.0.1

PostCSS plugin to replace easing names to cubic-bezier()

PostCSS Easings

PostCSS plugin to replace easing name from easings.net to cubic-bezier().

.snake {
  transition: all 600ms ease-in-sine;
}
.camel {
  transition: all 600ms easeInSine;
}
.snake {
  transition: all 600ms cubic-bezier(0.47, 0, 0.745, 0.715);
}
.camel {
  transition: all 600ms cubic-bezier(0.47, 0, 0.745, 0.715);
}

Sponsored by Evil Martians

Usage

Step 1: Install plugin:

npm install --save-dev postcss postcss-easings

Step 2: Check you project for existed PostCSS config: postcss.config.js in the project root, "postcss" section in package.json or postcss in bundle config.

If you do not use PostCSS, add it according to official docs and set this plugin in settings.

Step 3: Add the plugin to plugins list:

module.exports = {
  plugins: [
+   require('postcss-easings'),
    require('autoprefixer')
  ]
}

Also you can get all build-in easings:

require('postcss-easings').easings;

Options

easings

Allow to set custom easings:

    require('postcss-easings')({
      easings: { easeJump: 'cubic-bezier(.86,0,.69,1.57)' }
    })

Plugin will convert custom easing name between camelCase and snake-case. So example below adds easeJump and ease-jump easings.

Custom easing name must start from ease and contain only letters and -.

You can create custom easing on cubic-bezier.com.

Metadata

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free