-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest.html
50 lines (42 loc) · 804 Bytes
/
test.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
<script src="e3d.js"></script>
<style>
canvas {
width:50vw;
height:35vh;
}
</style>
<canvas id="view"></canvas>
<script>
// Get the screen to project to
const c = document.getElementById("view")
// The scene
const s = Scene(c)
// Sun image
let texture_sun = E3D.createImage("sun.png")
// Set canvas color
s.skycolor("#3388ff")
// Create the sun
let sun = s.addElement(E3D.render.IMAGE,{
x: 100,
y: -53,
width: 80,
height: 80,
image: texture_sun
})
// Create some text
let test_text = s.addElement(E3D.render.TEXT,{
x: 100,
y: 0,
size: 10,
text: "TEST"
})
// Game loop
let loop = requestAnimationFrame(function main() {
if(s.game_active) {
sun.y += 0.1
if(sun.y > 190) sun.y = -53
s.execute()
}
requestAnimationFrame(main)
})
</script>