-
Notifications
You must be signed in to change notification settings - Fork 0
/
specialRealitivity.html
30 lines (25 loc) · 1.15 KB
/
specialRealitivity.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
<html>
<head><title>stuff</title></head>
<body>
<script src="cake.js"></script>
<script>
var c = E.canvas(500, 500) // create a new canvas element
var canvas = new Canvas(c) // create a CAKE [Canvas] for the element
canvas.fill = [255,255,255,0.8] // set the Canvas background to 0.8 opacity white
canvas.clear = true // show the previous frame behind the current one
var rect = new Rectangle(100, 100) // create a CAKE [Rectangle] object
rect.x = 250 // move the Rectangle to (250, 250)
rect.y = 250
rect.fill = 'green' // fill the Rectangle with green color
// rotate the Rectangle on every frame
rect.addFrameListener(function(t) {
this.rotation = ((t / 3000) % 1) * Math.PI * 2
})
canvas.append(rect) // append the Rectangle to the Canvas
document.body.appendChild(c) // append the canvas element to document body
</script>
<!--<canvas id="canvas" width="800" height ="500" style="border:1px solid #000000; background-color: #000;">
Your browser does not support HTML5 Canvas.
</canvas>-->
</body>
</html>