Skip to content

Instantly share code, notes, and snippets.

@terrierscript
Created August 30, 2016 13:51
Show Gist options
  • Select an option

  • Save terrierscript/f15b74ffb5db80aa219960f2e4513f95 to your computer and use it in GitHub Desktop.

Select an option

Save terrierscript/f15b74ffb5db80aa219960f2e4513f95 to your computer and use it in GitHub Desktop.
esnextbin sketch
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>ESNextbin Sketch</title>
<!-- put additional styles and scripts here -->
</head>
<body>
</body>
</html>
import { StyleSheet, css } from 'aphrodite'
import { animate } from 'keyshond'
import React from 'react'
import ReactDom from 'react-dom'
const animationProps = animate({
opacity: [0.5, 1],
transform: ['scale(0.5)', 'scale(1)']
}, {
duration: 500,
iterations: Infinity,
direction: 'alternate',
})
const style = StyleSheet.create({
item: {
...animationProps,
padding: 10,
fontSize: "2em",
width: "200px"
}
})
const AnimateItem = () => {
return <div className={css(style.item)}>Hello</div>
}
ReactDom.render(
<AnimateItem/>,
document.body.appendChild(document.createElement('div'))
)
{
"name": "esnextbin-sketch",
"version": "0.0.0",
"dependencies": {
"aphrodite": "0.5.0",
"keyshond": "0.0.1",
"react": "15.3.0",
"react-dom": "15.3.0",
"babel-runtime": "6.11.6"
}
}
'use strict';
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _aphrodite = require('aphrodite');
var _keyshond = require('keyshond');
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _reactDom = require('react-dom');
var _reactDom2 = _interopRequireDefault(_reactDom);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var animationProps = (0, _keyshond.animate)({
opacity: [0.5, 1],
transform: ['scale(0.5)', 'scale(1)']
}, {
duration: 500,
iterations: Infinity,
direction: 'alternate'
});
var style = _aphrodite.StyleSheet.create({
item: (0, _extends3.default)({}, animationProps, {
padding: 10,
fontSize: "2em",
width: "200px"
})
});
var AnimateItem = function AnimateItem() {
return _react2.default.createElement(
'div',
{ className: (0, _aphrodite.css)(style.item) },
'Hello'
);
};
_reactDom2.default.render(_react2.default.createElement(AnimateItem, null), document.body.appendChild(document.createElement('div')));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment