xxxxxxxxxx
78
let bsize = 300;
let cbrush = "🥩";
let cbrush2 = "🥩";
let container;
let add_btn;
function setup() {
//createCanvas(window.innerWidth,window.innerHeight);
bsize = window.innerWidth*.35;
noCanvas();
container = document.getElementById("container");
add_btn = document.getElementById("add_btn");
add_btn.addEventListener("click",newIcon);
}
//setInterval(newIcon,3000);
function newIcon(){
// if(mouseX>width/2){
cbrush =random(emojis);
//}else{
cbrush2 =random(emojis);
// }
// speakthis(cbrush + " oder " + cbrush2);
// container.innerHTML +=cbrush;
container.insertAdjacentHTML("afterbegin", cbrush);
}
function draw() {
background(220);
textAlign(CENTER);
textSize(bsize);
text(cbrush+""+ cbrush2,width/2,height/2+bsize/2.5);
}
function speakthis(_str){
const synth = window.speechSynthesis;
var voices = synth.getVoices();
//console.log(voices)
const utterance = new SpeechSynthesisUtterance();
utterance.voice = voices[0];
utterance.rate = 2.;
utterance.text = _str;
synth.speak(utterance);
}
/*
function mouseClicked(){
newIcon();
}
*/