こんにちは!たやち(tayati_369)です。
beginShape()を使ってい線を操ってみたいと思い、色々やってみました。
調べていくうちにベジェ曲線というのに出会い、bezierVertex()関数があったのでこれを使って糸を作ってみました。
真ん中から縄跳びのなわのようなかつランダムな動きを表現してみました。
もう少し色々試していこう!
import gifAnimation.*; GifMaker gifExport; void setup(){ size(800, 800); colorMode(HSB,360,100,100,100); smooth(); frameRate(5); gifExport = new GifMaker(this, "export.gif"); gifExport.setRepeat(0); gifExport.setQuality(10); gifExport.setDelay(20); } void draw(){ background(0,0,100); pushMatrix(); translate(0, height/2); strokeWeight(10); stroke(random(360), 70, 95, 100*noise(1)); noFill(); beginShape(); vertex(0, 0); bezierVertex(width/3+random(-400,400), -height/4+random(800), 2*width/3+random(-400,400), height/4-random(800), width, 0); endShape(); popMatrix(); if(frameCount <= 10*10){ gifExport.addFrame(); } else { gifExport.finish(); } }
最後に
sinカーブやcosカーブをぬるぬる動くようにして、色を動いた時間分変化させる形も表現したいなー。
ではでは、さようなら〜〜〜。
コメント