xxxxxxxxxx
20
// ButtonLabel (c) 2015, 2021 kouichi.matsuda@gmail.com
let gray = 0; // 背景の色
let button; // ボタンを管理する変数
function setup() {
button = createButton(str(gray)); // ボタンの作成
button.mousePressed(clicked); // クリックされたらtoggleColorを実行
background(gray);
}
function draw(){
}
function clicked() {
gray += 2; // grayを2増やす
button.html(gray); // ボタンのラベルを変更
background(gray);
}