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!
Just hold the mouse down on the canvas
A fork of Brush Drawing 4:5 by Karoliina Pärnänen
CC Attribution NonCommercial ShareAlike
Brush Drawing Website
Pärnänen
xxxxxxxxxx
var img;
var balls = [];
var radiusLow = 10;
var radiusHigh = 20;
var rangeLow = 0.5;
var rangeHigh = 1;
function preload(){
img = loadImage("slushlogo_comp.jpg");
//bgimg = loadImage("typobw_sharp.jpg");
//transimg = loadImage("typotrans2.png");
}
function setup() {
//createCanvas(img.width, img.height);
createCanvas(windowWidth, windowHeight);
//background(bgimg);
background(16,16,16);
//background(222,223,225);
img.resize(windowWidth, windowHeight);
textAlign(CENTER);
// text("Click and hold here!!", width/2, height/2);
for (var i = 0; i < 10; i++){
balls.push(new Ball(windowWidth/2, windowHeight/2, color(img.get(windowWidth/2, windowHeight/2))));
}
}
function draw(){
//var c = color(img.get(current.location.x, current.location.y));
//var greyscale = round(red(c) * 0.222 + green(c) * 0.707 + blue(c) * 0.071);
for (var i = 0; i < balls.length; i++){
balls[i].draw();
balls[i].update();
balls[i].changeColour();
}
for (var i = 0; i < balls.length; i++){
if (balls[i].radius < 0){
balls.splice(i, 1);
}
}
if (mouseIsPressed){
for (var i = 0; i < 5; i++){
balls.push(new Ball(mouseX, mouseY, color(img.get(mouseX+random(2), mouseY+random(2)))));
}
}
//image(transimg, 0, 0);
}
class Ball{
//start where the user clicks
//move up from where the user has clicked
//become smaller as it moves up
//be drawn to the screem
constructor(mX, mY, c){
this.location = createVector(mX, mY);
//this.radius = random(.01);
this.radius = random(0.3); //change ball size
this.r = red(c);
this.g = green(c);
this.b = blue(c);
this.xOff = 0.0;
this.yOff = 0.0;
this.radiusLow;
this.radiusHigh;
this.rangeLow;
this.rangeHigh
}
update(){
//this.radius -= random(0.0001);
this.radius -= random(0.001);
this.xOff = this.xOff + random(-0.7, 0.7);
this.nX = noise(this.location.x) * this.xOff;
this.yOff = this.yOff + random(-0.7, 0.7);
this.nY = noise(this.location.y) * this.yOff;
this.location.x += this.nX;
this.location.y += this.nY;
}
changeColour(){
this.c = color(img.get(this.location.x, this.location.y));
this.r = red(this.c);
this.g = green(this.c);
this.b = blue(this.c);
}
draw(){
noStroke();
//stroke(255);
//stroke(this.r, this.g, this.b);
//strokeWeight(3);
//fill(255);
fill(this.r, this.g, this.b);
//line(this.location.x-(this.location.x*this.radius), this.location.y, this.location.x+(this.location.x*this.radius), this.location.y)
ellipse(this.location.x, this.location.y, this.radius * 50, this.radius * 50);
}
}
function keyTyped() {
if (key == 's') {
saveCanvas('paths', 'png');
}
}
/*function windowResized() {
resizeCanvas(windowWidth, windowHeight);
//background(16, 16, 16);
}*/
See More Shortcuts