-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
67 lines (61 loc) · 1.35 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
const StyleRoot = Radium.StyleRoot; // for online ide
import {StyleRoot} from 'radium';
// Animations of component
const animations = {
rotate: Radium.keyframes({
'0%': {
fill: 'tomato',
transform: 'rotate(0deg) scale(0.5)',
transform: 'scale(0.5)'
},
'50%': {
fill: 'gold',
transform: 'rotate(180deg) scale(1)',
},
'100%': {
fill: 'tomato',
transform: 'rotate(360deg) scale(0.5)',
}
})
}
// Styling of component
const styles = {
svg: {
fillRule: "evenodd",
clipRule: "evenodd",
strokeLinejoin: "round",
strokeMiterlimit: 1.5,
width: "150px"
},
rect: {
transformOrigin: "50% 50%",
animation: 'x 20s linear infinite',
animationName: animations.rotate
},
wrap: {
display: "flex",
flexDirection: "column",
alignItems: "center",
marginTop: "25vh"
},
}
const App = Radium(React.createClass({
render: function() {
return (
<div style={styles.wrap}>
<svg style={styles.svg}>
<rect style={styles.rect} x="25" y="25" width="100" height="100"/>
</svg>
</div>
)
}
}))
ReactDOM.render(
<StyleRoot>
<App />
</StyleRoot>
,document.querySelector('#app') // for online ide
,document.getElementById('root')
)
// reference
// https://codepen.io/simonbreiter/pen/aBqLOq