Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Budding of the Brood
// "Budding of the Brood" by Josh Cheek (@josh_cheek on the twitter)
// Paste it into here: https://hydra-editor.glitch.me
// Or you can watch me run it here: https://vimeo.com/346283798
// And some explanatino of how it works here: https://vimeo.com/346242814
// Great explanation of the math here: https://www.youtube.com/watch?v=r6sGWTCMz2k
document.getElementsByClassName('console')[0].style.display = 'none'
function getPoint(time, getX) {
time = (time*5) % points.length
const [x1, y1] = points[Math.floor(time)]
const [x2, y2] = points[Math.ceil(time)%points.length]
if(getX) return x1+(x2-x1)*(time%1)
else return y1+(y2-y1)*(time%1)
}
shape(100,0.01,0)
.scrollX(({time}) => getPoint(time, 1))
.scrollY(({time}) => getPoint(time, 0))
.add(o1,1)
.out(o1)
src(o1)
.mask(voronoi(30,5).invert().contrast())
.out(o2)
src(o2)
.repeat(2,2)
.repeat(2,2)
.color(0,1,0)
.scrollX(0,0.2)
.modulateRotate(noise(0.5,0.2))
.modulate(noise(1.5))
.scale(1.5)
.add(src(o2).modulate(noise(1, 0.5)).color(1,0.3,0), 1)
.out()
points =
[[-0.06109749431077809,-0.3051228689170097],[-0.0609859617814894,-0.271721285057218],[-0.05924250326832523,-0.23836558047726528],[-0.05573530760030795,-0.20514967006298235],[-0.05034141830746902,-0.17218811437612702],[-0.04295122979027282,-0.13961657844718364],[-0.03347784669270414,-0.10758949193209037],[-0.021876444958360386,-0.07627101089411148],[-0.008132434976252535,-0.04583203565064733],[0.007713167177443259,-0.016432363733377454],[0.025576402420621414,0.011787109589312407],[0.04533426840403343,0.03871448475389475],[0.06431374652569598,0.031839979342089576],[0.08044636945406489,0.0025968934069104223],[0.09386321429164034,-0.027974076524650626],[0.11086869051894742,-0.05658673527556124],[0.1311023934532103,-0.08315634381595861],[0.14777065697370023,-0.11206942009125546],[0.1631262454790749,-0.14167472294076394],[0.1843283223729008,-0.16743190119377127],[0.2090840018263012,-0.18982796340576885],[0.2363624452402121,-0.2090722567306624],[0.2662898894531106,-0.22375807656930646],[0.29479904454870426,-0.21496902880981728],[0.2719837145378974,-0.19814197710180437],[0.2407991780574086,-0.1862783294039005],[0.21277074605596857,-0.1682459831352355],[0.18967064335520067,-0.1442116177194649],[0.17049608653566248,-0.11688330352836898],[0.15532892423258687,-0.08715655822512645],[0.14283535402249262,-0.05618322700937676],[0.12244215177186926,-0.030109573484039667],[0.09985830566749039,-0.006167196024346289],[0.08894780000824298,0.025319661970642005],[0.09334578777361541,0.04195686521868094],[0.11484601116747553,0.016393068130195317],[0.13837515395365843,-0.007281649610916896],[0.1659364890070569,-0.026061736382398927],[0.19540493396480554,-0.04178208810213403],[0.22563552551924068,-0.05598828594934059],[0.2564363506427955,-0.06891156149440739],[0.28784847129092594,-0.08026044367251704],[0.31922559751835916,-0.0917093885599557],[0.3506469054922774,-0.10303464290894822],[0.3831872893902101,-0.11030783926255477],[0.41590826560340927,-0.10590145558897178],[0.44398781285749994,-0.08799775482097558],[0.45,-0.05945377735198409],[0.43071193784213996,-0.0748728857202959],[0.40152211775085395,-0.08805354402525996],[0.3686710279000312,-0.08918501882465088],[0.336540449199441,-0.0801241822113951],[0.30511463358627855,-0.0688018641363122],[0.27406954717686055,-0.05647350521291846],[0.2435167225004758,-0.042973848275233505],[0.21357817550185626,-0.028162594485509364],[0.18424211520608325,-0.012188071555465863],[0.1566092314157757,0.00650718442759366],[0.13216835264099105,0.029236697245461553],[0.12589975193838046,0.04947794732125798],[0.15897162435360876,0.053346809352246484],[0.1896470843450033,0.06630674244190479],[0.21627734529334794,0.08636456715690463],[0.238877662059189,0.11092934292689463],[0.26087670792309925,0.13606591216151892],[0.28408871018739473,0.1600748145769789],[0.30854264161729356,0.1827451660634943],[0.3327623363839741,0.2057506427495942],[0.3557183666762274,0.2300005719616887],[0.37331358663640574,0.25814441329156385],[0.358234558429901,0.2675807029913826],[0.3387199902674754,0.2404993340240204],[0.31553368039988994,0.21648389381118338],[0.291116819428101,0.19368698433123188],[0.2672297953195335,0.17034257446532095],[0.24444811776048858,0.14591596414656627],[0.22319516074532111,0.12014658200512184],[0.19946130461249634,0.09677136420279894],[0.16974522624181637,0.08178838426863726],[0.13753138811813825,0.07309857339143995],[0.10433869261945378,0.07304007730964517],[0.09452451823124061,0.09803185153709733],[0.07971812764517945,0.1267245696313271],[0.04961930138244213,0.13963876107898587],[0.031219003289467886,0.16186552874837729],[0.029155582678706087,0.19509403302497613],[0.04315789300630786,0.22498704483835544],[0.06124584496213776,0.25305066624743205],[0.08357079429038479,0.2778249268091672],[0.10529665198249337,0.3031671040363902],[0.12508085267253308,0.330080394262062],[0.14445865470175828,0.35728921586881707],[0.17490783808498664,0.36849087143792314],[0.2025795128063981,0.3851814552280548],[0.17369306945304788,0.39372520941788447],[0.14394673369731403,0.3788523512251565],[0.11877093767842736,0.3570136534442837],[0.09592278104289567,0.33264578007354295],[0.07392756609885194,0.30750799503800297],[0.053264226648536216,0.2812675015115311],[0.03451703532069882,0.2536312685337953],[0.01878425031612733,0.22419058054034935],[0.008466826107359526,0.19249891744015946],[0.00908326011127712,0.15938635010371394],[0.01752114786287817,0.1277865832010417],[-0.003473394108595829,0.1532627508650347],[-0.021706921019354997,0.1812513367119345],[-0.03228989449983131,0.21257550678061346],[-0.03308805633119155,0.2459054501449365],[-0.02743554553789973,0.2787846754641205],[-0.01653127946071046,0.3103267262327552],[-0.0006475975047483207,0.33964156736160267],[0.024222826027529537,0.36128883384734695],[0.03532620817922038,0.38167658793348946],[0.006706621657054052,0.38139015211963423],[-0.01623361469311464,0.3572260286306587],[-0.03348670139371316,0.3288149978448208],[-0.04602748138276173,0.29797545060908187],[-0.051704399952927874,0.2650918667583131],[-0.053275352373897154,0.23173751561711567],[-0.05301278525537819,0.1983335689744123],[-0.05650346438265339,0.22322007319427373],[-0.06520378161493388,0.25532290640038124],[-0.07171854759352095,0.28750187627138174],[-0.06913880156745032,0.32079789190826374],[-0.06739034221278366,0.3541191182094174],[-0.07204112481006932,0.386795201547294],[-0.06510605874887664,0.41941700969712103],[-0.06031598665799955,0.45],[-0.08396157105641404,0.43703754354995056],[-0.09268198341326399,0.404893097837029],[-0.0916117574524582,0.3716077376628896],[-0.09088484614268809,0.3383157708724534],[-0.08974034162782281,0.30498307475134],[-0.08759521001966768,0.27166015091683243],[-0.08470155796093819,0.23866932424943982],[-0.06713094076457359,0.21035531667064158],[-0.049284084424297984,0.1821627974248572],[-0.039321215290126436,0.15044181746485016],[-0.022955663258014614,0.12483204933796582],[0.005677503530984079,0.10865900676405868],[-0.007913774328539569,0.10021942147910365],[-0.040614781585188754,0.1049816448471184],[-0.06703798934361965,0.12496468633598053],[-0.09012742511182506,0.14909989440883745],[-0.11254243546639613,0.17386784656959478],[-0.13514532147190828,0.19846283384535882],[-0.15903892925713267,0.22161748700985542],[-0.1672448972491472,0.25377941272839566],[-0.17107416546163465,0.28696024843324175],[-0.1889355655336193,0.30926613492071564],[-0.19308442880946558,0.28267934459001853],[-0.18542736052144554,0.25035925005423315],[-0.17937739752690798,0.21789555337255145],[-0.15705749491944326,0.19329460179040833],[-0.13411886434406897,0.16909392398522108],[-0.11284491755837504,0.14349009722507589],[-0.0866262855087465,0.12369580309347163],[-0.06623638656627157,0.0983363523173892],[-0.037405984753244796,0.08304001690192671],[-0.025012385493919875,0.07164791644220868],[-0.04897848254129005,0.04838280891149955],[-0.07145107139205913,0.023676862597444705],[-0.09198599473810538,-0.002659908597769356],[-0.11016689811488926,-0.03066930069807622],[-0.1255130125489771,-0.06032346498061332],[-0.13747245618318496,-0.09149293011767505],[-0.14593195307559015,-0.12379809094787281],[-0.15199563397479962,-0.1566406357828255],[-0.15557926452302873,-0.18984425055011167],[-0.15648326985297753,-0.22322661099165084],[-0.15447476674018315,-0.2565595594488033],[-0.14928884822285465,-0.289544926481895],[-0.16127994856015146,-0.30417335134146045],[-0.19032410193794844,-0.31810927435113506],[-0.20894136314528156,-0.3457364920503824],[-0.2401285835636409,-0.3504665540432301],[-0.2611823098061073,-0.36988817078470165],[-0.2299145712516303,-0.36709302153978657],[-0.2156608424705105,-0.3670857726135721],[-0.23326128119877054,-0.3847686564077029],[-0.20589424489549044,-0.3829989090671909],[-0.2052970343098254,-0.4082062700306069],[-0.20605610699476265,-0.4279976737675813],[-0.18479716273357624,-0.4025325630100295],[-0.1659663334785922,-0.40289629394059356],[-0.17375209314656087,-0.43430405605713934],[-0.1570007422502823,-0.45],[-0.14266493543753042,-0.4220336426641822],[-0.1516770482555972,-0.3910798101423642],[-0.12851397624325014,-0.3726046829439724],[-0.11803611219288508,-0.40409989096789145],[-0.09646326189903971,-0.42902959052972145],[-0.06542230462480732,-0.44076945593061956],[-0.03221033982859045,-0.44304965613862085],[-0.0022253400591338403,-0.42995534263831403],[0.016060305713522596,-0.4021976442672043],[0.013456794220495344,-0.36955527073018946],[-0.005188866261058101,-0.342034401201609],[-0.030404026702046717,-0.3202489004457096]]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.