-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
53 lines (53 loc) · 1.76 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
<!DOCTYPE html>
<html lang="en">
<head>
<script src="//d3js.org/d3.v4.js"></script>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="jquery/jquery-ui.structure.min.css">
<link rel="stylesheet" href="jquery/jquery-ui.theme.min.css">
<link rel="stylesheet" href="styles.css">
<script src="//code.jquery.com/jquery-1.12.4.js"></script>
<script src="jquery/plugins/jquery-resizable.min.js"></script>
<script src="kinetic.js"></script>
<title>Animated Moving Line</title>
</head>
<body>
<div id="resizable" class="ui-widget-content">
<h4 class="ui-widget-header">Resizable</h4>
<div class="ui-resizable-handle ui-resizable-e"></div>
<div class="ui-resizable-handle ui-resizable-s"></div>
<div class="ui-resizable-handle ui-resizable-se ui-icon ui-icon-gripsmall-diagonal-se"></div>
</div>
<script>
function px2Int(px) {
var regex = /(\d+)/g;
return parseInt(px.match(regex)[0]);
}
jQuery(document).ready(function () {
var canvas = d3.select("#resizable")
.append("svg")
.attr("id", "canvas")
.attr("width", "100%")
.attr("height", "92%");
jQuery("#resizable").resizable({
handleSelector: ".ui-resizable-handle",
onDragEnd: function (e, $el, opt) {
var width = px2Int($el.css("width"));
var height = px2Int($el.css("height"));
Kinetic.animateWidth = width;
Kinetic.animateHeight = height - 25;
canvas.transition()
.attr("width", width + "px")
.attr("height", (height - 25) + "px");
}
});
});
jQuery("#canvas").ready(function () {
Kinetic.timeoutLoop(function () {
Kinetic.animate();
}, Kinetic.animateReps, Kinetic.animateDelay);
});
</script>
</body>
</html>