first commit

main
Luna 2021-07-27 18:30:48 -07:00
parent cc77e77c24
commit ebde3ee9c2
6 changed files with 72 additions and 0 deletions

17
index.html Normal file
View File

@ -0,0 +1,17 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Sketch</title>
<link rel="stylesheet" type="text/css" href="style.css">
<script src="libraries/p5.min.js"></script>
</head>
<body>
<script src="sketch.js"></script>
</body>
</html>

7
jsconfig.json Normal file
View File

@ -0,0 +1,7 @@
{
"include": [
"*.js",
"libraries/*.js",
"/home/luna/.vscode-oss/extensions/samplavigne.p5-vscode-1.2.7/p5types/global.d.ts"
]
}

3
libraries/p5.min.js vendored Normal file

File diff suppressed because one or more lines are too long

3
libraries/p5.sound.min.js vendored Normal file

File diff suppressed because one or more lines are too long

34
sketch.js Normal file
View File

@ -0,0 +1,34 @@
let ma;
function setup() {
createCanvas(windowWidth, windowHeight, WEBGL);
ma = atan(cos(QUARTER_PI));
}
function draw() {
background(100);
rotateX(-ma);
rotateY(-QUARTER_PI);
let gap = 5 + sin(millis() / 500) * 15
let colorMap = map(gap, -10, 20, 20, 40)
translate(-(gap + 40) * 4.5, -(gap + 50) * 4.5, -(gap + 40) * 4.5);
for (let x = 0; x < 10; x++) {
push()
for (let y = 0; y < 10; y++) {
push()
for (let z = 0; z < 10; z++) {
noStroke()
fill(x * colorMap, y * colorMap, z * colorMap)
box(20)
translate(0, 0, 35 + gap)
}
pop()
translate(0, 35 + gap, 0)
}
pop()
translate(35 + gap, 0, 0)
}
}

8
style.css Normal file
View File

@ -0,0 +1,8 @@
html, body {
margin: 0;
padding: 0;
}
canvas {
display: block;
}