“df_jun2” by Kaixi
https://openprocessing.org/sketch/1591608
License CreativeCommons Attribution NonCommercial ShareAlike
https://creativecommons.org/licenses/by-nc-sa/3.0
{{filePath}}
{{width}} x {{height}}
Report Sketch
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!
mouse on x axis
A fork of df_jun2 by Kaixi
CC Attribution NonCommercial ShareAlike
df_jun2
xxxxxxxxxx
let myCanvas
let mainGraphics
function setup() {
frameRate(30);
myCanvas = createCanvas(windowWidth, (windowHeight*1.5));
mainGraphics = createGraphics(width, height);
mainGraphics.background(0);
// mainGraphics.ellipse(0,0,width/2,height/2)
}
function draw() {
//這是個畫山脈
mainGraphics.push()
// // background(255)
// // let lastX=0,lastY=0;
mainGraphics.image(mainGraphics,0,2)
mainGraphics.beginShape()
mainGraphics.strokeWeight(1)
mainGraphics.noFill()
mainGraphics.translate(0,-175)
// let mouseRatio = map(mouseX,0,width,0,1)
let mouseRatio = noise(frameCount/50,mouseX/70)*1.9
for(let x=0;x<width;x+=5){
let y =
mouseRatio*sin(x/80+frameCount/50)*50+
mouseRatio*sin(x/20+frameCount/50)*20
+mouseRatio*noise(x/100,frameCount/50)
*noise(x/300,frameCount/50)
*(map(sin(x/
(10+ noise(x/1800,frameCount/100)*20)
),-1,1,0,1) )
*height/5+height/3
+noise(x/50,frameCount/50)*100
;
// fill(0)
mainGraphics.curveVertex(x,y)
if (y>height*0.45){
mainGraphics.push()
mainGraphics.noStroke()
//colours
// mainGraphics.fill((52+((mouseX)/4.7)), (150+sin(x*1.2+y/10)*32), ((70+(sin(x)*10)-(mouseX)/15)), random(90,245-(mouseX/10)))
if (mouseX < (0.08 * width)) {
mainGraphics.fill( (180), (200+sin(x*1.2+y/10)*18), ((175+(sin(x)*5)-(mouseX)/15)), random(30,245))
} else if (mouseX < (0.16 * width)) { //lite green
mainGraphics.fill( random(127,130), (127+sin(x*1.2+y/10)*20), ((129+(sin(x)*5)-(mouseX)/15)), random(30,245))
} else if (mouseX < (0.24 * width)) { //mid green
mainGraphics.fill( (45), (40+sin(x*1.2+y/10)*15), ((35+(sin(x)*5)-(mouseX)/15)), random(30,245))
} else if (mouseX < (0.30 * width)) { //darker green
mainGraphics.fill( random(180,245), (110+sin(x*1.2+y/10)*30), random(60,70), random(30,245))
} else if (mouseX < (0.36 * width)) { //fire
mainGraphics.fill( random(10,19), random(0,9), random(10,15), random(60,245))
} else if (mouseX < (0.40 * width)) { //charcoal
mainGraphics.fill( random(30,60), (21+sin(x*1.2+y/10)*30), (19+sin(x*1.2+y/10)*30), random(60,245))
} else if (mouseX < (0.48 * width)) { //humus
mainGraphics.fill( random(110,115), (112+sin(x*1.2+y/10)*4), (105+sin(x*1.2+y/10)*4), random(60,245))
} else if (mouseX < (0.56 * width)) { //ash
mainGraphics.fill( (156), (185+sin(x*1.2+y/10)*4), (212+sin(x*1.2+y/10)*20), random(60,245))
} else if (mouseX < (0.64 * width)) { //water
mainGraphics.fill( (206+sin(x*1.2+y/10)*20), random(210,260), random(200,236), random(60,245))
} else if (mouseX < (0.72 * width)) { //moss
mainGraphics.fill( (255+sin(x*1.2+y/10)*10), (235+sin(x*1.2+y/10)*15), (203), random(60,245))
} else if (mouseX < (0.80 * width)) { //yellow
mainGraphics.fill( (241+sin(x*1.2+y/10)*10), (225), (19+sin(x*1.2+y/10)*20), random(60,240))
// } else if (mouseX < (0.86 * width)) { //pink
mainGraphics.fill( (220+sin(x*1.2+y/10)*20), (180), random(170,196), random(60,240))
} else if (mouseX < (0.92 *width)) { //wisteria
mainGraphics.fill( ((189+(sin(x)*10))), (130+sin(x*1.2+y/10)*20), (190+sin(x*1.2+y/10)*15), random(60,240))
} else if (mouseX < (width)) { //purpler
mainGraphics.fill( ((140+(sin(x)*30))), (100+sin(x*1.2+y/10)*20), (200+sin(x*1.2+y/10)*40), random(60,240))
}
//mainGraphics.fill(tan(0.3*mouseX)+20, (150*cos(0.005*mouseX)+20), (-150*cos(0.005*mouseX)+60), random(90,245-(mouseX/10)))
// mainGraphics.fill(tan(mouseX)+(150*sin(mouseX/160 - 20)), 40, 40, random(90,245-(mouseX/10)))
mainGraphics.ellipse(x +random(-2.5,1),y+random(-1,2.5),random(2,8))
mainGraphics.pop()
}
}
mainGraphics.stroke(255,map(sin(frameCount/(20+ (1-mouseRatio) *500) ),-1,1,50,240) )
mainGraphics.endShape()
mainGraphics.pop()
image(mainGraphics,0,0)
// let c = get( int(width/2), int(height/2))
// rect(width/2,height/2,50,50)
push()
fill(255)
textSize(120)
textStyle(BOLD)
text("",50,140)
pop()
// ellipse(mouseX, mouseY, 20, 20);
}
See More Shortcuts