-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
49 lines (46 loc) · 1.4 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
<!DOCTYPE html>
<html>
<head>
<title>Live Coding</title>
<style>
html{height:100%;width:100%;position:fixed;}
body{background:#ddd;height:100%;}
.column{float:left;width:48%;padding:1%;height:100%;}
#code, iframe{width:100%;height:100%;background:white;position:relative;}
</style>
</head>
<body>
<div class="column">
<canvas id="canvas" width="600" height="600">
</div>
<div class="column">
<div id="code"></div>
</div>
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="http://ajaxorg.github.com/ace/build/src/ace.js"></script>
<script src="http://croddin.github.io/livecoding/editor.js"></script>
<script>
function update(){
try{
var start = Date.now()
eval(editor.getSession().getValue())
resetRandom();
if( typeof drawScene === 'function'){
setTimeout(function(){
drawScene(document.getElementById('canvas'));
}, 1);
}
var end = Date.now()
console.log("Rendering:", end - start );
} catch(e){}
}
editor = ace.edit("code");
editor.setTheme("ace/theme/textmate");
editor.getSession().setMode("ace/mode/javascript")
editor.getSession().on('change', update);
$.get('tree.js',function(src){
editor.getSession().setValue(src);
})
</script>
</body>
</html>