“230115_YUAN” by Jeremy Chen
https://openprocessing.org/sketch/1795425
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!
A fork of 230115_03 by Jeremy Chen
CC Attribution NonCommercial ShareAlike
230115_YUAN
Chen
xxxxxxxxxx
let particles=[]
// let colors = ["#e9d985","#b2bd7e", "#749c75", "#6a5d7b","#5d4a66"]
let colors = "1c3144-d00000-ffba08-a2aebb-3f88c5".split("-").map(a=>"#"+a)
let canvasTexture, mainGraphics//001 mainGraphics
let seed = 100//004 Save
function preload(){//001
canvasTexture = loadImage("canvas-light.jpeg")
}
function setup() {
seed = int(random(1000))//004 Save
// seed = 85
createCanvas(154*6, 111*6);//004
mainGraphics = createGraphics(width,height);//001
// mainGraphics.rect(10,10,50,50)//001
pixelDensity(3)// Export:5~8
randomSeed(seed)
background(0);
for(let i=0;i<100;i++){
let newP = new Particle({
// p: createVector(random(width),random(height)),
// p: createVector(0,i),
v: createVector(0,2).rotate(random(10)),
p: createVector(width/2,height/2),
// v: createVector(1,0),
color: color(random(colors)),
// color2: color(255,0,0),
color2: color(random(colors)),//
a: createVector(0,0),
r: random(150)*random()
})
particles.push(newP)
}
}
//003
function keyPressed(){
if (key ==' '){
noLoop()
print(frameCount)
}
if (key =='s'){
save("demo_s" + seed + "_f" + frameCount + ".jpg")
}
}
//003
function draw() {
if(frameCount == 33){ //004 Save frameCount
noLoop()
}
background(245,245,200) //004 Background
if (mouseIsPressed){
let newP = new Particle({
// p: createVector(random(width),random(height)),
// p: createVector(0,i),
// v: createVector(random(-2,2),random(-2,2)),
p: createVector(mouseX,mouseY),
// v: createVector(1,0),
color: color(0),
// a: createVector(0,0),
r: random(100)*random()
})
particles.push(newP)
}
particles.forEach(p=>{
p.update()
p.draw(mainGraphics)//001
})
particles= particles.filter(p=>p.life>0)
// image(mainGraphics,mouseX/10,0)//001
image(mainGraphics,0,0)//001
mainGraphics.push()//003
// mainGraphics.rotate(sin(frameCount/100)/500)
mainGraphics.rotate(sin(frameCount/300)/500)
// mainGraphics.scale(0.9995)//004
// mainGraphics.image(mainGraphics,0,1)//002
// mainGraphics.image(mainGraphics,0,0.01)//002
mainGraphics.image(mainGraphics,0.01,0)//002
// mainGraphics.image(mainGraphics,2,0,width-2,height)//005
mainGraphics.image(mainGraphics,-sin(frameCount/100),0,width-2,height)//005
mainGraphics.pop()
push()
blendMode(MULTIPLY)
image(canvasTexture,0,0)//001
image(canvasTexture,0,0)//001
blendMode(MULTIPLY)
image(mainGraphics,0,0)//001
// blendMode(SCREEN) //006 Brighter
// image(mainGraphics,0,0)//001 006 Brighter
pop()
// p.add(v)
// v.add(a)
// v.x+=sin(p.y/10)*0.5
// v.y+=sin(p.y/20)*0.5
// v.x =random(-5,5)
// v.y =random(-5,5)
// fill(p.x/3,p.y/3,frameCount)
// noStroke()
// circle(p.x,p.y, r);
}
See More Shortcuts