xxxxxxxxxx
36
let myImage;
function preload() {
myImage = loadImage("https://picsum.photos/2s00");
}
function setup() {
cnv = createCanvas(400, 400);
rectMode(CENTER);
startButton = createButton("start transport");
stopButton = createButton("stop transport");
startButton.mousePressed(startTransport);
stopButton.mousePressed(stopTransport);
}
function draw() {
image(myImage, 0, 0, width, height);
let [r, g, b] = get(mouseX, mouseY);
//let coor = get(mouseX,mouseY);
//no alpha applied here
console.log(r,g,b);
noFill();
strokeWeight(5);
stroke(255);
rect (mouseX, mouseY, 20);
}
function startTransport() {
Tone.start();
Tone.Transport.start();
}
function stopTransport() {
Tone.Transport.stop();
}