evoke-js/3.js
2024-08-17 20:23:26 +02:00

39 lines
663 B
JavaScript

const black = '#1a181a';
const white = '#e5c463';
let width = window.innerWidth;
let height = window.innerHeight;
let video;
let playing = false;
function setup() {
createCanvas(width, height, WEBGL);
video = createVideo(['sun.webm']);
video.hide();
noFill();
noStroke();
}
function draw() {
background(0);
if (!playing) {
return;
}
// Draw the first instance of the video in the canvas.
push();
rotateWithFrameCount();
texture(video);
sphere(400);
pop();
}
function mousePressed() {
video.loop();
playing = true;
}
// Rotate 1 degree per frame along all three axes
function rotateWithFrameCount() {
rotateY(frameCount / 1000);
}