Skip to content

Commit

Permalink
feat: improve fade out animations
Browse files Browse the repository at this point in the history
  • Loading branch information
streamich committed Mar 18, 2018
1 parent b30f612 commit 564ac3a
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 6 deletions.
4 changes: 3 additions & 1 deletion .storybook/animate.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ const {addon: addonKeyframes} = require('../addon/keyframes');
const animations = [
'fadeIn',
'fadeInDown',
'fadeInExpand',
'fadeInScale',
'fadeOut',
'fadeOutScale',
];

const nano = create();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ exports.addon = function (renderer) {
}

renderer.put('', {
'@keyframes fadeInExpand': {
'@keyframes fadeInScale': {
from: {
opacity: 0,
transform: 'scale(.95)'
Expand All @@ -18,8 +18,8 @@ exports.addon = function (renderer) {
}
},

'.fadeInExpand': {
animation: 'fadeInExpand .3s',
'.fadeInScale': {
animation: 'fadeInScale .3s',
}
});
};
23 changes: 23 additions & 0 deletions addon/animate/fadeOut.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
'use strict';

exports.addon = function (renderer) {
if (process.env.NODE_ENV !== 'production') {
require('../__dev__/warnOnMissingDependencies')('animate', renderer, ['keyframes']);
}

renderer.put('', {
'@keyframes fadeOut': {
from: {
opacity: 1,
},
to: {
opacity: 0,
}
},

'.fadeOut': {
animation: 'fadeOut .3s linear',
'animation-fill-mode': 'forwards',
}
});
};
21 changes: 21 additions & 0 deletions addon/animate/fadeOutScale.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
'use strict';

exports.addon = function (renderer) {
if (process.env.NODE_ENV !== 'production') {
require('../__dev__/warnOnMissingDependencies')('animate', renderer, ['keyframes']);
}

renderer.put('', {
'@keyframes fadeOutScale': {
to: {
opacity: 0,
transform: 'scale(.95)',
}
},

'.fadeOutScale': {
animation: 'fadeOutScale .3s linear',
'animation-fill-mode': 'forwards',
}
});
};
4 changes: 3 additions & 1 deletion docs/animations.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ name.

- `animate/fadeIn`
- `animate/fadeInDown`
- `animate/fadeInExpand`
- `animate/fadeInScale`
- `animate/fadeOut`
- `animate/fadeOutScale`

Read more about the [Addons Installation](./Addons.md#addon-installation).

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nano-css",
"version": "1.1.0",
"version": "1.2.0",
"description": "Smallest 5th gen CSS-in-JS library",
"main": "index.js",
"unpkg": "dist/nano-css.umd.min.js",
Expand Down

0 comments on commit 564ac3a

Please sign in to comment.