Name: Chromie Squiggle

Artist: Snowfro

Description: Simple and easily identifiable, each squiggle embodies the soul of the Art Blocks platform. Consider each my personal signature as an artist, developer, and tinkerer. Public minting of the Chromie Squiggle is permanently paused. They are now reserved for manual distribution to collectors and community members over a longer period of time. Please visit OpenSea to explore Squiggles available on the secondary market.

https://www.twitter.com/artonblockchain


Script JSON: {"type":"p5js","version":"1.0.0","instructions":"click to animate | space bar changes background color","aspectRatio":"1.5","interactive":"true","curation_status":"curated"}

Script Type: p5js

Version: 1.0.0

Script Ratio: 1.5

Instructions: click to animate | space bar changes background color

Hashes Generated per Token: true

Dynamic Asset? true


Artist Ethereum Address: 0xf3860788d1597cecf938424baabe976fac87dc26

Additional Payee: 0xf3860788d1597cecf938424baabe976fac87dc26

Additional Payee Percentage: 0

Price: 0.035

Currency: ETH

Currency Address: N/A

Invocations: 9183

Maximum Invocations: 10000

License: NFT License

Token Ids: 0,1,10,100,1000,1001,1002,1003,1004,1005,1006,1007,1008,1009,101,1010,1011,1012,1013,1014,1015,1016,1017,1018,1019,102,1020,1021,1022,1023,1024,1025,1026,1027,1028,1029,103,1030,1031,1032,1033,1034,1035,1036,1037,1038,1039,104,1040,1041,1042,1043,1044,1045,1046,1047,1048,1049,105,1050,1051,1052,1053,1054,1055,1056,1057,1058,1059,106,1060,1061,1062,1063,1064,1065,1066,1067,1068,1069,107,1070,1071,1072,1073,1074,1075,1076,1077,1078,1079,108,1080,1081,1082,1083,1084,1085,1086,1087

Active? false

Paused? true


Script:

let numHashes = tokenData.hashes.length;
let hashPairs = [];
for (let i = 0; i < numHashes; i++) {
     for (let j = 0; j < 32; j++) {
          hashPairs.push(tokenData.hashes[i].slice(2 + (j * 2), 4 + (j * 2)));
     }
}
let decPairs = hashPairs.map(x => {
     return parseInt(x, 16);
});

let seed = parseInt(tokenData.hashes[0].slice(0, 16), 16);
let color;
let backgroundIndex = 0;
let backgroundArray = [255, 225, 200, 175, 150, 125, 100, 75, 50, 25, 0, 25, 50, 75, 100, 125, 150, 175, 200, 225];
let index = 0;
let ht;
let wt = 2;
let speed = 1;
let segments;
let amp = 1;
let direction = 1;
let loops = false;
let startColor = decPairs[29];
let reverse = decPairs[30] < 128;
let slinky = decPairs[31] < 35;
let pipe = decPairs[22] < 32;
let bold = decPairs[23] < 15;
let segmented = decPairs[24] < 30;
let fuzzy = pipe && !slinky;


function setup() {
     let portrait = windowWidth < windowHeight;
     createCanvas(windowWidth > windowHeight * 3 / 2 ? windowHeight * 3 / 2 : windowWidth, windowWidth > windowHeight * 3 / 2 ? windowHeight : windowWidth * 2 / 3);
     var el = document.getElementsByTagName("canvas")[0];
     el.addEventListener("touchstart", mouseClicked, false);
     colorMode(HSB, 255);
     segments = map(decPairs[26], 0, 255, 12, 20);
     ht = map(decPairs[27], 0, 255, 3, 4);
     spread = decPairs[28] < 3 ? 0.5 : map(decPairs[28], 0, 255, 5, 50);
     strokeWeight(height / 1200);
}

function draw() {
     color = 0;
     background(backgroundArray[backgroundIndex]);
     let div = Math.floor(map(Math.round(decPairs[24]), 0, 230, 3, 20));
     let steps = slinky ? 50 : fuzzy ? 1000 : 200;
     translate((width / 2) - (width / wt / 2), height / 2);
     for (let j = 0; j < segments - 2; j++) {
          for (let i = 0; i <= steps; i++) {
               let t = i / steps;
               let x = curvePoint(width / segments / wt * j, width / segments / wt * (j + 1), width / segments / wt * (j + 2), width / segments / wt * (j + 3), t);
               let y = curvePoint(map(decPairs[j], 0, 255, -height / ht, height / ht) * amp, map(decPairs[j + 1], 0, 255, -height / ht, height / ht) * amp, map(decPairs[j + 2], 0, 255, -height / ht, height / ht) * amp, map(decPairs[j + 3], 0, 255, -height / ht, height / ht) * amp, t);
               let hue = reverse ? 255 - (((color / spread) + startColor + index) % 255) : (((color / spread) + startColor) + index) % 255;

               if (fuzzy) {
                    noStroke();
                    fill(hue, 255, 255, 20);
                    let fuzzX = x + map(rnd(), 0, 1, 0, height / 10);
                    let fuzzY = y + map(rnd(), 0, 1, 0, height / 10);
                    if (dist(x, y, fuzzX, fuzzY) < height / 11.5) {
                         circle(fuzzX, fuzzY, map(rnd(), 0, 1, height / 160, height / 16));
                    }
               } else {
                    if (slinky && pipe) {
                         if (i == 0 || i == steps - 1) {
                              fill(0);
                         } else {
                              noFill();
                         }
                         stroke(0);
                         circle(x, y, (height / 7))
                    }

                    if (slinky) {
                         if (i == 0 || i == steps - 1) {
                              fill(hue, 255, 255);
                         } else {
                              noFill();
                         }
                         stroke(hue, 255, 255);
                    } else {
                         noStroke();
                         fill(hue, 255, 255);
                    }

                    circle(x, y, bold && !slinky ? height / 5 : height / 13);

                    if (segmented && !slinky && !bold) {
                         if (i % div === 0 || i == 0 || i == steps - 1) {
                              noStroke();
                              fill(decPairs[25]);
                              circle(x, y, height / 12);
                         }
                    }
               }
               color++;
          }
          seed = parseInt(tokenData.hashes[0].slice(0, 16), 16);
     }


     loops === true ? index = index + speed : index = index;
     if (keyIsDown(UP_ARROW)) {
          if (keyIsDown(SHIFT)) {
               if (speed < 20) {
                    speed++;
               } else {
                    speed = 20;
               }
          } else {
               if (speed < 20) {
                    speed = speed + 0.1;
               } else {
                    speed = 20;
               }
          }
     } else if (keyIsDown(DOWN_ARROW)) {
          if (keyIsDown(SHIFT)) {
               if (speed > 1) {
                    speed--;
               } else {
                    speed = 0.1;
               }
          } else {
               if (speed > 0.1) {
                    speed = speed - 0.1;
               } else {
                    speed = 0.1;
               }
          }
     }

}

function keyPressed() {
     if (keyCode === 32) {
          if (backgroundIndex < backgroundArray.length - 1) {
               backgroundIndex++;
          } else {
               backgroundIndex = 0;
          }
     }
}

function mouseClicked() {
     if (loops === false) {
          loops = true;
     } else {
          loops = false;
     }
}

function rnd() {


     seed ^= seed << 13;

     seed ^= seed >> 17;

     seed ^= seed << 5;

     return (((seed < 0) ? ~seed + 1 : seed) % 1000) / 1000;
}