-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathmain.js
46 lines (39 loc) · 792 Bytes
/
main.js
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
let video;
let image;
let angle = 0;
function setup() {
video = createVideo(['assets/mcu-wave.mp4']);
video.elt.muted = true;
video.loop();
video.hide();
image = loadImage('assets/background.jpg')
createCanvas(800, 600, WEBGL);
}
function drawBoxWithVideo(){
texture(video);
box(200, 200, 200);
}
function drawBoxWithImage(){
texture(image);
box(200, 200, 200);
}
function drawCustomShap(){
background('rgb(100, 100, 100)');
fill(0)
//texture(image);
beginShape();
vertex(0, 0, 50, 0, 0);
vertex(100, 0, 50, 1, 0);
vertex(100, 100, 50, 1, 1);
vertex(0, 100, 50, 0, 1);
endShape(CLOSE);
}
function draw() {
rotateZ(0);
rotateX(0.5);
rotateY(angle * 0.1);
//drawBoxWithImage();
drawBoxWithVideo();
//drawCustomShap();
angle += 0.05;
}