xxxxxxxxxx
33
var ball; //動かす物体
var tween; //動きの設定
function setup() {
createCanvas(windowWidth, windowHeight);
//初期値を設定
ball = {
diameter: height / 8,
col: color(255, 63, 31),
};
//動きを定義
tween = gsap.to(ball, {
diameter: height / 1.5,
col: color(0, 190, 255),
duration: 1,
ease: "expo.inOut",
paused: true, //最初は停止状態で
});
}
function draw() {
background(0);
noStroke();
fill(ball.col); //設定した色で
//動き
circle(width / 2, height / 2, ball.diameter);
}
//マウスクリックで動作開始
function mouseClicked() {
tween.restart();
}