Oh, that naughty sketch! Please let us know what the issue is below.
Apply Template
Applying this template will reset your sketch and remove all your changes. Are you sure you would like to continue?
Report Sketch
Report Comment
Please confirm that you would like to report the comment below.
We will review your submission and take any actions necessary per our Community Guidelines. In addition to reporting this comment, you can also block the user to prevent any future interactions.
Please report comments only when necessary. Unnecessary or abusive use of this tool may result in your own account being suspended.
Are you sure you want to delete your sketch?
Any files uploaded will be deleted as well.
Delete Comment?
This will also delete all the replies to this comment.
Delete this tab? Any code in it will be deleted as well.
Select a collection to submit your sketch
We Need Your Support
Since 2008, OpenProcessing has provided tools for creative coders to learn, create, and share over a million open source projects in a friendly environment.
Niche websites like ours need your continued support for future development and maintenance, while keeping it an ad-free platform that respects your data and privacy!
Please consider subscribing below to show your support with a "Plus" badge on your profile and get access to many other features!
"s" or "S" for save
A fork of dunes _ea by yokoul
CC Attribution NonCommercial ShareAlike
dunes _eb
xxxxxxxxxx
let col1, col2;
let cool1 = "https://coolors.co/c2efb3-97abb1-746f72-735f3d-594a26".split("/").pop().split("-").map((a) => "#" + a);
let cool11 = "https://coolors.co/f1fbee-c5d0d3-a5a1a4-b2986c-9d8243".split("/").pop().split("-").map((a) => "#" + a);
let cool2 = "https://coolors.co/e2dadb-dae2df-a2a7a5-6d696a-ffffff".split("/").pop().split("-").map((a) => "#" + a);
let cool21 = "https://coolors.co/f6f4f4-f4f6f5-cacecc-9b9798-c2c2c2".split("/").pop().split("-").map((a) => "#" + a);
let cool3 = "https://coolors.co/a63446-fbfef9-0c6291-000004-7e1946".split("/").pop().split("-").map((a) => "#" + a);
let cool31 = "https://coolors.co/ce6474-d0f3b9-129ae2-000066-cc2872".split("/").pop().split("-").map((a) => "#" + a);
//let gS = 5;
let pD = 2;
let ar = 1;
let x, y, xp, yp, xx, yy;
let drawBGCubes = true;
let sizeMod = 5;
let traceCubeLines = false;
let roundIt = false;
let squareIt = true;
let nos = false;
let nosh = true;
let nosColor = true;
let showCoord = false;
//noprotect
let birds = [];
let birdCount = 160;
let count = 0;
let poles = [];
let duneHeight = 300;
let duneCount = 5;
let dunes = [];
let phase = 0;
let cloudCount = 7;
let clouds = [];
let stormCloud, xcub, ycub;
let stormClouds = [];
let stormCloudCount = 3;
let gS = 55;
function setup() {
colorMode(HSB, 360, 100, 100, 100);
noLoop();
p5grain.setup(); //{ random: fxrand });
seed = Date.now(); //int(Math.random() * 9999999);
simplex= new OpenSimplexNoise(seed);
randomSeed(seed); //int(fxrand() * 9999999));
noiseSeed(seed); //int(fxrand() * 9999999));
let ih = 1400;
let iw = 1400;
if (iw / ih < ar) {
createCanvas(iw, iw / ar);
wisW = (iw);
wisH = (iw / ar);
} else {
createCanvas(ih * ar, ih);
wisW = (ih * ar);
wisH = (ih);
}
m = min(iw, ih) / 1000;
//angleMode(DEGREES);
pixelDensity(pD);
col1 = random([cool1, cool2, cool3]);
col2 = random([cool11, cool21, cool31]);
// Créer des poteaux
for (let i = 0; i < 7; i++) {
let x = random(width / 5, 4 * width / 5);
let y = height - random(50, 200);
let length = random(20, 100);
let angle = random(-PI/4, PI/4);
let pole = {x: x, y: y, length: length, angle: angle};
poles.push(pole);
}
// Créer des nuages
for (let i = 0; i < cloudCount; i++) {
let y = map(i, 0, cloudCount, 0, height / 2);
let cloud = createCloud(y);
clouds.push(cloud);
}
// Créer des nuages fachés
for (let i = 0; i < stormCloudCount; i++) {
let y = map(i, 0, stormCloudCount, 0, height / 3);
stormCloud = createStormCloud(y);
stormClouds.push(stormCloud);
}
// Créer des dunes
for (let i = 0; i < duneCount; i++) {
let y = map(i, 0, duneCount, height / 2, height);
let dune = createDune(y);
dunes.push(dune);
}
// Créer des oiseaux car c'est joli les oiseaux...
for (let i = 0; i < birdCount; i++) {
let bird = createBird();
birds.push(bird);
}
}
function draw() {
background(220);
// Dessiner les points de chaque nuage
for (let cloud of clouds) {
for (let pt of cloud) {
stroke(0, 0, 50, 75);
strokeWeight(random(0.25, 3));
point(pt.x, pt.y);
}
}
// Dessiner les points du nuage faché
for (let stormCloud of stormClouds) {
sizeMod = random(3, 9);
for (let pt of stormCloud) {
let csize = 1;
let cubeColor = color(random(col1));
let rwis = wisW / sizeMod;
let offsetY = csize / 2 * sizeMod;
cubeColor.setAlpha(30);
draw3DCube(pt.x, pt.y, csize, cubeColor, 0, 0);
}
}
// Dessiner les points de chaque dune
for (let dune of dunes) {
for (let pt of dune) {
push();
let h = map(pt.y, pt.duneY, pt.duneY + duneHeight, 100, 30);
stroke(20, 0, h, 100);
strokeWeight(random(0.25, 1.5));
point(pt.x, pt.y);
pop();
}
}
// Dessiner les lignes reliant le nuage aux poteaux
for (let pole of poles) {
push();
translate(pole.x, pole.y);
rotate(pole.angle);
stroke(0);
strokeWeight(10);
line(0, 0, pole.length, 0);
pop();
let numCables = floor(random(1, 5));
for (let i = 0; i < numCables; i++) {
let cableAttachPointX = pole.x + cos(pole.angle) * pole.length / numCables * i;
let cableAttachPointY = pole.y + sin(pole.angle) * pole.length / numCables * i;
let lowestCloudPoint = getLowestCloudPoint(cableAttachPointX - 100, cableAttachPointX + 100);
if (lowestCloudPoint) {
let cp1 = createVector(cableAttachPointX, cableAttachPointY - 50 + i * 10);
let cp2 = createVector(lowestCloudPoint.x, lowestCloudPoint.y + 50 + random(0,150));
stroke(0);
drawingContext.setLineDash([0, 2, 1]);
strokeWeight(floor(random(1.5, 3.5)));
noFill();
bezier(cableAttachPointX, cableAttachPointY, cp1.x - 15, cp1.y + 15, cp2.x + 10, cp2.y, lowestCloudPoint.x, lowestCloudPoint.y - random(0, 80));
}
}
}
// Dessiner les oiseaux, plein d'oiseaux
for (let bird of birds) {
push();
stroke(40);
strokeWeight(random(0.25, 1.5));
birdWings = bird.size / 2;
if (count % 2 == 0) {
line(bird.x - birdWings, bird.y, bird.x, bird.y + birdWings);
} else {
stroke(0, 100, 100, 70);
line(bird.x, bird.y + birdWings, bird.x + birdWings, bird.y);
}
line(bird.x - bird.size / 2, bird.y, bird.x + bird.size / 2, bird.y);
point(bird.x, bird.y);
pop();
count++;
}
applyMonochromaticGrain(gS);
noFill();
bd = 20;
stroke(255);
strokeWeight(bd);
rect(bd / 2, bd / 2, width - bd, height - bd);
}
function createBird() {
let x = random(width / 1.5);
let y = random(height / 3);
let size = random(8, 12);
return { x, y, size };
}
function createDune(y) {
let points = [];
let waveAmp = duneHeight * 0.25;
let waveFreq = TWO_PI / width;
for (let x = 0; x < width; x += 1) {
for (let yOff = 0; yOff < duneHeight; yOff += 1) {
let yNoise = noise(x * 0.003, (y + yOff) * 0.004) * duneHeight;
let yWave = waveAmp * sin(waveFreq * x);
yWave = waveAmp * sin(waveFreq * x - phase);
let pt = createVector(x, y + yOff + yNoise + yWave);
pt.duneY = y;
points.push(pt);
}
}
phase += 0.15;
return points;
}
function createCloud(y) {
let points = [];
let cloudHeight = 150;
for (let x = 0; x < width; x += 5) {
for (let yOff = 0; yOff < cloudHeight; yOff += 5) {
let yNoise = noise(x * 0.01, (y + yOff) * 0.01) * cloudHeight;
let pt = createVector(x, y + yOff + yNoise);
points.push(pt);
}
}
return points;
}
function createStormCloud(y) {
let points = [];
let cloudHeight = 150;
let cloudWidth = width / floor(random(2,3));
let offsetX = width / random(4, 6);
let amplitude = cloudWidth / 8;
for (let x = offsetX; x < offsetX + cloudWidth; x += 5) {
let normalizedX = (x - offsetX) / cloudWidth;
let edgeFactor = Math.cos(normalizedX * PI);
let numPoints = max(1, map(edgeFactor, 0, 1, 1, 5));
let widthVariation = simplex.noise2D(x/100, amplitude/50);
for (let yOff = 0; yOff < cloudHeight; yOff += numPoints) {
let yNoise = (noise(x * 0.01, (y + yOff) * 0.01) * 2 - 1) * cloudHeight;
let pt = createVector(x + widthVariation, y + yOff + yNoise);
points.push(pt);
}
}
return points;
}
function getLowestCloudPoint(startX, endX) {
let lowestY = -Infinity;
let lowestPoint = null;
for (let stormCloud of stormClouds) {
for (let pt of stormCloud) {
if (pt.x >= startX && pt.x <= endX && pt.y > lowestY) {
lowestY = pt.y;
lowestPoint = pt;
}
}
}
return lowestPoint;
}
function getClosestCloudPoint(pole) {
let closestDist = Infinity;
let closestPoint = null;
for (let stormCloud of stormClouds) {
for (let pt of stormCloud) {
let d = p5.Vector.dist(pt, pole);
if (d < closestDist) {
closestDist = d;
closestPoint = pt;
}
}
}
return closestPoint;
}
function keyPressed() {
if (keyCode === 83) {
saveCanvas('dunes_dc_' + floor(random(100)), 'png');
}
}
See More Shortcuts