読者です 読者をやめる 読者になる 読者になる

Daily Creative Coding

元「30 min. Processing」。毎日、Creative Codingします。

ねじれたライン

/* * twisted lines * * @author aadebdeb * @date 2017/02/04 */ var colors; var type; function setup() { createCanvas(windowWidth, windowHeight); colors = [ color(255, 0, 0), color(0, 255, 0), color(0, 0, 255) ]; type = 0; } function draw() …

p5.jsの3D基本図形

/* * 3D primitives * * @author aadebdeb * @date 2017/02/03 */ var X_SPACE = 200; var Y_SPACE = 250; var X_NUM = 4; var Y_NUM = 2; function setup() { createCanvas(800, 600, WEBGL); } function draw() { background(255); push(); translateTo(0,…

p5.jsでリズムマシン

/* * rhythm machine * * @author aadebdeb * @date 2017/02/02 */ var pattern = [ true, false, false, false, true, false, false, false, true, false, false, false, true, false, false, false ]; var noiseOsc, env; var part, pharse; var beat = 0;…

ランダムに揺れる画面とサウンド

/* * noisy screen & sound * * @author aadebdeb * @date 2017/02/01 */ var rects; var rgb; var osc, lpf; function setup() { createCanvas(windowWidth, windowHeight); rectMode(CENTER); rects = []; for (var i = 0; i < 50; i++) { rects.push(new …

p5.jsでランダムに音を鳴らす

/* * random percussion sound * * @author aadebdeb * @date 2017/01/31 */ var osc, env; function setup() { createCanvas(windowWidth, windowHeight); noCursor(); env = new p5.Env(); env.setADSR(0.01, 0, 1, 0.2); env.setExp(true); osc = new p5.…

パーリンノイズの層

/* * layers of perlin noise * * @author aadebdeb * @date 2017/01/30 */ var colors; function setup() { createCanvas(windowWidth, windowHeight); mousePressed(); } function mousePressed() { var cscale = [random(0.1), random(0.1), random(0.1)]…

サイバー・ランドスケープ

/* * cyber landscape * * @author aadebdeb * @date 2017/01/29 */ var startW; function setup(){ createCanvas(windowWidth, windowHeight); frameRate(10); background(0); startW = -100; } function draw(){ stroke(lerpColor(color(111, 186, 44, 100…

光の流れ

/* * light flow * * @author aadebdeb * @date 2017/01/28 */ var movers; var colors; var noiseScales, noiseOffsets; function setup() { colors = [color(4, 1, 1), color(1, 2, 3), color(2, 3, 1)]; createCanvas(windowWidth, windowHeight); blendM…

誘引する流れ

/* * attracting flow * * @author aadebdeb * @date 2017/01/27 */ var movers; function setup() { createCanvas(windowWidth, windowHeight); movers = []; for (var i = 0; i < 2000; i++) { movers.push(new Mover()); } background(255); stroke(0, 3)…

並んだ板

/** * boards in line * * @author aadebdeb * @date 2017/01/26 */ void setup(){ size(640, 480); rectMode(CENTER); fill(20); stroke(255, 251, 249); strokeWeight(4); } void draw(){ background(255, 251, 249); translate(width / 2, height / 2); i…

明滅する四角形

/** * flashing rect * * @author aa_debdeb * @date 2017/01/25 */ void setup(){ size(500, 500); rectMode(CENTER); frameRate(30); noStroke(); } void draw(){ fill( constrain(128 + randomGaussian() * 60, 0, 255), constrain(128 + randomGaussian(…

色を変えながらマスを塗りつぶしていく

/** * line drawer * * @author aa_debdeb * @date 2017/01/24 */ int CELL_SIZE = 2; int CELL_NUM = 250; int[][] DIRECTIONS = {{0, -1}, {1, 0}, {0, 1}, {-1, 0}}; float MAX_STRAIT = 50; color BG_COLOR = color(255, 255, 255); color[] FILL_COLORS…

四角形のシーケンス

/** * sequence of rects * * @author aa_debdeb * @date 2017/01/23 */ color[] colors = { color(216, 36, 72), color(221, 163, 0), color(0), color(44, 182, 170), color(221, 163, 0), color(255) }; void setup(){ size(500, 500); frameRate(5); rec…

おもちゃのキラキラ

/** * toy twinckle * * @author aa_debdeb * @date 2017/01/22 */ int rectNum = 43; float rectSize = 10; color[] colors = { color(229, 10, 132), color(84, 195, 241), color(240, 235, 69), color(156, 202, 84), color(237, 109, 31), color(229, 10…

展開・縮小する弧

/** * expanding and closing arcs * * @author aa_debdeb * @date 2017/01/21 */ color[] colors = { color(0, 136, 164), color(175, 220, 222) }; void setup(){ size(500, 500); frameRate(6); noStroke(); } void draw(){ background(234, 239, 249); t…

脈動するTruchetタイル

/** * pulsatile truchet tile * * @author aa_debdeb * @date 2017/01/20 */ int tileSize = 25; int tileNum = 20; int[][] types; color bgColor = color(255, 255, 255); color skColor1 = color(69, 189, 207); color skColor2 = color(247, 248, 218);…

Truchetタイル

/** * truchet tiles * * @author aa_debdeb * @date 2017/01/19 */ void setup(){ size(500, 500); mousePressed(); } void mousePressed(){ int tileSize = 25; float borderSize = random(0, tileSize / 2); color bgColor = color(random(255), random(2…

線の下を動くもの

/** * movers under lines * * @author aa_debdeb * @date 2017/01/18 */ ArrayList<Mover> movers; void setup(){ size(640, 480); noFill(); movers = new ArrayList<Mover>(); } void draw(){ background(26, 11, 8); boolean isPink = true; for(float h = -50; h <= h</mover></mover>…

パルスで律動する円

/** * pulse circle * * @author aa_debdeb * @date 2017/01/17 */ void setup(){ size(640, 640); noFill(); strokeWeight(2); } void draw(){ background(238, 243, 239); translate(width / 2, height / 2); float radius = 200; float step = 5; for(flo…

斜め線のフロー

/** * line floaw * * @author aa_debdeb * @date 2017/01/16 */ float STEP = 20; void setup(){ size(640, 640); noFill(); } void draw(){ background(39, 26, 32); for(float d = 0; d <= width * 2; d += STEP){ float diff = map(sin((d) * 0.03 - fra…

球の上を動く円

/** * circles moving on sphere * * @author aa_debdeb * @date 2017/01/15 */ ArrayList<Circle> circles; void setup(){ size(640, 640); circles = new ArrayList<Circle>(); for(int i = 0; i < 30; i++){ circles.add(new Circle()); } } void draw(){ background(255)</circle></circle>…

CMYK網点

/** * CMYK halftone * * @author aa_debdeb * @date 2017/01/14 */ float[] sizeScale; void setup(){ size(640, 640); mousePressed(); } void mousePressed(){ sizeScale = new float[4]; for(int i = 0; i < 4; i++){ sizeScale[i] = random(1); } } voi…

円の影

/** * shadow of circle * * @author aa_debdeb * @date 2017/01/13 */ void setup(){ size(640, 640); noStroke(); background(255, 255, 250); } void draw(){ translate(width / 2, height / 2); rotate(PI / 4); for(int i = 0; i < 2; i++){ float angl…

グレイスケールのドット

/** * grayscale dots * * @author aa_debdeb * @date 2017/01/12 */ void setup(){ size(640, 640); noStroke(); mousePressed(); } void mousePressed(){ background(200); for(int i = 0; i < 2000; i++){ float x = random(-50, width + 50); float y = …

CMYのドット

/** * CMY dots * * @author aa_debdeb * @date 2017/01/11 */ void setup(){ size(640, 640); mousePressed(); } void mousePressed(){ ArrayList<Obj> objs = new ArrayList<Obj>(); color[] colors = {color(255, 0, 255), color(0, 255, 255), color(255, 255, 0)}</obj></obj>…

波状の円

/** * wavy circles * * @author aa_debdeb * @date 2017/01/10 */ void setup(){ size(640, 640); background(0, 0, 10); } void draw(){ fill(0, 0, 10, 100); noStroke(); rect(0, 0, width, height); translate(width / 2, height / 2); noFill(); for(i…

急にノイズが入るサイン波

/** * sine / noise * * @author aa_debdeb * @date 2017/01/09 */ void setup(){ size(640, 480); stroke(255, 255, 30); strokeWeight(2); noFill(); } void draw(){ background(0, 0, 20); float noiseRate = pow(abs(sin(frameCount * 0.01)), 150); beg…

残像のつくオシロスコープ

/** * ghost sine wave * * @author aa_debdeb * @date 2017/01/08 */ void setup(){ size(640, 480); background(0); } void draw(){ noStroke(); fill(0, 40); rect(0, 0,width, height); stroke(0, 255, 0); strokeWeight(3); noFill(); beginShape(); fo…

吸い込み口

/** * intake port * * @author aa_debdeb * @date 2017/01/07 */ int LOOP = 20; int ANGLE_NUM = 17; void setup(){ size(1000, 1000); } void draw(){ fill(0, 100); noStroke(); rect(0, 0, width, height); translate(width / 2, height / 2); rotate(-…

半透明なブロック

3D

/** * translucent blocks * * @author aa_debdeb * @date 2017/01/06 */ float W = 800; float H = 800; float BOX_WIDTH = 20; void setup(){ size(500, 500, P3D); fill(255, 50); stroke(255, 150); strokeWeight(2); } void draw(){ background(0); tra…

パーティクル同士の衝突と反射(3D)

/** * collision with many particles in 3D * * @author aa_debdeb * @date 2017/01/05 */ float MIN_RADIUS = 10; float MAX_RADIUS = 50; float e = 1.0; float k = 2.0; float rotX = 0; float rotY = 0; ArrayList<Particle> particles; void setup(){ size(500, </particle>…

パーティクル同士の衝突と反射

/** * collision with many particles and walls * * @author aa_debdeb * @date 2017/01/04 */ float e = 0.5; float k = 0.3; ArrayList<Particle> particles; void setup(){ size(500, 500); noStroke(); frameRate(30); particles = new ArrayList<Particle>(); while(partic</particle></particle>…

ゴムの紐

/** * elastic string * * @author aa_debdeb * @date 2017/01/03 */ int FPS = 30; int NODE_NUM = 100; float GRAVITY = 1.0; float K_SPRING = 10.0; float K_DAMPING = 10.0; PVector[] locs; PVector[] vels; float l; void setup(){ size(640, 640); f…

リング変調と振幅変調

/** * Ring Modulation vs. Amplitude Modulation * * @author aa_debdeb * @date 2017/01/02 */ import ddf.minim.spi.*; import ddf.minim.signals.*; import ddf.minim.*; import ddf.minim.analysis.*; import ddf.minim.ugens.*; import ddf.minim.effe…

ペナルティ法による複数の円の衝突

/** * collision with many particles * * @author aa_debdeb * @date 2017/01/01 */ float e = 1.0; float k = 1.0; ArrayList<Particle> particles; void setup(){ size(500, 500); noStroke(); frameRate(30); particles = new ArrayList<Particle>(); while(particles.size() </particle></particle>…

撃力ベース法による円の衝突

/** * collision with two particles * * @author aa_debdeb * @date 2016/12/31 */ Particle p1, p2; float e = 0.5; void setup(){ size(500, 500); noStroke(); fill(#BF1E56); initialize(); } void initialize(){ float velSize = 3; float velAng1 = H…

ベクトル計算によるパーティクルの壁面での反射

/** * reflection of a particle * * @author aa_debdeb * @date 2016/12/30 */ int COUNT = 200; PVector loc, vel; float circleR = 30; void setup(){ size(500, 500); noStroke(); initialize(); } void initialize(){ loc = new PVector(width / 2, hei…

ローテーター

/** * rotators * * @author aa_debdeb * @date 2016/12/29 */ int LOOP = 50; int NUM = 12; int BOX_SIZE = 15; float SPHERE_SIZE = 120; void setup(){ size(500, 500, P3D); noStroke(); } void draw(){ background(#FCF1D3); translate(width / 2, hei…

昔のコンピュータの画面風スケッチ

/** * old computer display * * @author aa_debdeb * @date 2016/12/28 */ float time = 0; void setup(){ size(640, 480); frameRate(60); } void draw(){ background(0); if(frameCount % 4 != 0){ stroke(0, 150, 0); for(int h = 0; h < height; h += 4…

三角形のループ

/** * triangle loop * * @author aa_debdeb * @date 2016/12/27 */ float MAX_RADIUS = 200; int LOOP = 120; color bg = color(219, 175, 184); color c1 = color(153, 14, 42); color c2 = color(220, 20, 60); void setup(){ size(500, 500); noStroke()…

水面から飛び出るパーティクル

/* * particles from water * * @author aa_debdeb * @date 2016/12/26 */ float gravity = 0.15; ArrayList<Particle> particles; color c1 = color(173, 216, 230); color c2 = color(100, 149, 237); void setup(){ size(480, 360); noStroke(); particles = new Ar</particle>…

サイン波を累乗する

/** * exponential sine tooth * * @author aa_debdeb * @date 2016/12/25 */ void setup(){ size(500, 500); noStroke(); } void draw(){ background(146, 250, 0); int[] powers = {2, 4, 10, 40}; color[] colors = {color(200), color(250, 0, 246), col…

ひっくり返る四角形

/** * rect flip * * @author aa_debdeb * @date 2016/12/24 */ int X_NUM = 5; int Y_NUM = 5; void setup(){ size(640, 640); rectMode(CENTER); noStroke(); fill(100); } void draw(){ background(230); translate(width / 2, height / 2); for(int y = …

円のループ

/** * loop of circles * * @author aa_debdeb * @date 2016/12/23 */ int NUM = 24; void setup(){ size(640, 640); noStroke(); } void draw(){ background(0, 0, 30); translate(width / 2, height / 2); for(int i = 0; i < NUM; i++){ float angle = i …

四角形で塗りつぶす

/** * fill by rect * * @author aa_debdeb * @date 2016/12/22 */ float RECT_WIDTH = 150; PVector offset; void setup(){ size(500, 500); rectMode(CENTER); offset = new PVector(random(10000), random(10000)); background(220); } void draw(){ noSt…

動く階段

3D

/* * moving steps * * @author aa_debdeb * @date 2016/12/21 */ float DISPLAY_WIDTH = 450; float BLOCK_WIDTH = 20; PVector loc; void setup(){ size(500, 500, P3D); noStroke(); fill(255, 255, 0); loc = new PVector(random(10000), random(10000))…

回転する三角形

/** * triangles * * @author aa_debdeb * @date 2016/12/20 */ int LOOP = 200; float radius = 70; void setup(){ size(500, 500); stroke(200); strokeWeight(3); fill(204, 204, 0); } void draw(){ background(0, 0, 30); translate(width / 2.0, heigh…

スライドイン / スライドアウト

/** * slide in / slide out * * @author aa_debdeb * @date 2016/12/19 */ int RECT_NUM = 5; float RECT_WIDTH = 35; float RECT_GAP = 80; int LOOP = 120; void setup(){ size(500, 500); rectMode(CENTER); noStroke(); fill(255); } void draw(){ back…

揺れる球

/** * swaying balls * * @author aa_debdeb * @date 2016/12/18 */ int LOOP = 120; int NUM = 24; void setup(){ size(500, 500); noStroke(); fill(255); } void draw(){ background(0); translate(width / 2, height / 2); for(int i = 0; i < NUM; i++)…

歯車

/** * gears * * @author aa_debdeb * @date 2016/12/17 */ float bigR = 100; float smallR = 90; float angleStep = 5; float time = 0.0; void setup(){ size(500, 500); } void draw(){ background(255); translate(width / 2, height / 2); float dist …