コエンザイムのブログ

ジェネレーティブアートが好きです

Auto Generated Charactersをつくりました

Auto Generated Charactersをつくりました。ジェネレーティブアートです。文字色と文字の背景色を変化させながら、さまざまな国の文字を多数並べました。

opensea.io

以下はソースコードです。開発環境はMacBook Air(M1 2020), macOS Monterey 12.4 、Processing 4.0b8です。

Characters.pde

// Characters
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.Arrays;
import java.util.List;

final int[] cExclusionCodeList =
{
   0x007F
  ,0x0080,0x0081,0x0082,0x0083,0x0084,0x0085,0x0086,0x0087,0x0088,0x0089,0x008A,0x008B,0x008C,0x008D,0x008E,0x008F
  ,0x0090,0x0091,0x0092,0x0093,0x0094,0x0095,0x0096,0x0097,0x0098,0x0099,0x009A,0x009B,0x009C,0x009D,0x009E,0x009F
  ,0x00A0,0x00AD
  ,0x034F,0x0378,0x0379,0x0380,0x0381,0x0382,0x0383,0x038B,0x038D,0x03A2,0x0530
  ,0x0557,0x0558,0x0588,0x058B,0x058C,0x0590
  ,0x05C8,0x05C9,0x05CA,0x05CB,0x05CC,0x05CD,0x05CE,0x05CF
  ,0x05EB,0x05EC,0x05ED,0x05EE,0x05EF
  ,0x05F5,0x05F6,0x05F7,0x05F8,0x05F9,0x05FA,0x05FB,0x05FC,0x05FD,0x05FE,0x05FF
  ,0x061C,0x061D,0x070E,0x074B,0x074C
  ,0x07B2,0x07B3,0x07B4,0x07B5,0x07B6,0x07B7,0x07B8,0x07B9,0x07BA,0x07BB
  ,0x07BC,0x07BD,0x07BE,0x07BF
  ,0x07FB,0x07FC,0x082E,0x082F,0x083F,0x085C,0x085D,0x085F
  ,0x0860,0x0861,0x0862,0x0863,0x0864,0x0865,0x0866,0x0867,0x0868,0x0869,0x086A,0x086B,0x086C,0x086D,0x086E,0x086F
  ,0x0870,0x0871,0x0872,0x0873,0x0874,0x0875,0x0876,0x0877,0x0878,0x0879,0x087A,0x087B,0x087C,0x087D,0x087E,0x087F
  ,0x0880,0x0881,0x0882,0x0883,0x0884,0x0885,0x0886,0x0887,0x0888,0x0889,0x088A,0x088B,0x088C,0x088D,0x088E,0x088F
  ,0x0890,0x0891,0x0892,0x0893,0x0894,0x0895,0x0896,0x0897,0x0898,0x0899,0x089A,0x089B,0x089C,0x089D,0x089E,0x089F
  ,0x08B5,0x08BF
  ,0x08C0,0x08C1,0x08C2,0x08C3,0x08C4,0x08C5,0x08C6,0x08C7,0x08C8,0x08C9,0x08CA,0x08CB,0x08CC,0x08CD,0x08CE,0x08CF
  ,0x08D0,0x08D1,0x08D2,0x08D3,0x08D4,0x08DA,0x08DB,0x08DC,0x08DD,0x08DE,0x08DF
  ,0x08E2,0x08FA,0x0984,0x098D,0x098E,0x0991,0x0992,0x09A9
  ,0x09B1,0x09B3,0x09B4,0x09B5,0x09BA,0x09BB
  ,0x09C5,0x09C6,0x09C9,0x09CA,0x09CF
  ,0x09D0,0x09D1,0x09D2,0x09D3,0x09D4,0x09D5,0x09D6,0x09D8,0x09D9,0x09DA,0x09DB,0x09DE
  ,0x09E4,0x09E5
  ,0x09FC,0x09FD,0x09FE,0x09FF
  ,0x0A00,0x0A04,0x0A0B,0x0A0C,0x0A0D,0x0A0E
  ,0x0A11,0x0A12,0x0A29,0x0A31,0x0A34,0x0A37,0x0A3A,0x0A3B,0x0A3D
  ,0x0A43,0x0A44,0x0A45,0x0A46,0x0A49,0x0A4A,0x0A4E,0x0A4F
  ,0x0A50,0x0A52,0x0A53,0x0A54,0x0A55,0x0A56,0x0A57,0x0A58,0x0A5D,0x0A5F
  ,0x0A76,0x0A77,0x0A78,0x0A79,0x0A7A,0x0A7B,0x0A7C,0x0A7D,0x0A7E,0x0A7F
  ,0x0A80,0x0A84,0x0A8E,0x0A92,0x0AA9,0x0AB1,0x0AB4,0x0ABA,0x0ABB
  ,0x0AC6,0x0ACA,0x0ACE,0x0ACF
  ,0x0AD1,0x0AD2,0x0AD3,0x0AD4,0x0AD5,0x0AD6,0x0AD7,0x0AD8,0x0AD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,0x11FE,0x11FF
  ,0x1249,0x124E,0x124F,0x1257,0x1259,0x125E,0x125F
  ,0x1289,0x128E,0x128F,0x12B1,0x12B6,0x12B7,0x12BF
  ,0x12C1,0x12C6,0x12C7,0x12D7
  ,0x1311,0x1316,0x1317,0x135B,0x135C,0x137D,0x137E,0x137F
  ,0x139A,0x139B,0x139C,0x139D,0x139E,0x139F
  ,0x13F6,0x13F7,0x13FE,0x13FF,0x1400
  ,0x1677,0x1678,0x1679,0x167A,0x167B,0x167C,0x167D,0x167E,0x167F
  ,0x169D,0x169E,0x169F
  ,0x16F1,0x16F2,0x16F3,0x16F4,0x16F5,0x16F6,0x16F7,0x16F8,0x16F9,0x16FA,0x16FB,0x16FC,0x16FD,0x16FE,0x16FF
  ,0x170D
  ,0x1715,0x1716,0x1717,0x1718,0x1719,0x171A,0x171B,0x171C,0x171D,0x171E,0x171F
  ,0x1737,0x1738,0x1739,0x173A,0x173B,0x173C,0x173D,0x173E,0x173F
  ,0x1754,0x1755,0x1756,0x1757,0x1758,0x1759,0x175A,0x175B,0x175C,0x175D,0x175E,0x175F
  ,0x176D
  ,0x1771,0x1774,0x1775,0x1776,0x1777,0x1778,0x1779,0x177A,0x177B,0x177C,0x177D,0x177E,0x177F
  ,0x17DE,0x17DF
  ,0x17EA,0x17EB,0x17EC,0x17ED,0x17EE,0x17EF
  ,0x17FA,0x17FB,0x17FC,0x17FD,0x17FE,0x17FF
  ,0x180F
  ,0x181A,0x181B,0x181C,0x181D,0x181E,0x181F
  ,0x1878,0x1879,0x187A,0x187B,0x187C,0x187D,0x187E,0x187F
  ,0x18AB,0x18AC,0x18AD,0x18AE,0x18AF
  ,0x18B0,0x18B1,0x18B2,0x18B3,0x18B4,0x18B5,0x18B6,0x18B7,0x18B8,0x18B9,0x18BA,0x18BB,0x18BC,0x18BD,0x18BE,0x18BF
  ,0x18C0,0x18C1,0x18C2,0x18C3,0x18C4,0x18C5,0x18C6,0x18C7,0x18C8,0x18C9,0x18CA,0x18CB,0x18CC,0x18CD,0x18CE,0x18CF
  ,0x18D0,0x18D1,0x18D2,0x18D3,0x18D4,0x18D5,0x18D6,0x18D7,0x18D8,0x18D9,0x18DA,0x18DB,0x18DC,0x18DD,0x18DE,0x18DF
  ,0x18E0,0x18E1,0x18E2,0x18E3,0x18E4,0x18E5,0x18E6,0x18E7,0x18E8,0x18E9,0x18EA,0x18EB,0x18EC,0x18ED,0x18EE,0x18EF
  ,0x18F0,0x18F1,0x18F2,0x18F3,0x18F4,0x18F5,0x18F6,0x18F7,0x18F8,0x18F9,0x18FA,0x18FB,0x18FC,0x18FD,0x18FE,0x18FF
  ,0x191F,0x192C,0x192D,0x192E,0x192F,0x193C,0x193D,0x193E,0x193F
  ,0x1941,0x1942,0x1943,0x196E,0x196F
  ,0x1975,0x1976,0x1977,0x1978,0x1979,0x197A,0x197B,0x197C,0x197D,0x197E,0x197F
  ,0x19AC,0x19AD,0x19AE,0x19AF
  ,0x19CA,0x19CB,0x19CC,0x19CD,0x19CE,0x19CF
  ,0x19DB,0x19DC,0x19DD
  ,0x1A1C,0x1A1D,0x1A5F,0x1A7D,0x1A7E
  ,0x1A8A,0x1A8B,0x1A8C,0x1A8D,0x1A8E,0x1A8F
  ,0x1A9A,0x1A9B,0x1A9C,0x1A9D,0x1A9E,0x1A9F
  ,0x1AAE,0x1AAF
  ,0x1AB0,0x1AB1,0x1AB2,0x1AB3,0x1AB4,0x1AB5,0x1AB6,0x1AB7,0x1AB8,0x1AB9,0x1ABA,0x1ABB,0x1ABC,0x1ABD,0x1ABE,0x1ABF
  ,0x1AC0,0x1AC1,0x1AC2,0x1AC3,0x1AC4,0x1AC5,0x1AC6,0x1AC7,0x1AC8,0x1AC9,0x1ACA,0x1ACB,0x1ACC,0x1ACD,0x1ACE,0x1ACF
  ,0x1AD0,0x1AD1,0x1AD2,0x1AD3,0x1AD4,0x1AD5,0x1AD6,0x1AD7,0x1AD8,0x1AD9,0x1ADA,0x1ADB,0x1ADC,0x1ADD,0x1ADE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x1F1F
  ,0x1F46,0x1F47,0x1F4E,0x1F4F
  ,0x1F58,0x1F5A,0x1F5C,0x1F5E
  ,0x1F7E,0x1F7F,0x1FB5,0x1FC5,0x1FD4,0x1FD5,0x1FDC
  ,0x1FF0,0x1FF1,0x1FF5,0x1FFF
  ,0x2000,0x2001,0x2002,0x2003,0x2004,0x2005,0x2006,0x2007,0x2008,0x2009,0x200A,0x200B,0x200C,0x200D,0x200E,0x200F
  ,0x2028,0x2029,0x202A,0x202B,0x202C,0x202D,0x202E,0x202F
  ,0x205F
  ,0x2060,0x2061,0x2062,0x2063,0x2064,0x2065,0x2066,0x2067,0x2068,0x2069,0x206A,0x206B,0x206C,0x206D,0x206E,0x206F
  ,0x2072,0x2073,0x208F,0x209D,0x209E,0x209F
  ,0x20F1,0x20F2,0x20F3,0x20F4,0x20F5,0x20F6,0x20F7,0x20F8,0x20F9,0x20FA,0x20FB,0x20FC,0x20FD,0x20FE,0x20FF
  ,0x214F
  ,0x2187,0x2188,0x218A,0x218B,0x218C,0x218D,0x218E,0x218F
  ,0x23E8,0x23F4,0x23F5,0x23F6,0x23F7,0x23FF
  ,0x2427,0x2428,0x2429,0x242A,0x242B,0x242C,0x242D,0x242E,0x242F
  ,0x2430,0x2431,0x2432,0x2433,0x2434,0x2435,0x2436,0x2437,0x2438,0x2439,0x243A,0x243B,0x243C,0x243D,0x243E,0x243F
  ,0x244B,0x244C,0x244D,0x244E,0x244F
  ,0x2450,0x2451,0x2452,0x2453,0x2454,0x2455,0x2456,0x2457,0x2458,0x2459,0x245A,0x245B,0x245C,0x245D,0x245E,0x245F
  ,0x269D,0x269E,0x269F
  ,0x26B3,0x26B4,0x26B5,0x26B6,0x26B7,0x26B8,0x26B9,0x26BA,0x26BB,0x26BC,0x26BF
  ,0x26C0,0x26C1,0x26C2,0x26C3,0x26C6,0x26C7,0x26C9,0x26CA,0x26CC,0x26CD
  ,0x26D0,0x26D2,0x26D5,0x26D6,0x26D7,0x26D8,0x26D9,0x26DA,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0x321D,0x321E,0x321F,0x3250
  ,0x327C,0x327D,0x327E
  ,0x32CC,0x32CD,0x32CE,0x32CF
  ,0x3377,0x3378,0x3379,0x337A
  ,0x33DE,0x33DF,0x33FF
  ,1376
  ,1442,1466,1477,1478,1479,1541
  ,2656,2657,2658,2659,2660,2661
  ,2810,2811,2812,2813,2814,2815,2901
  ,3329,3423
  ,4371,4372,4373,4374,4375,4376,4377,4378,4379
  ,4380,4381,4382,4383,4384,4385,4386,4387,4388,4389
  ,4390,4391,4392,4393,4394,4395,4396,4397,4398,4399
  ,4400,4401,4402,4403,4404,4405,4406,4407,4408,4409
  ,4410,4411,4412,4413,4414,4415,4416,4417,4418,4419
  ,4420,4421,4422,4423,4424,4425,4426,4427,4428,4429
  ,4430,4431,4432,4433,4434,4435,4436,4437,4438,4439
  ,4440,4441
  ,4470,4471,4472,4473,4474,4475,4476,4477,4478,4479
  ,4480,4481,4482,4483,4484,4485,4486,4487,4488,4489
  ,4490,4491,4492,4493,4494,4495,4496,4497,4498,4499
  ,4500,4501,4502,4503,4504,4505,4506,4507,4508,4509
  ,4511,4512,4513
  ,4547,4548,4549
  ,4550,4551,4552,4553,4554,4555,4556,4557,4558,4559
  ,4560,4561,4562,4563,4564,4565,4566,4567,4568,4569
  ,4570,4571,4572,4573,4574,4575,4576,4577,4578,4579
  ,4580,4581,4582,4583,4584,4585,4586,4587,4588,4589
  ,4590,4591,4592,4593,4594,4595,4596,4597,4598,4599
  ,4600,4601
  ,6988
  ,8384,8385,8386,8387,8388,8389,8390,8391,8392,8393,8394,8395,8396,8397,8398,8399
  ,8418
  ,12288,12644
};

final boolean cSAVE_FLG = false;
final int cSAVE_NUM = 10;
final int cSTART_NUM = 0;
final int cDIGIT_NUM = 2;

//// For Profile image size
//final int cMyWidth = 350;
//final int cMyHeight = 350;
//final String cFILE_NAME = "Characters_Profile_";

//// For Profile Banner image size
//final int cMyWidth = 1400;
//final int cMyHeight = 400;
//final String cFILE_NAME = "Characters_Profile_Banner_";

//// For Logo image size
//final int cMyWidth = 350;
//final int cMyHeight = 350;
//final String cFILE_NAME = "Characters_Logo_";

//// For Featured image size
//final int cMyWidth = 600;
//final int cMyHeight = 400;
//final String cFILE_NAME = "Characters_Featured_";

//// For Banner image size
//final int cMyWidth = 1400;
//final int cMyHeight = 400;
//final String cFILE_NAME = "Characters_Banner_";

// For HD
final int cMyWidth = 1280;
final int cMyHeight = 720;
final String cFILE_NAME = "Characters_";

//// For Full HD
//final int cMyWidth = 1920;
//final int cMyHeight = 1080;
//final String cFILE_NAME = "Characters_";

final boolean cLOOP_FLG = true;
final float cFRAME_RATE = 0.3;

void settings() {
  size(cMyWidth, cMyHeight);
}

void setup()
{
  noStroke();
  if (cSAVE_FLG)
  {
    noLoop();
  }
  else if (cLOOP_FLG)
  {
    frameRate(cFRAME_RATE);
  }
  else
  {
    noLoop();
  }
}

void draw()
{
  int loopMax = 1;
  
  if (cSAVE_FLG)
  {
    loopMax = cSAVE_NUM;
  }

  for (int i = 0; i < loopMax; i++)
  {
    myDraw();
    if (cSAVE_FLG)
    {
      LocalDateTime utcDateTime = LocalDateTime.now(ZoneId.of("UTC"));
      DateTimeFormatter dateFrmt = DateTimeFormatter.ofPattern("uuuuMMdd");
      DateTimeFormatter timeFrmt = DateTimeFormatter.ofPattern("HHmmss,SSSSSS");
      String dateStr = dateFrmt.format(utcDateTime);
      String timeStr = timeFrmt.format(utcDateTime);
      save(cFILE_NAME + "#" + nf(cSTART_NUM + i, cDIGIT_NUM)
        + "_" + dateStr + "T" + timeStr + "Z" + ".png");
    }
  }
}

void myDraw()
{
  PFont font = createFont("HiraginoSans-W4", 48);
  int[] codePoints = new int[1];
  float cellSize = 80;
  int startX = int(cellSize / 2 - (int(width) % int(cellSize)) / 2);
  int startY = int(cellSize / 2 - (int(height) % int(cellSize)) / 2);
  float h;

  colorMode(HSB, 360, 100, 100);
  h = random(360);
  rectMode(CENTER);
  textFont(font);
  textAlign(CENTER, CENTER);
  
  for (int y = startY; y <= height; y += cellSize)
  {
    for (int x = startX; x <= width; x += cellSize)
    {
      fill(h, 9, 100 * (1.0 - random(1.0) * random(1.0) * random(1.0)));
      rect(x, y, cellSize, cellSize);
    }
  }

  float d;
  int rnd;
  for (int y = startY; y <= height; y += cellSize)
  {
    for (int x = startX; x <= width; x += cellSize)
    {
      codePoints[0] = getCode();
      String str = new String(codePoints, 0, codePoints.length);
      rnd = int(random(10));
      if (rnd <= 1)
      {
        d = 240;
      }
      else if (rnd <= 3)
      {
        d = 120;
      }
      else
      {
        d = 180;
      }
      fill((h + d) % 360, random(96, 100), random(67, 77));
      text(str, x, y);
    }
  }
}

int getCode()
{
  int c = int(random(0x0021, 0x33FF));

  if (Arrays.stream(cExclusionCodeList).anyMatch(i -> i == c))
  {
    return getCode();
  }

  return c;
}

Processingでプログラミング向け日本語フォントを使えるようにしました

Processingでプログラミング向け日本語フォントを使えるようにしました。環境はMacBook Air, macOS Monterey 12.4。フォントはIPAゴシック。Processingは4.0b8。4.0b7では、日本語の表示と入力位置にずれが生じていました。

手順は以下の通りです。

  1. 文字情報技術促進協議会のIPAフォントのページから、TTFファイルのIPAゴシック(Ver.003.03)をダウンロード
  2. ファインダーでipag.ttfをダブルクリック
  3. フォントのプレビューウインドウが開くので「フォントをインストール」をクリック
  4. Processingを起動
  5. ProcessingメニューのPreferences...を選択
  6. 「エディタとコンソールのフォント」でIPAGothicを選択

これで、より快適にプログラミングできるようになりました。よかったです。

Auto Generated Eyesをつくりました

Auto Generated Eyesをつくりました。ジェネレーティブアートです。色と大きさを変化させた目のモチーフを多数並べました。

opensea.io

以下はソースコードです。開発環境はMacBook Air、Processingです。

Eyes.pde

// Eyes
import  java.time.LocalDateTime;
import  java.time.ZoneId;
import  java.time.format.DateTimeFormatter;

final boolean cSAVE_FLG = false;
final int cSAVE_NUM = 20;
final int cSTART_NUM = 0;
final int cDIGIT_NUM = 2;

//// For Logo image size
//final int cMyWidth = 350;
//final int cMyHeight = 350;
//final String cFILE_NAME = "Eyes_Logo_";

//// For Featured image size
//final int cMyWidth = 600;
//final int cMyHeight = 400;
//final String cFILE_NAME = "Eyes_Featured_";

//// For Banner image size
//final int cMyWidth = 1400;
//final int cMyHeight = 400;
//final String cFILE_NAME = "Eyes_Banner_";

// For HD
final int cMyWidth = 1280;
final int cMyHeight = 720;
final String cFILE_NAME = "Eyes_";

//// For Full HD
//final int cMyWidth = 1920;
//final int cMyHeight = 1080;
//final String cFILE_NAME = "Eyes_";

//// For Test
//final int cMyWidth = 800;
//final int cMyHeight = 450;
//final String cFILE_NAME = "Eyes_";

final boolean cLOOP_FLG = true;
final float cFRAME_RATE = 0.3;

final int cCELL_SIZE = 60;
final float cEYE_RATIO = 0.8;
Eye e;
float adjustmentValueX = 0.0;
float adjustmentValueY = 0.0;
int maxH = 0;
int maxV = 0;

void settings()
{
  size(cMyWidth, cMyHeight);
}

void setup()
{
  if (cSAVE_FLG)
  {
    noLoop();
  }
  else if (cLOOP_FLG)
  {
    frameRate(cFRAME_RATE);
  }
  else
  {
    noLoop();
  }

  e = new Eye(width / 2, height / 2, int(cCELL_SIZE * cEYE_RATIO));
  maxH = int(width / cCELL_SIZE) + 1;
  maxV = int(height / cCELL_SIZE) + 1;
  adjustmentValueX = (maxH * cCELL_SIZE - width) / 2;
  adjustmentValueY = (maxV * cCELL_SIZE - height) / 2;
}

void draw()
{
  int loopMax = 1;
  
  if (cSAVE_FLG)
  {
    loopMax = cSAVE_NUM;
  }

  for (int i = 0; i < loopMax; i++)
  {
    myDraw();
    if (cSAVE_FLG)
    {
      LocalDateTime utcDateTime = LocalDateTime.now(ZoneId.of("UTC"));
      DateTimeFormatter dateFrmt = DateTimeFormatter.ofPattern("uuuuMMdd");
      DateTimeFormatter timeFrmt = DateTimeFormatter.ofPattern("HHmmss,SSSSSS");
      String dateStr = dateFrmt.format(utcDateTime);
      String timeStr = timeFrmt.format(utcDateTime);
      save(cFILE_NAME + "#" + nf(cSTART_NUM + i, cDIGIT_NUM)
        + "_" + dateStr + "T" + timeStr + "Z" + ".png");
    }
  }
}

void myDraw()
{
  background(random(0, 256));
  colorMode(HSB, 360, 100, 100);
  float hue = 0.0;
  float lookX = random(width + cCELL_SIZE + 1);
  float lookY = random(height + cCELL_SIZE + 1);
  int brightness = int(random(25, 101));

  e.setLookPoint(int(lookX / cCELL_SIZE) * cCELL_SIZE - int(adjustmentValueX), 
    int(int(lookY) / cCELL_SIZE) * cCELL_SIZE - int(adjustmentValueY));
  for (int v = 0; v < maxV; v++)
  {
     for (int h = 0; h < maxH; h++)
     {
       if (random(40) < 1.0) continue;
        e.setSize(
          int(cCELL_SIZE 
          * ((random(cEYE_RATIO - 0.25, cEYE_RATIO + 0.09) 
            + random(cEYE_RATIO - 0.25, cEYE_RATIO + 0.09)) / 2)));
        e.setPosition(int(0.0 - adjustmentValueX) + cCELL_SIZE * h + cCELL_SIZE / 2, 
          int(0.0 - adjustmentValueY) + cCELL_SIZE * v + cCELL_SIZE / 2);

        hue = random(360);
        e.setEyeballColor(color(hue, 35, 100));
        e.setIrisColor(color(int(hue + 180) % 360, 35, brightness));
        e.setIrisRatio(random(0.4, 0.6));
        e.draw();
     }
  }
}

Eye.pde

// Eye

class Eye
{
  int x;
  int y;
  int size;
  int lookX = 0;
  int lookY = 0;
  float lookAngle = 0.0;
  color eyeballColor = color(255);
  color irisColor = color(0);
  float irisRatio = 0.5;
  
  Eye(int tmpX, int tmpY, int tmpSize)
  {
    x = tmpX;
    y = tmpY;
    size = tmpSize;
  }

  void setPosition(int tmpX, int tmpY)
  {
    x = tmpX;
    y = tmpY;
    setLookPoint(lookX, lookY);
  }

  void setSize(int tmpSize)
  {
    size = tmpSize;
  }

  void setLookPoint(int tmpX, int tmpY)
  {
    lookX = tmpX;
    lookY = tmpY;
    lookAngle = atan2(tmpY - y, tmpX - x);
  }
  
  void setEyeballColor(color tmpColor)
  {
    eyeballColor = tmpColor;
  }
  
  void setIrisColor(color tmpColor)
  {
    irisColor = tmpColor;
  }
  
  void setIrisRatio(float tmpRatio)
  {
    irisRatio = tmpRatio;
  }
  
  void draw()
  {
    pushMatrix();
    translate(x, y);
    noStroke();
    fill(eyeballColor);
    ellipse(0, 0, size, size);
    rotate(lookAngle);
    fill(irisColor);
    ellipse(size / 2 - size * irisRatio / 2, 0, size * irisRatio, size * irisRatio);
    popMatrix();
  }
}

Auto Generated Circles 2をつくりました

Auto Generated Circles 2をつくりました。ジェネレーティブアートです。色と大きさを漸次的に変化させた多数の円をランダムな位置に描画しました。

opensea.io

以下はソースコードです。開発環境はMacBook Air、Processingです。

// Circles2
import  java.time.LocalDateTime;
import  java.time.ZoneId;
import  java.time.format.DateTimeFormatter;

final boolean cSAVE_FLG = false;
final int cSAVE_NUM = 1;
final int cSTART_NUM = 0;
final int cDIGIT_NUM = 2;

//// For Profile image size
//final int cMyWidth = 350;
//final int cMyHeight = 350;
//final String cFILE_NAME = "Circles2_Profile_";

//// For Profile Banner image size
//final int cMyWidth = 1400;
//final int cMyHeight = 400;
//final String cFILE_NAME = "Circles2_Profile_Banner_";

//// For Logo image size
//final int cMyWidth = 350;
//final int cMyHeight = 350;
//final String cFILE_NAME = "Circles2_Logo_";

//// For Featured image size
//final int cMyWidth = 600;
//final int cMyHeight = 400;
//final String cFILE_NAME = "Circles2_Featured_";

//// For Banner image size
//final int cMyWidth = 1400;
//final int cMyHeight = 400;
//final String cFILE_NAME = "Circles2_Banner_";

// For HD
final int cMyWidth = 1280;
final int cMyHeight = 720;
final String cFILE_NAME = "Circles2_";

//// For Full HD
//final int cMyWidth = 1920;
//final int cMyHeight = 1080;
//final String cFILE_NAME = "Circles2_";

final boolean cLOOP_FLG = true;
final float cFRAME_RATE = 0.3;

void settings() {
  size(cMyWidth, cMyHeight);
}

void setup()
{
  noStroke();
  if (cSAVE_FLG)
  {
    noLoop();
  }
  else if (cLOOP_FLG)
  {
    frameRate(cFRAME_RATE);
  }
  else
  {
    noLoop();
  }
}

void draw()
{
  int loopMax = 1;
  
  if (cSAVE_FLG)
  {
    loopMax = cSAVE_NUM;
  }

  for (int i = 0; i < loopMax; i++)
  {
    myDraw();
    if (cSAVE_FLG)
    {
      LocalDateTime utcDateTime = LocalDateTime.now(ZoneId.of("UTC"));
      DateTimeFormatter dateFrmt = DateTimeFormatter.ofPattern("uuuuMMdd");
      DateTimeFormatter timeFrmt = DateTimeFormatter.ofPattern("HHmmss,SSSSSS");
      String dateStr = dateFrmt.format(utcDateTime);
      String timeStr = timeFrmt.format(utcDateTime);
      save(cFILE_NAME + "#" + nf(cSTART_NUM + i, cDIGIT_NUM)
        + "_" + dateStr + "T" + timeStr + "Z" + ".png");
    }
  }
}

void myDraw()
{
  background(255);
  int red = int(random(255));
  int green = int(random(255));
  int blue = int(random(255));
  int redUnit = int(random(1, 3));
  int greenUnit = int(random(1, 3));
  int blueUnit = int(random(1, 3));
  int diameter = min(width, height);

  while (diameter >= 1)
  {
    fill(red, green, blue, 215);
    ellipse(int(random(width)), int(random(height)), diameter, diameter);
    red = (red + redUnit) % 256;
    green = (green + greenUnit) % 256;
    blue = (blue + blueUnit) % 256;
    diameter--;
  }
}

ModulatedEllipseクラスにサイン波で楕円を変調する機能を追加しました

ModulatedEllipseクラスに以下の4メソッドを追加しました。

setSineEffectRatio()

setSineFrequency()

setSinePhase()

setSinePowerValue()

setSineEffectRatio()で、サイン波変調の効き具合を指定できます。範囲は0.0〜1.0で、値が高いほど効果が強くなります。

setSineFrequency()では、サイン波変調の周期波の繰り返し回数を指定できます。楕円は指定された回数の小片に分けられます。引数は整数で指定します。

setSineFrequency()を利用して作成した図形の例
setSineFrequency()を利用して作成した図形の例

setSinePhase()では、サイン波変調の角度を指定できます。引数の単位はラジアンです。

setSinePhase()を利用して作成した図形の例
setSinePhase()を利用して作成した図形の例

setSinePowerValue()では、サイン波変調に変化を与えることができます。引数が大きいほど、分割された小片の幅が太くなります。

setSinePowerValue()を利用して作成した図形の例
setSinePowerValue()を利用して作成した図形の例

以下はソースコードです。開発環境はMacBook Air、Processingです。

ModulatedEllipseSample.pde

// ModulatedEllipseSample

final int cMyWidth = 1280;
final int cMyHeight = 720;

ModulatedEllipse e;

void settings()
{
  size(cMyWidth, cMyHeight);
}

void setup()
{
  noLoop();
}

void draw()
{
  float cellWidth = width / 6;
  float cellHeight = height / 3;

  e = new ModulatedEllipse(0, 0, cellWidth - 10, cellHeight - 10);

  int i;
  float x = cellWidth / 2;
  float y = cellHeight / 2;
  e.setNoiseSmoothRatio(1.0);
  e.setNoiseEffectRatio(0.0);
  e.setNoiseSymmetry(false);
  e.setVertexNum(628);
  e.setXCoordinateBase(0);
  e.setSineEffectRatio(1.0);
  e.setSineFrequency(1);
  e.setSinePhase(0.0);
  e.setSinePowerValue(1.0);
  for (i = 0; i < 6; i++)
  {
    e.setPosition(x, y);
    e.setSineFrequency(i + 1);
    e.draw();
    fill(0);
    text("NoiseSmoothRatio:" + e.getNoiseSmoothRatio(), x - cellWidth / 2, y - cellHeight / 2 + 10);
    text("NoiseEffectRatio:" + e.getNoiseEffectRatio(), x - cellWidth / 2, y - cellHeight / 2 + 25);
    text("NoiseSymmetry:" + e.getNoiseSymmetry(), x - cellWidth / 2, y - cellHeight / 2 + 40);
    text("VertexNum:" + e.getVertexNum(), x - cellWidth / 2, y - cellHeight / 2 + 55);
    text("XCoordinateBase:" + e.getXCoordinateBase(), x - cellWidth / 2, y - cellHeight / 2 + 70);
    text("SineEffectRatio:" + e.getSineEffectRatio(), x - cellWidth / 2, y - cellHeight / 2 + 85);
    text("SineFrequency:" + e.getSineFrequency(), x - cellWidth / 2, y - cellHeight / 2 + 100);
    text("SinePhase:" + e.getSinePhase(), x - cellWidth / 2, y - cellHeight / 2 + 115);
    text("SinePowerValue:" + e.getSinePowerValue(), x - cellWidth / 2, y - cellHeight / 2 + 130);
    fill(255);

    x += cellWidth;
  }
  
  x = cellWidth / 2;
  y += cellHeight;
  e.setNoiseSmoothRatio(1.0);
  e.setNoiseEffectRatio(0.0);
  e.setNoiseSymmetry(false);
  e.setVertexNum(628);
  e.setXCoordinateBase(0);
  e.setSineEffectRatio(0.8);
  e.setSineFrequency(1);
  e.setSinePhase(0.0);
  e.setSinePowerValue(1.0);
  for (i = 0; i < 6; i++)
  {
    e.setPosition(x, y);
    e.setSineFrequency(i + 1);
    e.draw();
    fill(0);
    text("NoiseSmoothRatio:" + e.getNoiseSmoothRatio(), x - cellWidth / 2, y - cellHeight / 2 + 10);
    text("NoiseEffectRatio:" + e.getNoiseEffectRatio(), x - cellWidth / 2, y - cellHeight / 2 + 25);
    text("NoiseSymmetry:" + e.getNoiseSymmetry(), x - cellWidth / 2, y - cellHeight / 2 + 40);
    text("VertexNum:" + e.getVertexNum(), x - cellWidth / 2, y - cellHeight / 2 + 55);
    text("XCoordinateBase:" + e.getXCoordinateBase(), x - cellWidth / 2, y - cellHeight / 2 + 70);
    text("SineEffectRatio:" + e.getSineEffectRatio(), x - cellWidth / 2, y - cellHeight / 2 + 85);
    text("SineFrequency:" + e.getSineFrequency(), x - cellWidth / 2, y - cellHeight / 2 + 100);
    text("SinePhase:" + e.getSinePhase(), x - cellWidth / 2, y - cellHeight / 2 + 115);
    text("SinePowerValue:" + e.getSinePowerValue(), x - cellWidth / 2, y - cellHeight / 2 + 130);
    fill(255);

    x += cellWidth;
  }

  x = cellWidth / 2;
  y += cellHeight;
  e.setNoiseSmoothRatio(0.0);
  e.setNoiseEffectRatio(0.3);
  e.setNoiseSymmetry(false);
  e.setVertexNum(628);
  e.setXCoordinateBase(0);
  e.setSineEffectRatio(0.8);
  e.setSineFrequency(1);
  e.setSinePhase(0.0);
  e.setSinePowerValue(1.0);
  for (i = 0; i < 6; i++)
  {
    e.setPosition(x, y);
    e.setSineFrequency(i + 1);
    e.draw();
    fill(0);
    text("NoiseSmoothRatio:" + e.getNoiseSmoothRatio(), x - cellWidth / 2, y - cellHeight / 2 + 10);
    text("NoiseEffectRatio:" + e.getNoiseEffectRatio(), x - cellWidth / 2, y - cellHeight / 2 + 25);
    text("NoiseSymmetry:" + e.getNoiseSymmetry(), x - cellWidth / 2, y - cellHeight / 2 + 40);
    text("VertexNum:" + e.getVertexNum(), x - cellWidth / 2, y - cellHeight / 2 + 55);
    text("XCoordinateBase:" + e.getXCoordinateBase(), x - cellWidth / 2, y - cellHeight / 2 + 70);
    text("SineEffectRatio:" + e.getSineEffectRatio(), x - cellWidth / 2, y - cellHeight / 2 + 85);
    text("SineFrequency:" + e.getSineFrequency(), x - cellWidth / 2, y - cellHeight / 2 + 100);
    text("SinePhase:" + e.getSinePhase(), x - cellWidth / 2, y - cellHeight / 2 + 115);
    text("SinePowerValue:" + e.getSinePowerValue(), x - cellWidth / 2, y - cellHeight / 2 + 130);
    fill(255);

    x += cellWidth;
  }
}

//void draw()
//{
//  float cellWidth = width / 6;
//  float cellHeight = height / 3;

//  e = new ModulatedEllipse(0, 0, cellWidth - 10, cellHeight - 10);

//  int i;
//  float x = cellWidth / 2;
//  float y = cellHeight / 2;
//  e.setNoiseSmoothRatio(1.0);
//  e.setNoiseEffectRatio(0.0);
//  e.setNoiseSymmetry(false);
//  e.setVertexNum(628);
//  e.setXCoordinateBase(0);
//  e.setSineEffectRatio(1.0);
//  e.setSineFrequency(1);
//  e.setSinePhase(0.0);
//  e.setSinePowerValue(1.0);
//  for (i = 0; i < 6; i++)
//  {
//    e.setPosition(x, y);
//    e.setSinePhase(PI * i / 5);
//    e.draw();
//    fill(0);
//    text("NoiseSmoothRatio:" + e.getNoiseSmoothRatio(), x - cellWidth / 2, y - cellHeight / 2 + 10);
//    text("NoiseEffectRatio:" + e.getNoiseEffectRatio(), x - cellWidth / 2, y - cellHeight / 2 + 25);
//    text("NoiseSymmetry:" + e.getNoiseSymmetry(), x - cellWidth / 2, y - cellHeight / 2 + 40);
//    text("VertexNum:" + e.getVertexNum(), x - cellWidth / 2, y - cellHeight / 2 + 55);
//    text("XCoordinateBase:" + e.getXCoordinateBase(), x - cellWidth / 2, y - cellHeight / 2 + 70);
//    text("SineEffectRatio:" + e.getSineEffectRatio(), x - cellWidth / 2, y - cellHeight / 2 + 85);
//    text("SineFrequency:" + e.getSineFrequency(), x - cellWidth / 2, y - cellHeight / 2 + 100);
//    text("SinePhase:" + e.getSinePhase(), x - cellWidth / 2, y - cellHeight / 2 + 115);
//    text("SinePowerValue:" + e.getSinePowerValue(), x - cellWidth / 2, y - cellHeight / 2 + 130);
//    fill(255);

//    x += cellWidth;
//  }
  
//  x = cellWidth / 2;
//  y += cellHeight;
//  e.setNoiseSmoothRatio(1.0);
//  e.setNoiseEffectRatio(0.0);
//  e.setNoiseSymmetry(false);
//  e.setVertexNum(628);
//  e.setXCoordinateBase(0);
//  e.setSineEffectRatio(1.0);
//  e.setSineFrequency(1);
//  e.setSinePhase(0.0);
//  e.setSinePowerValue(1.0);
//  for (i = 0; i < 6; i++)
//  {
//    e.setPosition(x, y);
//    e.setSinePhase(PI + PI * i / 5);
//    e.draw();
//    fill(0);
//    text("NoiseSmoothRatio:" + e.getNoiseSmoothRatio(), x - cellWidth / 2, y - cellHeight / 2 + 10);
//    text("NoiseEffectRatio:" + e.getNoiseEffectRatio(), x - cellWidth / 2, y - cellHeight / 2 + 25);
//    text("NoiseSymmetry:" + e.getNoiseSymmetry(), x - cellWidth / 2, y - cellHeight / 2 + 40);
//    text("VertexNum:" + e.getVertexNum(), x - cellWidth / 2, y - cellHeight / 2 + 55);
//    text("XCoordinateBase:" + e.getXCoordinateBase(), x - cellWidth / 2, y - cellHeight / 2 + 70);
//    text("SineEffectRatio:" + e.getSineEffectRatio(), x - cellWidth / 2, y - cellHeight / 2 + 85);
//    text("SineFrequency:" + e.getSineFrequency(), x - cellWidth / 2, y - cellHeight / 2 + 100);
//    text("SinePhase:" + e.getSinePhase(), x - cellWidth / 2, y - cellHeight / 2 + 115);
//    text("SinePowerValue:" + e.getSinePowerValue(), x - cellWidth / 2, y - cellHeight / 2 + 130);
//    fill(255);

//    x += cellWidth;
//  }

//  x = cellWidth / 2;
//  y += cellHeight;
//  e.setNoiseSmoothRatio(0.0);
//  e.setNoiseEffectRatio(0.3);
//  e.setNoiseSymmetry(false);
//  e.setVertexNum(628);
//  e.setXCoordinateBase(0);
//  e.setSineEffectRatio(1.0);
//  e.setSineFrequency(1);
//  e.setSinePhase(0.0);
//  e.setSinePowerValue(1.0);
//  for (i = 0; i < 6; i++)
//  {
//    e.setPosition(x, y);
//    e.setSinePhase(PI * i / 5);
//    e.draw();
//    fill(0);
//    text("NoiseSmoothRatio:" + e.getNoiseSmoothRatio(), x - cellWidth / 2, y - cellHeight / 2 + 10);
//    text("NoiseEffectRatio:" + e.getNoiseEffectRatio(), x - cellWidth / 2, y - cellHeight / 2 + 25);
//    text("NoiseSymmetry:" + e.getNoiseSymmetry(), x - cellWidth / 2, y - cellHeight / 2 + 40);
//    text("VertexNum:" + e.getVertexNum(), x - cellWidth / 2, y - cellHeight / 2 + 55);
//    text("XCoordinateBase:" + e.getXCoordinateBase(), x - cellWidth / 2, y - cellHeight / 2 + 70);
//    text("SineEffectRatio:" + e.getSineEffectRatio(), x - cellWidth / 2, y - cellHeight / 2 + 85);
//    text("SineFrequency:" + e.getSineFrequency(), x - cellWidth / 2, y - cellHeight / 2 + 100);
//    text("SinePhase:" + e.getSinePhase(), x - cellWidth / 2, y - cellHeight / 2 + 115);
//    text("SinePowerValue:" + e.getSinePowerValue(), x - cellWidth / 2, y - cellHeight / 2 + 130);
//    fill(255);

//    x += cellWidth;
//  }
//}

//void draw()
//{
//  float cellWidth = width / 6;
//  float cellHeight = height / 3;

//  e = new ModulatedEllipse(0, 0, cellWidth - 10, cellHeight - 10);

//  int i;
//  float x = cellWidth / 2;
//  float y = cellHeight / 2;
//  e.setNoiseSmoothRatio(1.0);
//  e.setNoiseEffectRatio(0.0);
//  e.setNoiseSymmetry(false);
//  e.setVertexNum(628);
//  e.setXCoordinateBase(0);
//  e.setSineEffectRatio(1.0);
//  e.setSineFrequency(1);
//  e.setSinePhase(0.0);
//  e.setSinePowerValue(0.5);
//  for (i = 0; i < 6; i++)
//  {
//    e.setPosition(x, y);
//    e.setSineFrequency(i + 1);
//    e.draw();
//    fill(0);
//    text("NoiseSmoothRatio:" + e.getNoiseSmoothRatio(), x - cellWidth / 2, y - cellHeight / 2 + 10);
//    text("NoiseEffectRatio:" + e.getNoiseEffectRatio(), x - cellWidth / 2, y - cellHeight / 2 + 25);
//    text("NoiseSymmetry:" + e.getNoiseSymmetry(), x - cellWidth / 2, y - cellHeight / 2 + 40);
//    text("VertexNum:" + e.getVertexNum(), x - cellWidth / 2, y - cellHeight / 2 + 55);
//    text("XCoordinateBase:" + e.getXCoordinateBase(), x - cellWidth / 2, y - cellHeight / 2 + 70);
//    text("SineEffectRatio:" + e.getSineEffectRatio(), x - cellWidth / 2, y - cellHeight / 2 + 85);
//    text("SineFrequency:" + e.getSineFrequency(), x - cellWidth / 2, y - cellHeight / 2 + 100);
//    text("SinePhase:" + e.getSinePhase(), x - cellWidth / 2, y - cellHeight / 2 + 115);
//    text("SinePowerValue:" + e.getSinePowerValue(), x - cellWidth / 2, y - cellHeight / 2 + 130);
//    fill(255);

//    x += cellWidth;
//  }
  
//  x = cellWidth / 2;
//  y += cellHeight;
//  e.setNoiseSmoothRatio(1.0);
//  e.setNoiseEffectRatio(0.0);
//  e.setNoiseSymmetry(false);
//  e.setVertexNum(628);
//  e.setXCoordinateBase(0);
//  e.setSineEffectRatio(0.8);
//  e.setSineFrequency(1);
//  e.setSinePhase(0.0);
//  e.setSinePowerValue(3.0);
//  for (i = 0; i < 6; i++)
//  {
//    e.setPosition(x, y);
//    e.setSineFrequency(i + 1);
//    e.draw();
//    fill(0);
//    text("NoiseSmoothRatio:" + e.getNoiseSmoothRatio(), x - cellWidth / 2, y - cellHeight / 2 + 10);
//    text("NoiseEffectRatio:" + e.getNoiseEffectRatio(), x - cellWidth / 2, y - cellHeight / 2 + 25);
//    text("NoiseSymmetry:" + e.getNoiseSymmetry(), x - cellWidth / 2, y - cellHeight / 2 + 40);
//    text("VertexNum:" + e.getVertexNum(), x - cellWidth / 2, y - cellHeight / 2 + 55);
//    text("XCoordinateBase:" + e.getXCoordinateBase(), x - cellWidth / 2, y - cellHeight / 2 + 70);
//    text("SineEffectRatio:" + e.getSineEffectRatio(), x - cellWidth / 2, y - cellHeight / 2 + 85);
//    text("SineFrequency:" + e.getSineFrequency(), x - cellWidth / 2, y - cellHeight / 2 + 100);
//    text("SinePhase:" + e.getSinePhase(), x - cellWidth / 2, y - cellHeight / 2 + 115);
//    text("SinePowerValue:" + e.getSinePowerValue(), x - cellWidth / 2, y - cellHeight / 2 + 130);
//    fill(255);

//    x += cellWidth;
//  }

//  x = cellWidth / 2;
//  y += cellHeight;
//  e.setNoiseSmoothRatio(1.0);
//  e.setNoiseEffectRatio(0.0);
//  e.setNoiseSymmetry(false);
//  e.setVertexNum(628);
//  e.setXCoordinateBase(0);
//  e.setSineEffectRatio(0.8);
//  e.setSineFrequency(1);
//  e.setSinePhase(0.0);
//  e.setSinePowerValue(10.0);
//  for (i = 0; i < 6; i++)
//  {
//    e.setPosition(x, y);
//    e.setSineFrequency(i + 1);
//    e.draw();
//    fill(0);
//    text("NoiseSmoothRatio:" + e.getNoiseSmoothRatio(), x - cellWidth / 2, y - cellHeight / 2 + 10);
//    text("NoiseEffectRatio:" + e.getNoiseEffectRatio(), x - cellWidth / 2, y - cellHeight / 2 + 25);
//    text("NoiseSymmetry:" + e.getNoiseSymmetry(), x - cellWidth / 2, y - cellHeight / 2 + 40);
//    text("VertexNum:" + e.getVertexNum(), x - cellWidth / 2, y - cellHeight / 2 + 55);
//    text("XCoordinateBase:" + e.getXCoordinateBase(), x - cellWidth / 2, y - cellHeight / 2 + 70);
//    text("SineEffectRatio:" + e.getSineEffectRatio(), x - cellWidth / 2, y - cellHeight / 2 + 85);
//    text("SineFrequency:" + e.getSineFrequency(), x - cellWidth / 2, y - cellHeight / 2 + 100);
//    text("SinePhase:" + e.getSinePhase(), x - cellWidth / 2, y - cellHeight / 2 + 115);
//    text("SinePowerValue:" + e.getSinePowerValue(), x - cellWidth / 2, y - cellHeight / 2 + 130);
//    fill(255);

//    x += cellWidth;
//  }
//}

ModulatedEllipse.pde

// ModulatedEllipse

class ModulatedEllipse
{
  float mCenterX = 0;
  float mCenterY = 0;
  float mDiameterH = 100;
  float mDiameterV = 100;
  float mNoiseSmoothRatio = 1.0;
  float mNoiseRoughnessCoefficient = 0.0;
  float mNoiseEffectRatio = 0.5;
  boolean mNoiseSymmetryFlg = false;
  int mVertexNum = 628;
  int mXCoordinateBase = 0;
  float mSineEffectRatio = 1.0;
  float mSineFrequency = 1.0;
  float mSinePhase = 0.0;
  float mSinePowerValue = 1.0;

  ModulatedEllipse(float x, float y, float h, float v)
  {
    mCenterX = x;
    mCenterY = y;
    mDiameterH = h;
    mDiameterV = v;
  }

  void setPosition(float x, float y)
  {
    mCenterX = x;
    mCenterY = y;
  }

  void setNoiseSmoothRatio(float r)
  {
    mNoiseSmoothRatio = r;
    mNoiseRoughnessCoefficient = map((1.0 - mNoiseSmoothRatio), 0, 1.0, 0.005, 0.1);
  }

  float getNoiseSmoothRatio()
  {
    return mNoiseSmoothRatio;
  }
  
  void setNoiseEffectRatio(float r)
  {
    mNoiseEffectRatio = r;
  }
  
  float getNoiseEffectRatio()
  {
    return mNoiseEffectRatio;
  }
  
  void setNoiseSymmetry(boolean f)
  {
    mNoiseSymmetryFlg = f;
  }
  
  boolean getNoiseSymmetry()
  {
    return mNoiseSymmetryFlg;
  }
  
  void setVertexNum(int n)
  {
    mVertexNum = n;
  }
  
  int getVertexNum()
  {
    return int(mVertexNum);
  }
  
  void setXCoordinateBase(int c)
  {
    mXCoordinateBase = c;
  }
  
  int getXCoordinateBase()
  {
    return mXCoordinateBase;
  }
  
  void setSineEffectRatio(float r)
  {
    mSineEffectRatio = r;
  }
  
  float getSineEffectRatio()
  {
    return mSineEffectRatio;
  }
  
  void setSineFrequency(int f)
  {
    mSineFrequency = f;
  }
  
  int getSineFrequency()
  {
    return int(mSineFrequency);
  }

  void setSinePhase(float p)
  {
    mSinePhase = p;
  }

  float getSinePhase()
  {
    return mSinePhase;
  }

  void setSinePowerValue(float v)
  {
    mSinePowerValue = v;
  }

  float getSinePowerValue()
  {
    return mSinePowerValue;
  }

  void draw()
  {
    float h = mDiameterH / 2.0;
    float v = mDiameterV / 2.0;
    
    int xCoordinate = 1;
    int cnt = 0;
    float theta = 0.0;
    beginShape();
    for (cnt = -1; cnt <= mVertexNum + 1; cnt++)
    {
      theta = TWO_PI * cnt / mVertexNum;

      if (mNoiseSymmetryFlg)
      {
        if (cnt < 0)
        {
          xCoordinate = 2;
        }
        else if (cnt >= mVertexNum)
        {
          xCoordinate = 1 + cnt % mVertexNum;
        }
        else
        {
          if (cnt > int(mVertexNum / 2.0))
          {
            xCoordinate = int(mVertexNum / 2.0) - (cnt - int(mVertexNum / 2.0));
          }
          else
          {
            xCoordinate = cnt + 1;
          }
        }
      }
      else
      {
        if (cnt < 0)
        {
          xCoordinate = mVertexNum;
        }
        else if (cnt >= mVertexNum)
        {
          xCoordinate = 1 + cnt % mVertexNum;
        }
        else
        {
          xCoordinate = cnt + 1;
        }
      }

      curveVertex(
        mCenterX 
          + cos(-HALF_PI + theta) * h 
          * (1.0 - noise(mXCoordinateBase + xCoordinate * mNoiseRoughnessCoefficient) * mNoiseEffectRatio) 
          * (1.0 - pow(abs(sin((theta * mSineFrequency - mSinePhase) / 2.0)), mSinePowerValue) * mSineEffectRatio), 
        mCenterY 
          + sin(-HALF_PI + theta) * v 
          * (1.0 - noise(mXCoordinateBase + xCoordinate * mNoiseRoughnessCoefficient) * mNoiseEffectRatio) 
          * (1.0 - pow(abs(sin((theta * mSineFrequency - mSinePhase) / 2.0)), mSinePowerValue) * mSineEffectRatio));
    }
    endShape(CLOSE);
  }
}

ModulatedEllipseクラスにsetXCoordinateBase()を追加しました

ModulatedEllipseクラスに機能を追加しました。setXCoordinateBase()です。

noise関数は与える引数が同じであれば、同じ値を返します。そのため、ModulatedEllipseクラスを使って図形を作成した場合、ノイズの滑らかさや効き具合等の設定が同じなら、同じ図形が作成されます。

ノイズの滑らかさや効き具合等の設定が同じでも、違う図形も作成することができるように、setXCoordinateBase()を作成しました。

setXCoordinateBase()で渡す値が同じで、他の設定も同じなら、同じ図形が作成されます。

setXCoordinateBase()で渡す値が異なるなら、他の設定が同じでも、違う図形が作成されます。

setSCoordinateBase()を利用して作成した図形の例
setSCoordinateBase()を利用して作成した図形の例

以下はソースコードです。開発環境はMacBook Air、Processingです。

ModulatedEllipseSample.pde

// ModulatedEllipseSample

final int cMyWidth = 1280;
final int cMyHeight = 720;

ModulatedEllipse e;

void settings()
{
  size(cMyWidth, cMyHeight);
}

void setup()
{
  noLoop();
}

void draw()
{
  float cellWidth = width / 6;
  float cellHeight = height / 3;

  e = new ModulatedEllipse(0, 0, cellWidth - 10, cellHeight - 10);

  int i;
  float x = cellWidth / 2;
  float y = cellHeight / 2;
  e.setNoiseSmoothRatio(0.5);
  e.setNoiseEffectRatio(0.5);
  e.setVertexNum(600);
  e.setNoiseSymmetry(false);
  for (i = 0; i < 6; i++)
  {
    e.setPosition(x, y);
    e.setXCoordinateBase((i + 1) * 1000);
    e.draw();
    fill(0);
    text("NoiseSmoothRatio:0.5", x - cellWidth / 2, y - cellHeight / 2 + 10);
    text("NoiseEffectRatio:0.5", x - cellWidth / 2, y - cellHeight / 2 + 25);
    text("Symmetry:false", x - cellWidth / 2, y - cellHeight / 2 + 40);
    text("VertexNum:600", x - cellWidth / 2, y - cellHeight / 2 + 55);
    text("XCoordinateBase:" + ((i + 1) * 1000), x - cellWidth / 2, y - cellHeight / 2 + 70);
    fill(255);

    x += cellWidth;
  }
  
  x = cellWidth / 2;
  y += cellHeight;
  e.setNoiseSmoothRatio(0.5);
  e.setNoiseEffectRatio(0.5);
  e.setVertexNum(600);
  e.setNoiseSymmetry(false);
  for (i = 0; i < 6; i++)
  {
    e.setPosition(x, y);
    e.setXCoordinateBase((i + 1) * 1000);
    e.draw();
    fill(0);
    text("NoiseSmoothRatio:0.5", x - cellWidth / 2, y - cellHeight / 2 + 10);
    text("NoiseEffectRatio:0.5", x - cellWidth / 2, y - cellHeight / 2 + 25);
    text("Symmetry:false", x - cellWidth / 2, y - cellHeight / 2 + 40);
    text("VertexNum:600", x - cellWidth / 2, y - cellHeight / 2 + 55);
    text("XCoordinateBase:" + ((i + 1) * 1000), x - cellWidth / 2, y - cellHeight / 2 + 70);
    fill(255);

    x += cellWidth;
  }

  x = cellWidth / 2;
  y += cellHeight;
  e.setNoiseSmoothRatio(0.5);
  e.setNoiseEffectRatio(0.5);
  e.setNoiseSymmetry(true);
  e.setVertexNum(600);
  for (i = 0; i < 6; i++)
  {
    e.setPosition(x, y);
    e.setXCoordinateBase((i + 1) * 1000);
    e.draw();
    fill(0);
    text("NoiseSmoothRatio:0.5", x - cellWidth / 2, y - cellHeight / 2 + 10);
    text("NoiseEffectRatio:0.5", x - cellWidth / 2, y - cellHeight / 2 + 25);
    text("Symmetry:true", x - cellWidth / 2, y - cellHeight / 2 + 40);
    text("VertexNum:600", x - cellWidth / 2, y - cellHeight / 2 + 55);
    text("XCoordinateBase:" + ((i + 1) * 1000), x - cellWidth / 2, y - cellHeight / 2 + 70);
    fill(255);

    x += cellWidth;
  }
}

ModulatedEllipse.pde

// ModulatedEllipse

class ModulatedEllipse
{
  float mCenterX = 0;
  float mCenterY = 0;
  float mDiameterH = 100;
  float mDiameterV = 100;
  float mNoiseSmoothRatio = 1.0;
  float mNoiseRoughnessCoefficient = 0.0;
  float mNoiseEffectRatio = 0.5;
  boolean mNoiseSymmetryFlg = false;
  int mVertexNum = 628;
  int mXCoordinateBase = 0;

  ModulatedEllipse(float x, float y, float h, float v)
  {
    mCenterX = x;
    mCenterY = y;
    mDiameterH = h;
    mDiameterV = v;
  }

  void setPosition(float x, float y)
  {
    mCenterX = x;
    mCenterY = y;
  }

  void setNoiseSmoothRatio(float r)
  {
    mNoiseSmoothRatio = r;
    mNoiseRoughnessCoefficient = map((1.0 - mNoiseSmoothRatio), 0, 1.0, 0.005, 0.1);
  }
  
  void setNoiseEffectRatio(float r)
  {
    mNoiseEffectRatio = r;
  }
  
  void setNoiseSymmetry(boolean f)
  {
    mNoiseSymmetryFlg = f;
  }
  
  void setVertexNum(int n)
  {
    mVertexNum = n;
  }
  
  void setXCoordinateBase(int c)
  {
    mXCoordinateBase = c;
  }

  void draw()
  {
    float h = mDiameterH / 2.0;
    float v = mDiameterV / 2.0;
    
    int xCoordinate = 1;
    int cnt = 0;
    float theta = 0.0;
    beginShape();
    for (cnt = -1; cnt <= mVertexNum + 1; cnt++)
    {
      theta = TWO_PI * cnt / mVertexNum;

      if (mNoiseSymmetryFlg)
      {
        if (cnt < 0)
        {
          xCoordinate = 2;
        }
        else if (cnt >= mVertexNum)
        {
          xCoordinate = 1 + cnt % mVertexNum;
        }
        else
        {
          if (cnt > int(mVertexNum / 2.0))
          {
            xCoordinate = int(mVertexNum / 2.0) - (cnt - int(mVertexNum / 2.0));
          }
          else
          {
            xCoordinate = cnt + 1;
          }
        }
      }
      else
      {
        if (cnt < 0)
        {
          xCoordinate = mVertexNum;
        }
        else if (cnt >= mVertexNum)
        {
          xCoordinate = 1 + cnt % mVertexNum;
        }
        else
        {
          xCoordinate = cnt + 1;
        }
      }

      curveVertex(
        mCenterX + cos(-HALF_PI + theta) * h * (1.0 - noise(mXCoordinateBase + xCoordinate * mNoiseRoughnessCoefficient) * mNoiseEffectRatio), 
        mCenterY + sin(-HALF_PI + theta) * v * (1.0 - noise(mXCoordinateBase + xCoordinate * mNoiseRoughnessCoefficient) * mNoiseEffectRatio));
    }
    endShape(CLOSE);
  }
}

ModulatedEllipseクラスに機能を追加しました

ModulatedEllipseクラスに機能を追加しました。setVertexNum()で頂点数を設定可能です。

頂点でパーリンノイズの効果が出ますので、頂点数でも効果を制御できるようになりました。また、頂点数を3や4など比較的小さく設定することにより楕円を多角形型に変形させることもできます。

setVertexNum()を利用した図形の描画例
setVertexNum()を利用した図形の描画例

以下はソースコードです。開発環境はMacBook Air、Processingです。

ModulatedEllipseSample.pde

// ModulatedEllipseSample

final int cMyWidth = 1280;
final int cMyHeight = 720;

ModulatedEllipse e;

void settings()
{
  size(cMyWidth, cMyHeight);
}

void setup()
{
  noLoop();
}

void draw()
{
  float cellWidth = width / 6;
  float cellHeight = height / 3;

  e = new ModulatedEllipse(0, 0, cellWidth - 10, cellHeight - 10);

  int i;
  float x = cellWidth / 2;
  float y = cellHeight / 2;
  e.setNoiseSmoothRatio(1.0);
  e.setNoiseEffectRatio(0.0);
  e.setNoiseSymmetry(false);
  for (i = 0; i < 6; i++)
  {
    e.setPosition(x, y);
    e.setVertexNum(i + 3);
    e.draw();
    fill(0);
    text("SmoothRatio:1.0", x - cellWidth / 2, y - cellHeight / 2 + 10);
    text("EffectRatio:0.0", x - cellWidth / 2, y - cellHeight / 2 + 25);
    text("Symmetry:false", x - cellWidth / 2, y - cellHeight / 2 + 40);
    text("VertexNum:" + (i + 3), x - cellWidth / 2, y - cellHeight / 2 + 55);
    fill(255);

    x += cellWidth;
  }
  
  x = cellWidth / 2;
  y += cellHeight;
  e.setNoiseSmoothRatio(0.7);
  e.setNoiseEffectRatio(0.3);
  e.setNoiseSymmetry(false);
  for (i = 0; i < 6; i++)
  {
    e.setPosition(x, y);
    e.setVertexNum((i + 1) * 100);
    e.draw();
    fill(0);
    text("SmoothRatio:0.7", x - cellWidth / 2, y - cellHeight / 2 + 10);
    text("EffectRatio:0.3", x - cellWidth / 2, y - cellHeight / 2 + 25);
    text("Symmetry:false", x - cellWidth / 2, y - cellHeight / 2 + 40);
    text("VertexNum:" + ((i + 1) * 100), x - cellWidth / 2, y - cellHeight / 2 + 55);
    fill(255);

    x += cellWidth;
  }

  x = cellWidth / 2;
  y += cellHeight;
  e.setNoiseSmoothRatio(0.5);
  e.setNoiseEffectRatio(0.5);
  e.setVertexNum(700);
  for (i = 0; i < 2; i++)
  {
    e.setNoiseSymmetry(!((i % 2) == 0));
    e.setPosition(x, y);
    e.draw();
    fill(0);
    text("SmoothRatio:0.5", x - cellWidth / 2, y - cellHeight / 2 + 10);
    text("EffectRatio:0.5", x - cellWidth / 2, y - cellHeight / 2 + 25);
    text("Symmetry:" + !((i % 2) == 0), x - cellWidth / 2, y - cellHeight / 2 + 40);
    text("VertexNum:700", x - cellWidth / 2, y - cellHeight / 2 + 55);
    fill(255);

    x += cellWidth;
  }
}

ModulatedEllipse.pde

// ModulatedEllipse

class ModulatedEllipse
{
  float mCenterX = 0;
  float mCenterY = 0;
  float mDiameterH = 100;
  float mDiameterV = 100;
  float mNoiseSmoothRatio = 1.0;
  float mNoiseRoughnessCoefficient = 0.0;
  float mNoiseEffectRatio = 0.5;
  boolean mNoiseSymmetryFlg = false;
  int mVertexNum = 628;

  ModulatedEllipse(float x, float y, float h, float v)
  {
    mCenterX = x;
    mCenterY = y;
    mDiameterH = h;
    mDiameterV = v;
  }

  void setPosition(float x, float y)
  {
    mCenterX = x;
    mCenterY = y;
  }

  void setNoiseSmoothRatio(float r)
  {
    mNoiseSmoothRatio = r;
    mNoiseRoughnessCoefficient = map((1.0 - mNoiseSmoothRatio), 0, 1.0, 0.005, 0.1);
  }
  
  void setNoiseEffectRatio(float r)
  {
    mNoiseEffectRatio = r;
  }
  
  void setNoiseSymmetry(boolean f)
  {
    mNoiseSymmetryFlg = f;
  }
  
  void setVertexNum(int n)
  {
    mVertexNum = n;
  }
  
  void draw()
  {
    float h = mDiameterH / 2.0;
    float v = mDiameterV / 2.0;
    
    int xCoordinate = 1;
    int cnt = 0;
    float theta = 0.0;
    beginShape();
    for (cnt = -1; cnt <= mVertexNum + 1; cnt++)
    {
      theta = TWO_PI * cnt / mVertexNum;

      if (mNoiseSymmetryFlg)
      {
        if (cnt < 0)
        {
          xCoordinate = 2;
        }
        else if (cnt >= mVertexNum)
        {
          xCoordinate = 1 + cnt % mVertexNum;
        }
        else
        {
          if (cnt > int(mVertexNum / 2.0))
          {
            xCoordinate = int(mVertexNum / 2.0) - (cnt - int(mVertexNum / 2.0));
          }
          else
          {
            xCoordinate = cnt + 1;
          }
        }
      }
      else
      {
        if (cnt < 0)
        {
          xCoordinate = mVertexNum;
        }
        else if (cnt >= mVertexNum)
        {
          xCoordinate = 1 + cnt % mVertexNum;
        }
        else
        {
          xCoordinate = cnt + 1;
        }
      }

      curveVertex(
        mCenterX + cos(-HALF_PI + theta) * h * (1.0 - noise(xCoordinate * mNoiseRoughnessCoefficient) * mNoiseEffectRatio), 
        mCenterY + sin(-HALF_PI + theta) * v * (1.0 - noise(xCoordinate * mNoiseRoughnessCoefficient) * mNoiseEffectRatio));
    }
    endShape(CLOSE);
  }
}