let colors = ["#ed3441", "#ffb03b", "#36acf5", "#ffd630", "#084e86", "#fcfeff"];
function setup() {
createCanvas(500,500);
}
function draw() {
background(200);
let offset = -width / 10;
noFill();
let xStep = (height + offset * 2) / 75;
for (let x= offset;x <= height - offset; x += xStep) {
let num = int(1 + 1.25 * noise(x/150, frameCount / 100));
let arr = [PI/8];
for (let i = 0; i < num; i++) {
let n = sq(sq(noise(x/ 10, frameCount / 200))) * (width - offset * 75);
n = max(n,1);
arr.push(n);
}
drawingContext.setLineDash(arr);
drawingContext.lineDashOffset = x- frameCount /10;
strokeWeight(xStep/0.8);
strokeCap(ROUND)
stroke(random(colors));
beginShape();
for(let y = offset ; y < width - offset; y += 5){
let nx = x +tan(y/330+x/300) * 150 * cos(frameCount/20) * sin(x/300);
vertex(y,nx );
}
endShape();
}
}
I don’t know how to static color on the colors = ["#ed3441", "#ffb03b", "#36acf5", "#ffd630", "#084e86", "#fcfeff"];
. It changes every frame on the array.
I know it can use colorMode(HSB)
to present, but the color is hard to be the picked hex color.
Does anyone know how to fix the color animation? ?
I mean I want array color to be my picked color.
Like the “colorMode” effect
How to do? ?
function setup() {
createCanvas(400,400);
colorMode(RGB);
}
function draw() {
background(200);
let offset = -width / 10;
noFill();
let xStep = (height + offset * 2) / 75;
for (let x= offset;x <= height - offset; x += xStep) {
let num = int(1 + 1.25 * noise(x/150, frameCount / 100));
let arr = [PI/8];
for (let i = 0; i < num; i++) {
let n = sq(sq(noise(x/ 10, frameCount / 200))) * (width - offset * 75);
n = max(n,1);
arr.push(n);
}
drawingContext.setLineDash(arr);
drawingContext.lineDashOffset = x- frameCount /10;
strokeWeight(xStep/0.8);
strokeCap(ROUND)
stroke(x-offset/40,300,30);
beginShape();
for(let y = offset ; y < width - offset; y += 5){
let nx = x +tan(y/330+x/300) * 150 * cos(frameCount/20) * sin(x/300);
vertex(y,nx );
}
endShape();
}
}