xxxxxxxxxx
var img;
var c;
var voice;
function preload()
{
img = loadImage(imglist.breakfast);
// img = loadImage("hue_wheel.jpg");
}
function setup() {
createCanvas(img.width, img.height);
// createCanvas(img.width*2, img.height*2);
voice = new p5.Speech();
}
function draw() {
image(img, 0, 0, img.width, img.height);
// image(img, 0, 0, img.width*2, img.height*2);
c = get(mouseX, mouseY);
fill(c);
noStroke();
ellipse(mouseX, mouseY, 50);
textSize(70);
textAlign(CENTER);
var hsl = RGB_TO_HSL(c[0], c[1], c[2]);
var color_name = is_color(hsl[0], hsl[1], hsl[2]);
if (mouseIsPressed)
{
fill(255, 255, 255, 180);
rect(width/2-400, height-120, 800, 100)
fill(0);
text(color_name, width/2, height-40);
textSize(30);
// text("H: " + hsl[0] + " " + "S: " + hsl[1] + " " + "L: " + hsl[2], 200, 200);
}
}
function mousePressed()
{
c = get(mouseX, mouseY);
fill(c);
var hsl = RGB_TO_HSL(c[0], c[1], c[2]);
var color_name = is_color(hsl[0], hsl[1], hsl[2]);
text(color_name, width/2, height-40)
textAlign(CENTER);
voice.speak(color_name);
}
// Paolla B. Dutra