xxxxxxxxxx
90
// ----------
// VARIABLES
let truncation_value = 0.7;
let audio = "Ionian_Mode.wav"
let download_images = true;
let fps = 26;
let height = 1024;
let width = 1024;
let start = [0.23236748782618288,-0.1049671580012137,0.03768470320311445,-0.020303807402230253,0.08505526310567571,-0.43113661114946406,0.09261585209270334,0.13589789739195593,0.24929215981268885,-0.2793494818342948,-0.404874487796481,0.07862755128009469,0.08516445893719266,0.08910751488051245,-0.26436513285252383,-0.12568917006482938,-0.0674806271954742,-0.012441195737250596,-0.41400660142101414,0.2819482849856641,0.009012428556717383,-0.30376908505024125,0.26108599467290816,0.10111324619679879,0.09661521876767765,-0.7107587379756451,-0.050183822482079976,0.3303725582264522,-0.11389002850084355,-0.3031714195760443,0.18099187861961913,0.007881824392512372,-0.22713753217406032,0.6086061270838155,-0.040767052991449386,0.6123449629200195,-0.45746306167964146,0.020236155776933103,-0.3558456559535554,-0.07892529231837599,0.1242222566023359,-0.3911682629958227,0.15207917766452764,0.24018547212491317,0.18270519661543685,0.13199101850015352,0.13737888141835083,0.37877849518676565,0.2266054907729685,0.2717944250346268,-0.04256077326080346,0.09010926661149073,-0.25337073257010334,-0.17077446390095108,-0.23938247018938505,-0.28233602990246437,-0.3534981830393025,0.547151522316523,0.03311991717736576,0.1878888004690591,-0.15360006898591236,-0.27775868553434757,0.532822686943369,-0.23781504189102287,-0.032043235984706216,-0.44559840580018184,0.19088424858831254,0.38325171087253096,-0.5411636573885261,0.011683885451130069,-0.034405779947802306,-0.0902352647442512,-0.12656018375049213,-0.13736558607912333,0.6332811038381874,0.16961029062648372,0.27710879439510006,0.010791670411417778,-0.2786978254127105,0.11124004849624283,0.13654309687696467,0.2495392234337563,0.053326232303243404,-0.3966072576959243,0.05695341397151432,-0.2219671892153284,0.23397075177766166,0.07336366850782175,0.06255651804240156,0.09998753476478511,0.05169020429806351,0.16480434407016042,-0.15473178717991123,-0.027925410117264474,0.08436331862464692,-0.08099952651002601,-0.037403851249969144,0.4357201862837948,0.12111868197899874,0.40951258200907403,-0.2839647767077075,-0.2585751440897654,-0.2597253881630236,0.13484641944531658,0.3590917720892559,-0.24484700927945258,-0.06529367427229193,0.3599685668923255,-0.1971511146405708,0.14155527688652764,0.0783436294337688,-0.32045534787438257,-0.1626460740516903,-0.011851007229449786,-0.4146531088090383,0.6604948789046405,0.20183237762502887,-0.12263184954493131,-0.2730706151826608,0.09103344020368954,0.18327529195148567,-0.1553287712002857,-0.010621591275236375,0.04049559310278977,-0.10452924535487806,0.13359369000819302,-0.2289259395468824,-0.2900684034406932,-0.2333505567268525,0.2397106624330947,-0.21495901116083982,-0.017400115997261212,0.05965972593221397,0.6339065127594985,-0.1173566802358253,0.399578407074128,-0.42242196546602295,0.3610894110290389,-0.05240203142917922,0.1003533436120298,-0.15414135237284832,-0.3360494866614723,-0.26592582378172125,-0.4377905348213434,-0.2468657213451147,0.21292351995152178,0.1659106028699231,0.07483193664619184,-0.32493016564879174,0.30077719403962505,0.2336934160686957,-0.30083682707592463,0.1149146104606723,-0.07489452544256439,-0.27028393291693625,-0.2608012850626402,0.14017334962849282,-0.3483951052390034,0.03882394279548851,0.19165907053777545,0.07212567979708223,0.44598814458011515,0.025960933212929152,-0.2534079323949537,-0.3763279007136752,-0.0377354794581289,-0.2014949305595248,0.17133663554722642,0.4231837918181693,0.11224437086113287,0.09583582286727708,0.3469532495298968,-0.1892162010150962,0.30379694900089976,0.11689132923473486,-0.05781127187043858,-0.10804272003041576,-0.09902741883199111,0.4261778628034217,-0.047932035071398954,0.24841285431705398,0.8422906699559334,-0.2032894388655799,-0.07812153027737824,-0.16999961115110163,0.004187666420912409,0.5644635505713879,-0.3170963274447152,0.35467483000017713,0.06213511834574936,-0.051936630332097215,0.18176412101193568,-0.16697187045252776,0.19853999147944196,-0.6258739994314857,0.31308234298154347,-0.13565858124713986,-0.0838434067764258,-0.2320541640904293,0.1281899050754333,0.3074960326377779,0.2655481671926079,0.2968730334319909,-0.132758862384028,-0.297451752359828,0.0408702259228922,-0.0165934922512556,0.024081701799920748,0.0800612391964926,-0.41237633470096113,0.01556166980376214,0.13398277582267276,0.17369327606665577,0.20578015158062035,0.2573652409290755,-0.10620886527542953,0.36043984544135693,0.02702683924912913,0.024313344531480263,-0.18511917484846696,0.03802568746551138,-0.28461158402403186,-0.2552440922785868,0.20170286616309055,0.06991044812407864,0.41227668144041973,-0.24744846270759402,0.5529052082699067,-0.3293164773916625,0.060299382922750014,0.20397370806250925,-0.3794095097258846,-0.18625722089075541,0.21890308936610745,-0.21396675656042644,-0.014148359183155795,-0.06618455782716157,0.08459786050986641,-0.07816489779459765,-0.2194003225292673,-0.10459199831373772,-0.37008135495210254,-0.25151508475854273,0.28090441306057595,0.5074837451146335,0.08372376733219022,-0.08120846944758159,0.14091742100543597,0.23332414390448805,0.1645568285970849,-0.19974019037787333,-0.3393574609688178,0.1895494902331758,-0.34289689594675243,-0.07635697024686462,0.22251555139776835,0.10298232489671774,-0.3739660209185393,-0.2751523787798369,-0.149066563311293,0.3205798159220526,0.2369899410394049,-0.023739853582650405,-0.45645483248826674,0.363191940949172,-0.2786384708640315,0.11131732261562972,0.4480795017605518,-0.038829420340252725,-0.04549802551556724,0.11210075396173289,-0.3336927439561433,-0.603357815961839,-0.3422281519687982,0.15076135222307704,0.12232119135341499,0.32195982469062345,-0.18953630453779452,0.24527397092504497,-0.07374012858729104,0.4332539595764991,0.45174854913755264,0.498221744499726,0.20117988508421286,-0.00848259330953438,-0.3890920969401217,-0.16827941922550424,0.11728450278101438,-0.46307788282677725,-0.09672984403442628,-0.22405889741960025,-0.136692448063332,0.3336227945270142,-0.22463172805206272,0.028226940098427408,-0.0024284929550131285,-0.27310933201064896,-0.02297533445530074,-0.4635824742915899,-0.19061852260005974,-0.14380645585813062,0.16719494249264366,0.3563514867783661,0.09825983576310063,-0.3055635336118127,-0.057656014853547155,-0.35814155320287283,-0.2358620235764251,0.05719124166076588,0.2243795282504492,-0.22197553337059484,0.08500162039370282,0.5296390060645071,0.3635973231890832,0.0852239662613121,0.3163975563845996,0.06578023030390122,0.381627756711922,-0.0430437894127162,0.4317075972525604,0.0023811094237714027,0.10018097347253896,0.2016498298664561,-0.04595098528911926,0.3407686581135114,-0.29950800317769233,0.15912928079024213,-0.10992632431065733,0.0030025511076312225,0.19449385299450012,-0.25590584680653106,0.16186249561963786,0.03488705396992885,-0.35227001658207724,0.10645643270154452,0.45493473871158513,0.04689242877115868,0.3925718318232895,0.37918685745313235,0.25430068476144085,0.03591977318102432,0.14451964005798795,0.5984567189574643,0.057241434927660484,0.15558810197679446,0.5221397463527767,0.03275415588820347,0.36289806484207193,0.4523225009710138,0.24228215526453312,-0.013627405113190827,0.2939347109854713,0.009286217421355991,-0.06722781776352087,0.19125207223796414,0.7840746305841547,-0.10756761506313073,0.009755268251216693,-0.0813789822799727,-0.22429571868650292,0.252475975499127,-0.0559808895911979,0.2260369772089445,0.33804200231337206,-0.18414519272104302,-0.1434161995052839,0.08782452202781543,0.5353514153827852,-0.48952725632586824,-0.3334841223824642,-0.12482814477556448,-0.16286151681000072,-0.08101584500028487,0.2161797611142709,0.5012575327066828,-0.2133733045457566,0.2740130974828209,0.25633181908421115,0.11488507115956989,-0.5635426046884245,-0.02589059129193977,0.23412293183303737,0.3404980624909826,0.3863084441802254,-0.36196445842696084,-0.020474412199742997,0.25685725277397087,-0.40126596393914693,0.26868710541694646,-0.05820021919076529,0.41556276155032934,0.526551390174501,0.21191111262042903,-0.10945807928355576,-0.14167895778739012,-0.26746179817777294,0.25805324850756944,-0.05941554916898049,0.10182926699089039,0.32339385124489695,-0.30059148405143266,-0.0953374141111475,-0.465925815494612,0.24260235701866692,0.2471194433911396,0.1485826926551446,-0.3900223814933594,0.2669930815156734,0.028031114441078364,-0.41208215443115026,0.03614549729691799,-0.36360540576730094,0.11838845355623548,0.19640918093200793,0.2353650268971635,-0.2589463697125475,0.17848291092764423,-0.2640820434488773,0.23530899851315631,-0.505523613954433,-0.2186353712180884,-0.2793812650202695,-0.11009546093130387,-0.2718475622732416,0.02117626240359929,0.015299438728185184,0.08071237869086557,0.26004702644019123,-0.3789283366550303,0.16240780266545965,-0.04359178562518194,-0.14229387842622204,-0.1870015671326067,0.07416341958857675,0.10275958552644995,-0.0032237950840599827,-0.12474219532578605,-0.18865187203629855,0.0914931313385423,0.10795790193615273,0.22424350774939442,-0.455299608639671,0.05425099179689328,0.3586228454853678,-0.2498588776954757,0.054448868476719786,0.23460434685734363,-0.20805449259418762,0.042361982265086175,-0.1919317574271288,-0.035727271470745225,-0.3905747756740231,0.2637497311875454,0.23173635483385757,-0.16902802555030322,-0.19716510870954485,-0.6304996010916168,-0.4508985165929062,0.46139819730234394,0.04619029602480256,0.11290716836023854,0.1443786129331494,0.32860769062164696,-0.22198396081233845,0.35520271945887544,0.2026533794155839,-0.40379191282084714,-0.2551993898209973,0.6749472965970875,0.009117372598753469,0.38859255899203926,-0.40647915263654016,-0.018384951399582447,-0.019056637138261084,-0.24428855917937145,-0.2151651338920116,-0.44539422468605744,0.1299155780079087,0.9853173880345234,0.22892445811007633,-0.01135382329268078,0.2042490081533612,0.0867946138236721,0.01560967760824344,-0.1473384191108349,0.38726735828470604,0.3529066120020713,0.2902587457461181,0.14436200267764765,-0.19149892544496128,0.1371201713653208,0.11290951130421126,-0.0028058729891665343,-0.2135664830003581,-0.35033694894111334,0.12000888406584972,0.046662584532808284,0.18152167894677018,0.19266254295287344,-0.3056605610126002,0.23879048262359334,0.2986417225499193,0.33710345394225927,0.1753859052066621,-0.09373662596053518,-0.6153156612981173,-0.14897469728451443,-0.11207463810005214,-0.10092463223397588,-0.37078682323909873,0.2792069367888954,0.49817505874835377]
let end = [-0.0766054044701973,-0.08408259973728703,-0.0003655218222270544,-0.10853792325643813,0.02318415974271399,0.0796760832314174,0.08878211612222112,0.010853981062321293,0.08162199205565365,0.03854053555825506,0.007744868489257928,-0.008987348330722612,0.11386681824827286,0.10144272131339507,0.000372546695734291,-0.07178941640267297,-0.10411439377976124,0.09031666190341538,-0.045967077750225106,0.0880008305012799,0.11755441879630858,-0.1011529008945241,0.08939130130107309,0.01423658179025905,0.06666083933561927,-0.11979633877014136,0.07894149606406503,0.11550647782217852,-0.021635728299483487,-0.014948956875981313,0.056260262122320714,-0.003994256889698641,0.09400893202097987,0.007773581219035909,-0.12426771600098076,0.08596298626897597,-0.058872522732313436,0.1326675139792398,-0.002385790978288581,-0.023466875777457766,-0.012870879894617819,-0.002010089692826879,-0.004778495741752514,-0.07897456452387577,0.01959700407170962,0.016693295318250242,-0.016578052030404036,-0.015752414592790254,0.04797619077315329,-0.07621393598899476,0.041114118607772455,-0.012116063428862399,-0.015072851380338235,-0.025099490384889317,0.049856766792024595,-0.017751255242813416,0.032466960948821684,0.03103845525732951,-0.027224391445141,-0.1072697244970094,-0.011131650975606658,-0.003209714582868353,0.025306558724684406,0.0877092227378569,0.044741738192535754,0.016437877691848086,-0.09274499522732385,0.11896161735048232,-0.06475827381010665,-0.018306383785378855,-0.008532624651293279,-0.03078750860266966,-0.05975741695091877,0.07123433056042627,0.02696794145511152,0.008467110271995093,0.02946644799328276,0.05404141496448611,0.042504500881636306,0.11088413459084209,-0.1795230458083643,-0.014971901324750032,-0.02621598860484748,0.00017221434346667694,-0.025514371295485394,0.016347740258794447,-0.05724342447458991,0.052695142551985076,-0.01138307945528811,-0.025524417082643226,0.05700212384708311,0.003448209605746093,-0.0031185581720022115,0.05324092246337442,-0.11343449487921678,0.11541170452528932,-0.047837489043382884,0.12254576918853724,-0.014738681478220217,0.09643647006137507,-0.1358081949550022,-0.03897748116529762,-0.017703339856319063,-0.022264743672196313,-0.026697886533661716,-0.05086493702061026,0.05502426153458646,-0.081929885993843,-0.1651357450076843,-0.042381707658065204,0.029636046384755355,-0.06621313288926296,0.07702257842682715,0.009343409118409439,-0.03845502759709768,0.12234005582786503,0.09377680618816542,0.06349861582836348,0.0007364279153094927,0.07986426538427736,-0.01383807856942702,0.03609898092882405,-0.07224697239052386,-0.003193370309884404,-0.11957813973346075,-0.03335127240651284,0.007067581736333699,0.009748570773740455,-0.07575442494570131,0.04075742633509448,0.06040278639915507,-0.15575072704302767,0.08850610555931497,-0.011967759866345015,-0.07121294665408168,0.10801562591362247,0.02066553555372368,0.09050148109022899,-0.01433543785498426,0.1516935618095891,0.046342796294018086,0.14077672255783047,0.013851415751376182,-0.0024713054026172295,-0.07595477508772867,-0.023648069224183003,-0.026068239127930697,0.018617937956614563,0.10259342582668106,0.06348435300470619,0.18225507119954526,0.03603838353035582,0.08105713945985142,0.051780439511991495,-0.09586983755101905,0.0200209389722776,-0.007589613956609171,0.012987957439636759,-0.0700922435984045,0.027651096349288827,-0.007421845815687063,-0.014552846397392061,0.06081864541764137,-0.16598722049567866,-0.07542515026753421,-0.141292233870006,-0.03147223599556651,-0.019786371366763415,0.01622074768554428,0.07497031354487207,-0.0074775570307134,-0.05582815060653813,0.011413783122656895,-0.036353046501469644,0.006498294369938262,-0.04748827949364212,-0.00785523900896943,-0.14456456741313667,0.010105250580300297,-0.04358593695403656,0.007820092503343137,0.0022879195160380728,0.010638051425988601,-0.06518472521765101,0.008736022793811173,-0.049096270858749305,0.16421371076164,0.04348742156375542,-0.02842676889404932,-0.023281593545655614,-0.025818480453240637,-0.07356124803508211,-0.0009227972452623412,-0.05679956222250966,-0.16574826149596436,0.08276425507721147,0.02360953118787006,-0.03870959944214347,0.07125152569501411,-0.024089692551583174,0.11126114632477954,0.1372036938764517,0.019386506257124604,0.062484145423246595,-0.04092954271912785,0.008143187404124974,-0.11399035125502566,0.0551281378410261,0.07364187302193724,0.06835373854930935,-0.0006987313820410249,-0.06992200988946023,0.019853857747460926,0.030667068224804278,-0.09972348000115208,0.014664344116739558,0.10672614321755272,0.029127560210132172,0.04900177912015657,-0.08021986505883882,0.10925410499769697,0.05606306605767603,0.022962341455366776,0.07504344502430409,-0.01311949714145787,-0.08874341743001779,-0.006814356107600457,0.028613987812683567,-0.00813898844960062,0.15252768183444462,-0.05248135576329784,0.13317355776369827,-0.03683535722381186,-0.015610590668307295,0.11957492382331428,-0.022307112483186647,-0.043849799599056286,0.0010612063478049744,0.026382746147893987,0.0637947663318744,-0.027572348443179046,-0.07182984315473974,-0.16047978077106645,-0.0029950720938978076,0.06299883548152907,0.0031398606320574285,0.044099653858046955,0.11334668649817088,-0.09568878830166946,-0.006104269344652455,-0.12974999547722482,-0.10012104156357282,0.06472579529786796,-0.16331362038264186,0.08552929147789674,0.05213647874503539,0.04219640864235705,-0.008083002907241302,0.021517820987479713,-0.004720612396015147,-0.11655897102256524,-0.02833220238788155,-0.015561789552108657,-0.10541271265210744,0.08106370501643312,0.03052152629861795,-0.05493790163757666,-0.07720979853747181,-0.021374908463976983,0.08141890442522154,0.09467721706999258,-0.03377852006863816,-0.1079493303968385,-0.10418449824493171,0.022713197946345454,-0.025236331278119056,0.007175258347848205,-0.005119891104670191,-0.030598678439664954,0.10829420357027873,0.04029546632181591,-0.09146689150938314,-0.00026501620639215323,0.04600458279080976,-0.04769992097872009,-0.046541428648730475,-0.02792556157386379,0.01531834267457459,-0.02381028695306446,0.00034076490067509995,-0.12063169877833754,-0.07818882365798781,0.05099913697348081,0.02067321766910224,-0.1413771583272778,-0.089736713425389,-0.024110647798430508,-0.06603348520941632,-0.07777049152798508,0.03794233149851165,-0.10989897428762416,-0.007215820291742524,0.06967562712162532,-0.024445543870312683,-0.008618373748345884,-0.03200001658497967,-0.006227248774537664,-0.004493290735341722,-0.0010198086810385403,-0.021580694655733146,-0.0010404911428770784,-0.0733562646341201,0.09070238176286674,-0.12165272127186141,0.02917424037484182,0.02819859632609392,-0.01113221776701303,0.23005387806038974,-0.0024792761294213303,0.1135812062592245,0.1142644216921381,-0.04805453359556006,0.052175338804647295,-0.10262645634248047,-0.02681744092188171,-0.10981879168011731,-0.1054983757752341,0.038498421279679916,-0.13352097517597444,0.09935912104941594,-0.03330711297141792,0.05043040729462897,0.06051211529720898,-0.024006715349117143,0.026736446304833614,-0.062182269254016875,0.016229295553804063,0.008567911152230814,-0.1572039439343481,0.07906000259159751,-0.022644143412069433,-0.03154749391276128,0.06955434718216931,-0.0380413474511439,0.0244027315882468,0.07738760344082458,-0.01909382808320003,0.03174807623087128,0.10559439990381388,0.032647512080060365,0.12457787051311152,0.18617164629451002,0.044777577011508043,0.025455254261612877,0.082770517378,0.10991419824110406,0.07392880711431377,0.13996211576851167,-0.03785946634219946,0.054600717728309295,-0.04406134282932065,-0.06244446709925129,0.08470139628261125,0.05910498298323645,-0.031521792837998705,0.08741531723522594,-0.03175958464860774,-0.04834060141390023,0.051561946734418315,0.08050192537370576,0.03530356582761944,-0.04300423174557575,0.08376894909344591,0.09465638136684708,0.044141621141188574,-0.11565547544066632,0.03814267195283763,0.03175683713046952,0.12207260635723732,-0.0640873772890442,0.023029148085015314,0.048549268032430655,0.0748372757113832,-0.04455707242650555,-0.04390326358665297,-0.061218066636339524,0.033128062145915904,-0.1096096246699856,0.011100048045653932,-0.048452105040143675,-0.13510719224542508,0.0834519940161609,0.10296663151741234,0.024753443162541106,0.0392092109544343,0.057328228441689194,0.07400930495600708,-0.02331660190121429,0.025430816029503284,0.11788069124824985,-0.01832235077324909,0.004964535072681175,-0.07876147380566169,-0.09463445661931341,-0.04229140862321466,-0.021582327869446093,-0.04612862401813503,0.24653705246997132,0.07935592440327512,-0.0177110677847266,0.1280337100793441,-0.029802911895140706,0.009967375714413904,0.051035818458161464,-0.005696932462821779,0.10066765082470125,0.1469019658683282,0.08414293095165555,0.040277695503333766,0.0006969364962521457,-0.10793770070670271,-0.035280922233654956,0.04180823251001783,-0.060696304246262905,0.07557906708956258,0.04661216606273728,0.11009976667167118,-0.01172338378789545,0.05623748518264743,0.05797987398546388,0.07555009643195996,-0.1198610540441379,-0.010765113032555784,-0.18072115758704327,0.03354726475035893,-0.10527900213658256,0.01385856675247904,0.02212199108230734,0.040278726318675094,0.007844566963261688,0.0329546331909467,0.012018055146515058,-0.0930163888672396,0.059753938433656825,-0.0025053653891922295,-0.04677410386349034,0.006691293062675872,-0.09871657932876828,0.017871858398067403,-0.09855056672662676,0.07332350715739488,-0.01233543374323541,0.036753518180607694,0.08048719306804544,-0.015521794126865805,-0.003182078215323958,-0.02296016497792371,-0.04790495757099235,0.012078397782369774,-0.015121817222631171,0.024074859348447324,-0.05527334729776506,0.13995520034519138,-0.0353449063410745,-0.020164867081380405,-0.045339992149929044,-0.06135208252957321,0.041574367196350166,-0.1181835065156229,0.1009944555373451,-0.007243357226503875,-0.03152029634976193,-0.09362837936819231,0.05552016191330303,0.0645429506747162,-0.00987421674729185,0.05110263340750237,0.0763800459691419,0.05344086621196723,0.15778525938580806,0.1545912849631988,0.052214956230742876,0.017248123771394633,0.09465894857966806,-0.10325577760084782,-0.06157743454520257,-0.08563481583571507,-0.02984611610412722,-0.03297943921318005,0.029162509505644852,0.0537556680097474,0.06381386254688788,0.08318202788468117,0.09337166783680172,0.06052727963215763,-0.07478701301388353,-0.04332359978522624,-0.021835411488581084,0.025802403249721904,-0.01861220414651256,0.03447563054413696,0.10528470813657397,-0.0346801870174254,0.06458339538510258,0.006868637959882892,0.0005749479345983147,-0.008788872886205449,0.05487197051307678,0.17152659095941963,-0.08949748969216122,-0.07674656076222541,0.17057362022793066]
// -------
// You don’t need to edit anything below this
let i;
let vectors_out = [];
let amps = [];
let total_frame_count =0;
let sound, amplitude,level;
let count = 0;
function preload() {
sound = loadSound(audio);
}
function setup() {
pixelDensity(1);
createCanvas(width, height);
frameRate(fps);
start_z = nj.array(start)
end_z = nj.array(end)
amplitude = new p5.Amplitude();
sound.play();
}
function draw(){
if(sound.isPlaying()){
level = amplitude.getLevel();
amps.push(level)
// print(level);
total_frame_count++;
} else {
noLoop();
min_amp = min(amps)
max_amp = max(amps)
for (i=0; i < total_frame_count; i++){
mapped = map(amps[i],min_amp,max_amp,0.0,1.0)
vectors_out.push(njlerp(start_z,end_z,mapped).tolist())
}
generateInterpolation();
}
}
function generateInterpolation(z) {
a = vectors_out[count]
const path = "http://localhost:8000/query";
const data = {
z: a,
truncation: truncation_value
};
httpPost(path, 'json', data, gotImage, gotError);
}
function gotError(error) {
console.error(error);
}
function gotImage(result) {
i = createImg(result.image, imageReady);
i.hide();
}
function imageReady() {
image(i, 0, 0);
if (download_images) save(`step${nf(count, 4)}`);
count++;
if (count <= total_frame_count) {
print('generating image ' + (count) +'/'+ total_frame_count)
setTimeout(generateInterpolation, 100);
}
}
function njlerp(v0, v1, t) {
return v0.multiply(1-t).add(v1.multiply(t));
}