Creative Computation

Exploring the intersection of art, technology, and algorithmic creativity.

Differences between JS versus CSS+HTML

JS
function setup() { let canvas = createCanvas(200, 100); // Asetetaan kanvaasin koko
canvas.parent('p5-sketch'); // Liitetään canvas sketch-containeriin
noLoop();
}
function draw() {
let grayScales = [170, 187, 204, 221]; // Harmaan sävyt
let columnWidth = 30;
let columnHeight = 50;
for (let i = 0; i < grayScales.length; i++) {
fill(grayScales[i]); // Asettaa täyttövärin
rect(i * (columnWidth + 10), 25, columnWidth, columnHeight); // Piirtää neliöt, jossa 5 px väli
}
}

div class="sketch-container" id="p5-sketch"

CSS
.column { width: 30px; height: 50px; margin: 5px; border: 1px solid #000; }