Retour au classement

webkul/micron

CSSwebkul.github.io/micron/

a [μ] microInteraction library built with CSS Animations and controlled by JavaScript Power

jsjavascriptjavascript-librarycsscss3css-animationscss-modulesanimation
Croissance des étoiles
Étoiles
2.3k
Forks
99
Croissance hebdomadaire
Issues
2
2.3k
18 juil.19 juil.19 juil.20 juil.
Artefactsnpmnpm install micron
README

Micron.JS

Check Interactive Doc on Website.


Introduction

Micron.JS is a micro interaction library which can be used to add Interactions to different DOM Elements. Micron.JS animates an element using CSS power and the interactive behaviours are controlled by JavaScript.

Micron.JS is easy to adapt and can bring interactions to life using html5 data attributes or a chain of JavaScript methods.

Getting Started

To get started with Micron.JS, you need to include both micron.min.css * (which have all ready to use interaction animations) and micron.min.js If you don't need all the available interactions, you can simply include the respective *.min.css file only.

Installation

Compiled CSS and JavaScript minified files can be directly linked from UNPKG CDN or Micron.JS can be included within your workflow using your favorite package managers as well.

Include both the Micron CSS and JavaScript files in the header section of your document.

<link href="https://unpkg.com/webkul-micron@1.1.6/dist/css/micron.min.css" type="text/css" rel="stylesheet">
<script src="https://unpkg.com/webkul-micron@1.1.6/dist/script/micron.min.js" type="text/javascript"></script>

Package Managers

You can use either npm or bower to get the Micron.JS package.

Copy and Paste the command below in your terminal to get package with npm -

npm install webkul-micron

Load the package with the code below:

const micron = require('webkul-micron');

Copy and Paste the command below in your terminal to get package with bower -

bower install webkul-micron

Usage

Micron JS is very easy and quick to use.

Adding an Interaction

Add the data-micron="interaction" attribute to the respective element and Voila! you are already there.

Example Code

<a href="#!" class="button" data-micron="bounce">Label</a>

Controlling Duration

Micron Interactions defaults to ".45" seconds. Add the data-micron-duration="number" attribute to control the duration of the defined interaction.

Example Code

<a href="#!" class="button" data-micron="bounce" data-micron-duration=".95">Label</a>

Controlling Timing or Ease

Micron Interactions defaults to "ease-in-out". Add the data-micron-timing="@type" attribute to control the easing of the defined interaction.

For now, @type only supports the easings mentioned below-

linear

ease-in

ease-out

ease-in-out

Example Code

<a href="#!" class="button" data-micron="bounce" data-micron-timing="ease-in">Label</a>

Bind Interaction

Add data-micron-bind="true" & data-micron-id="name" to the defined triggering element, and interaction will be applied to the element which reference to the defined id attribute.

Example Code

<a href="#!" class="button" data-micron="bounce" data-micron-bind="true" data-micron-id="me">Label</a>
<a href="#!" class="button" id="me">Binded</a>

Access inside JavaScript

Call micron chained methods to apply interactions to any DOM Element, right in your custom block of JavaScript Code.

micron.getEle("").interaction("").duration("").timing("");

Pass an argument with selector name which can either be id or a class to getEle() method.

Pass an argument with interaction name to interaction() method.

Pass an argument which is a number to duration() method.

Pass an argument with type of ease to timing() method.

Example Code

function myFunc(){
    micron.getEle("#me").interaction("bounce").duration(".45").timing("ease-out");
 }

//Call Interaction
myFunc();

Interactions

Currently, Micron.JS supports the interactions mentioned below, head back to the homepage to see all interactions in the real action.

data-micron="shake"

data-micron="fade"

data-micron="jelly"

data-micron="bounce"

data-micron="tada"

data-micron="groove"

data-micron="swing"

data-micron="squeeze"

data-micron="flicker"

data-micron="jerk"

data-micron="blink"

data-micron="pop"

Customization

You can even add your very own css interaction to Micron.JS.

First include the code mentioned below in your css file.

.mjs-linear{animation-timing-function:cubic-bezier(0,0,1,1)}.mjs-ease-in{animation-timing-function:cubic-bezier(.4,0,1,1)}.mjs-ease-out{animation-timing-function:cubic-bezier(0,0,.2,1)}.mjs-ease-in-out{animation-timing-function:cubic-bezier(.4,0,.2,1)}

Create a class with .mjs- prefix. Call the keyframe css animation inside it. Use the interaction with your class name without .mjs- prefix.

Example Code

 /*Define a Class*/
 .mjs-custom{
    animation: custom-action;
 }

 @keyframes custom-action{
    from { . . . }
    to { . . . }
 }

Now use interaction with data-micron="custom"

Credits

© Copyright 2018 Webkul Software, All rights reserved.

Dépôts similaires
nodejs/node

Node.js JavaScript runtime ✨🐢🚀✨

JavaScriptnpmOthernodejsjavascript
nodejs.org
118.3k36.2k
Asabeneh/30-Days-Of-JavaScript

30 days of JavaScript programming challenge is a step-by-step guide to learn JavaScript programming language in 30 days. This challenge may take more than 100 days, please just follow your own pace. These videos may help too: https://www.youtube.com/channel/UC7PNRuno1rzYPb1xLa4yktw

JavaScriptnpm30daysofjavascriptjavascript-for-everyone
46.6k10.5k
ueberdosis/tiptap

The headless rich text editor framework for web artisans.

TypeScriptnpmMIT Licensejsvue
tiptap.dev
37.7k3.1k
denysdovhan/wtfjs

🤪 A list of funny and tricky JavaScript examples

JavaScriptnpmDo What The F*ck You Want To Public Licensejavascriptspecification
bit.ly/wtfjavascript
37.7k2.7k
CopilotKit/CopilotKit

The Frontend Stack for Agents & Generative UI. React, Angular, Mobile, Slack, and more. Makers of the AG-UI Protocol

TypeScriptnpmMIT Licenseaillm
docs.copilotkit.ai
36.2k4.5k
ComposioHQ/composio

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

TypeScriptnpmMIT Licenseaipython
docs.composio.dev
29.3k4.7k
Asabeneh/30-Days-Of-React

30 Days of React challenge is a step by step guide to learn React in 30 days. These videos may help too: https://www.youtube.com/channel/UC7PNRuno1rzYPb1xLa4yktw

JavaScriptnpmchallengejavascript
27.5k7.7k
haizlin/fe-interview

前端面试每日 3+1,以面试题来驱动学习,提倡每日学习与思考,每天进步一点!每天早上5点纯手工发布面试题(死磕自己,愉悦大家),6000+道前端面试题全面覆盖,HTML/CSS/JavaScript/Vue/React/Nodejs/TypeScript/ECMAScritpt/Webpack/Jquery/小程序/软技能……

JavaScriptnpmMIT Licensefrontendinterview
h-camel.com
26.3k3.2k
zloirock/core-js

Standard Library

JavaScriptnpmMIT Licenseproposalpolyfill
core-js.io
25.5k1.7k
doczjs/docz

✍ It has never been so easy to document your things!

TypeScriptnpmMIT Licensedocsdocumentation
docz.site
23.7k1.5k
pedronauck/docz

✍ It has never been so easy to document your things!

TypeScriptnpmMIT Licensedocsdocumentation
23.6k1.4k
justadudewhohacks/face-api.js

JavaScript API for face detection and face recognition in the browser and nodejs with tensorflow.js

TypeScriptnpmMIT Licenseface-recognitionjavascript
17.9k3.9k