-
Notifications
You must be signed in to change notification settings - Fork 49
/
morphic.html
executable file
·51 lines (43 loc) · 1.44 KB
/
morphic.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
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Morphic!</title>
<script type="text/javascript" src="morphic.js"></script>
<script type="text/javascript">
var worldCanvas, world, hi, hint1, hint2;
window.onload = function () {
worldCanvas = document.getElementById('world');
world = new WorldMorph(worldCanvas);
// +++ world.worldCanvas.focus();
world.isDevMode = true;
hi = new StringMorph(
'Hello, World!', 48, 'serif');
hi.isDraggable = true;
hi.isEditable = true;
hi.setPosition(new Point(275, 200));
world.add(hi);
hint1 = new StringMorph(
'right click...', 20, 'serif');
hint1.isDraggable = true;
hint1.isEditable = true;
hint1.setPosition(new Point(350, 270));
world.add(hint1);
hint2 = new StringMorph(
'(or double touch)', 10, 'sans-serif');
hint2.isDraggable = true;
hint2.isEditable = true;
hint2.setPosition(hint1.bottomLeft());
world.add(hint2);
loop();
};
function loop() {
requestAnimationFrame(loop);
world.doOneCycle();
};
</script>
</head>
<body style="margin: 0;">
<canvas id="world" tabindex="1" width="800" height="600" style="position: absolute; left: 0px; right: 0px; width: 100%; height: 100%;" />
</body>
</html>