-
Notifications
You must be signed in to change notification settings - Fork 10
/
index.html
66 lines (60 loc) · 2.19 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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8"></meta>
<title>LocoMotion</title>
<link href="style.css" rel="stylesheet" type="text/css"/>
</head>
<body onLoad="window.doLaunch()">
<script type="module">
import * as LocoMotion from "./locoMotion.js";
window.doLaunch = function () {
var cvs = document.getElementById('canvas');
window.lm = new LocoMotion.LocoMotion(cvs);
window.lm.define({zone:0, time:Date.now()/1000.0, text:""});
window.requestAnimationFrame(animate);
}
function animate() {
window.requestAnimationFrame(animate);
var t = Date.now()/1000.0;
window.lm.preRender({canDraw:true, nowTime:t});
window.lm.render({zone:0, canDraw:true, nowTime:t});
window.lm.postRender({canDraw:true, nowTime:t});
}
window.doEval = function () {
var t = document.getElementById("editorArea").value;
var r = window.lm.define({zone:0, time:Date.now()/1000.0, text:t});
document.getElementById('errors').textContent = r.error;
}
window.addEventListener('keydown', function (e) {
e = e || window.event;
if(e.shiftKey && e.key=="Enter") {
e.preventDefault();
window.doEval();
}
});
</script>
<div id="canvasDiv"><canvas id="canvas"></canvas></div>
<div class="editorAndStatus">
<div class="editor">
<textarea class="editorArea" id="editorArea">-- Welcome to LocoMotion
-- A live coding language for dance, choreography, motion, etc
-- Type programs here and click the "Eval" button to make them go
-- This is a rapidly emerging work in progress - check back often for updates
-- Or get in touch on the Estuary discord server!
-- More info here: https://github.com/dktr0/LocoMotion#readme
-- The lines below are a valid LocoMotion program - just press shift-Enter to evaluate!
-- And then you can make changes and press shift-Enter to re-evaluate!
dancer { url="lisa.glb", size = 0.5, x = -3 };
dancer { url="mark.glb", size = 0.5, x = 3 };
dancer { url="benny.glb", size = 0.5, x = -2 };
dancer { url="StoneFigure.glb", x = -2, z = -2, ry=3.14, size=0.5 }
</textarea>
</div>
<div class="status">
<!-- <button onClick="doEval()">eval</button> -->
<span id="errors"></span>
</div>
</div>
</body>
</html>