xxxxxxxxxx
53
// Pointilism helix
//
// Jared Donovan 2022
//
// Drawing program that samples from a base image and redraws in a helix
// around the path of the mouse.
//
let img;
let a = 0;
function preload(){
img = loadImage('https://picsum.photos/600/600')
}
function setup() {
createCanvas(600, 600);
background(0);
// image(img, 0, 0);
}
function draw() {
// background(220);
if (mouseIsPressed){
// Sample from a circle around the mouse
translate(mouseX, mouseY);
let d = dist(mouseX, mouseY, pmouseX, pmouseY);
strokeWeight(d / 4);
rotate(a);
let v = createVector(10, 0);
for (let i = 0; i < 6; i++){
let c = img.get(mouseX + v.x, mouseY + v.y);
v.rotate(radians(60));
rotate(radians(60));
stroke(c);
point(v.x, v.y);
}
let inc = d / 10;
a += inc;
}
}