xxxxxxxxxx
// by SamuelYAN
// more works //
// https://twitter.com/SamuelAnn0924
// https://www.instagram.com/samuel_yan_1990/
// learn from https://p5js.org/examples/arrays-array-objects.html
var ranges;
let seed = Math.random() * 1247;
var mySize, margin, grad;
let str_wei = 0;
// colors
let colors = ["#FF2C78", "#FFD400", "#A800D1", "#00D6CB"]; // New color set
let unit_x, unit_y;
let count;
let stop_count = 0;
let t = 0;
let mods = [];
function setup() {
randomSeed(seed);
createCanvas(1920, 1080); // Set canvas size to 1920x1080px
colorMode(RGB, 100);
background(0); // Set background to black
t = rez = c = n = 0.001;
xOff = 0;
yOff = 0;
}
function draw() {
randomSeed(seed);
background(0); // Ensure the background is black in every frame
let plus = 20; // Adjusted the increment to better fit the canvas size
for (let i = xOff; i < width - xOff; i += plus) {
strokeWeight(random(0.1));
var n = noise(i * rez + t);
// Select random color for stroke and fill from the new set of colors
let currentColor = random(colors);
let col = color(currentColor);
let r = red(col);
let g = green(col);
let b = blue(col);
// Applying higher transparency for stroke and fill
stroke(r, g, b, n * 150); // Lowered the alpha to make it more luminous
fill(r, g, b, n * 150); // Lowered the alpha further for fill
push();
translate(i, n);
rect(0, height, plus, -n * height);
pop();
}
// Slowing down the animation
t += 0.00005; // Reduced speed of 't' increment
rez += 0.000005; // Reduced speed of 'rez' increment
}
function keyTyped() {
if (key === "s" || key === "S") {
saveCanvas("1D Noise", "png");
}
}