-
Notifications
You must be signed in to change notification settings - Fork 4
/
index.html
74 lines (62 loc) · 1.84 KB
/
index.html
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
68
69
70
71
72
73
74
<html>
<head>
<meta charset="UTF-8">
<title>React Transition example</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.12.0/react.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.12.0/JSXTransformer.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.4.11/d3.min.js" charset="utf-8"></script>
<script src="dist/react-transition.js" charset="utf-8"></script>
<style>
div {
font-family: Helvetica, sans-serif;
font-size: 11pt;
}
.boundingBoxStyle {
border-radius: 4px;
background-color: rgb(240, 240, 232);
position: relative;
margin: 5px 3px 10px;
width: 450px;
height: 50px;
}
.block {
position: absolute;
width: 50px;
height: 50px;
border-radius: 4px;
background-color: rgb(130, 181, 198);
}
#content1 {
margin-left: 10px;
}
</style>
</head>
<body>
<div id="content"></div>
<script type="text/jsx">
/** @jsx React.DOM */
var App = React.createClass({
getInitialState: function () {
return {
left: 0
};
},
handleTweenClick: function () {
this.setState({ left: this.state.left === 400 ? 0 : 400 });
},
render: function () {
return (
<div style={{padding: 10}}>
<div><button onClick={this.handleTweenClick}>Tween Me</button></div>
<div className="boundingBoxStyle">
<ReactTransition component="div" ease="bounce" duration="1000" className="block" style={{ left: this.state.left }}/>
</div>
</div>
);
}
});
React.render(<App/>, document.querySelector('#content'));
</script>
<p>Example based on <a href="https://github.com/chenglou/react-tween-state">react-tween-state</a></p>
</body>
</html>