xxxxxxxxxx
let sdf;
function setup() {
createCanvas(1112, 834, WEBGL);
pixelDensity(2); // increase for higher quality, decrease for speed
// `createShaderPark` takes in a function that defines a shape using
// the Shader Park API available here:
// https://docs.shaderpark.com/references-js/
sdf = createShaderPark(shaderParkCode, {
scale: .7, // Adjust the scale of the scene if needed
drawGeometry: () => sphere(140) // Draw just a single sphere
});
}
function draw() {
background(255); // Set background to white
noStroke();
orbitControl(); // Allow interactive camera control
// Rotate the scene for animation
rotateY(frameCount * 0.01);
scale(3); // Scale the sphere for a better view
push();
sdf.draw(); // Draw the Shader Park scene (which is just the sphere)
pop();
}
function keyPressed(){
save("img_" + month() + '-' + day() + '_' + hour() + '-' + minute() + '-' + second() + ".jpg");
}