Creative Coding 2024/5/27 - アニメーション
code:ruby
def setup
createCanvas(400, 400)
rectMode(CENTER)
end
def draw
background(160)
translate(frameCount, 30)
rotate(radians(frameCount * (360 / (2 * PI * 10))))
fill(255, 221, 89)
rect(0, 0, 20, 20)
end
code:ruby
def setup
createCanvas(400, 400)
rectMode(CENTER)
end
def draw
background(160)
translate(width / 2 , height / 2)
rotate(radians(frameCount * (360 / (2 * PI * 10))))
fill(255, 221, 89)
rect(50, 0, 20, 20)
end
code:ruby
def setup
createCanvas(400, 400)
rectMode(CENTER)
end
def draw
background(160)
translate(width / 2 , height / 2)
fill(255, 221, 89)
rect(sin(frameCount / 20.0) * width / 2, 20, 20, 20)
end
code:ruby
def setup
createCanvas(400, 400)
rectMode(CENTER)
end
def draw
background(160)
translate(0 , height / 2)
fill(255, 221, 89)
rect(frameCount, 20, 20, 20)
rect(frameCount, -1 * abs(sin(frameCount/20.0)) * 60, 20, 20)
end
code:ruby
def setup
createCanvas(400, 400)
rectMode(CENTER)
end
def draw
background(160)
translate(0 , height / 2)
fill((frameCount % (20 / PI)) * 4 )
rect(frameCount, -1 * -abs(sin(frameCount/20.0)) * 60, 20, 20)
fill(255 - (frameCount % (20 * PI)) * 4)
translate(frameCount - 20, 0)
rotate(radians(60 - frameCount % (20 * PI)))
rect(20, 20, 20, 20)
rect(frameCount, 20, 20, 20)
end
code:ruby
def setup
createCanvas(400, 400)
rectMode(CENTER)
end
def draw
background(160)
ellipse(50, 75, 50, 50)
ellipse(mouseX, mouseY, 50, 50)
end