“Messy Curve Draw” by Edward Balaoro
https://openprocessing.org/sketch/551080
License CreativeCommons Attribution ShareAlike
https://creativecommons.org/licenses/by-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!
Click to change image and Press 's' key to stop draw
A fork of Messy Curve Draw by 郑越升Sen
CC Attribution ShareAlike
Messy Curve Draw
Balaoro
xxxxxxxxxx
var imgs = [];
var imgIndex = -1;
var img;
var paint;
var subStep = 800;
var z = 0;
var isStop = false;
function preload() {
imgs[0] = loadImage("test1.png");
imgs[1] = loadImage("test2.png");
imgs[2] = loadImage("test3.png");
}
function setup() {
if(windowWidth < 600)
createCanvas(windowWidth, windowWidth);
else
createCanvas(600, 600);
img = createImage(width, height);
nextImage();
paint = new Paint(createVector(width/2, height/2));
background(255, 255, 255);
colorMode(RGB, 255, 255, 255, 255);
}
function draw() {
//console.log(frameRate());
if (!isStop) {
for (var i = 0 ; i < subStep ; i++) {
paint.update();
paint.show();
z+= 0.01;
}
}
//background(255);
//image(img, 0, 0, width, height);
}
function fget(i, j) {
var index = j * img.width + i;
index *= 4;
return color(img.pixels[index], img.pixels[index+1], img.pixels[index+2], img.pixels[index+3]);
}
function fset(i, j, c) {
var index = j * img.width + i;
index *= 4;
img.pixels[index] = red(c);
img.pixels[index+1] = green(c);
img.pixels[index+2] = blue(c);
img.pixels[index+3] = alpha(c);
}
function keyPressed() {
console.log(key);
if (key === 's' || key === 'S') {
isStop = !isStop;
}
}
function mouseClicked() {
nextImage();
}
function touchStarted() {
nextImage();
}
function nextImage() {
if (!img) return;
imgIndex = (++imgIndex) % imgs.length;
var targetImg = imgs[imgIndex];
img.copy(targetImg, 0, 0, targetImg.width, targetImg.height, 0, 0, img.width, img.height);
//img.resize(width, height);
img.loadPixels();
clear();
}
See More Shortcuts