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2B,UAAUC,WAU5I,MAAMb,EACFvC,cACIM,KAAK+C,KAAO,GAEhBJ,KAAKR,GACDnC,KAAK+C,KAAKJ,KAAKR,GAEnB3B,SACI,IAAK,IAAI0B,EAAI,EAAGc,EAAMhD,KAAK+C,KAAKE,OAAQf,EAAIc,EAAKd,IAC7ClC,KAAK+C,KAAKb,GAAG1B,SAErBP,KAAKC,GACD,IAAK,IAAIgC,EAAI,EAAGc,EAAMhD,KAAK+C,KAAKE,OAAQf,EAAIc,EAAKd,IAC7ClC,KAAK+C,KAAKb,GAAGjC,KAAKC,GAE1BgD,IAAIhB,GACA,OAAOlC,KAAK+C,KAAKb,GAErBiB,OACI,OAAOnD,KAAK+C,KAAKE,QAGzBxC,OAAO2C,SAAW,WACG5B,SAAS6B,eAAe,gBC9F7C,MAAMC,EAASC,KAAKC,OAAOF,OAC3B,IAAIG,EACJ,OAAQH,GACJ,IAAK,OACDG,EAAa,GACb,MACJ,IAAK,OACDA,EAAa,GACb,MACJ,IAAK,UACDA,EAAa,GACb,MACJ,IAAK,SACDA,EAAa,GACb,MACJ,QACIA,EAAaC,SAASJ,GAClBK,MAAMF,KACNG,QAAQC,MAAM,aACdJ,EAAa,KD+ElB,SAAeH,GAClB,cAAeA,GACX,IAAK,SACD9D,EAAeqB,KAAKiD,MAAMR,GAC1B,MACJ,IAAK,SACD9D,EAAekE,SAASJ,GACxB,MACJ,QACI,MAAM,IAAIS,UAAU,sCAAwCT,EAAS,YAE7EhE,EAAI0E,IAAM,IAAIC,IAAI,YAClB3E,EAAI4E,OAAS,WACTjD,KCzFRkD,CAAMV,I","sources":["webpack://sakurairo-scripts/./src/app/falling_effect/sakura/sakura.js","webpack://sakurairo-scripts/./src/app/falling_effect/sakura/start.js"],"sourcesContent":["var stop, staticx, img = new Image;\nvar sakuraAmount = 50;\nclass Sakura {\n constructor(x, y, s, r, fn) {\n this.x = x, this.y = y, this.s = s, this.r = r, this.fn = fn;\n }\n draw(cxt) {\n cxt.save();\n var xc = 40 * this.s / 4;\n cxt.translate(this.x, this.y), cxt.rotate(this.r), cxt.drawImage(img, 0, 0, 40 * this.s, 40 * this.s), cxt.restore();\n }\n update() {\n this.x = this.fn.x(this.x, this.y), this.y = this.fn.y(this.y, this.y), this.r = this.fn.r(this.r), (this.x > window.innerWidth || this.x < 0 || this.y > window.innerHeight || this.y < 0) && (this.r = getRandom(\"fnr\"), Math.random() > .4 ? (this.x = getRandom(\"x\"), this.y = 0, this.s = getRandom(\"s\"), this.r = getRandom(\"r\")) : (this.x = window.innerWidth, this.y = getRandom(\"y\"), this.s = getRandom(\"s\"), this.r = getRandom(\"r\")));\n }\n}\n\nfunction getRandom(option) {\n var ret, random;\n switch (option) {\n case \"x\":\n ret = Math.random() * window.innerWidth;\n break;\n case \"y\":\n ret = Math.random() * window.innerHeight;\n break;\n case \"s\":\n ret = Math.random();\n break;\n case \"r\":\n ret = 6 * Math.random();\n break;\n case \"fnx\":\n random = 1 * Math.random() - .5, ret = function (x, y) {\n return x + .5 * random - 1.7\n };\n break;\n case \"fny\":\n random = 1.5 + .7 * Math.random(), ret = function (x, y) {\n return y + random\n };\n break;\n case \"fnr\":\n random = .03 * Math.random(), ret = function (r) {\n return r + random\n }\n }\n return ret\n}\n\nfunction startSakura() {\n requestAnimationFrame = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || window.msRequestAnimationFrame || window.oRequestAnimationFrame;\n var canvas = document.createElement(\"canvas\"),\n cxt;\n staticx = !0, canvas.height = window.innerHeight, canvas.width = window.innerWidth, canvas.setAttribute(\"style\", \"position: fixed;left: 0;top: 0;pointer-events: none;\"), canvas.setAttribute(\"id\", \"canvas_sakura\"), document.getElementsByTagName(\"body\")[0].appendChild(canvas), cxt = canvas.getContext(\"2d\");\n for (var sakuraList = new SakuraList, i = 0; i < sakuraAmount; i++) {\n var sakura, randomX, randomY, randomS, randomR, randomFnx, randomFny, randomFnR;\n randomX = getRandom(\"x\"), randomY = getRandom(\"y\"), randomR = getRandom(\"r\"), randomS = getRandom(\"s\"), randomFnx = getRandom(\"fnx\"), randomFny = getRandom(\"fny\"), randomFnR = getRandom(\"fnr\"), (sakura = new Sakura(randomX, randomY, randomS, randomR, {\n x: randomFnx,\n y: randomFny,\n r: randomFnR\n })).draw(cxt), sakuraList.push(sakura)\n }\n stop = requestAnimationFrame((function () {\n cxt.clearRect(0, 0, canvas.width, canvas.height), sakuraList.update(), sakuraList.draw(cxt), stop = requestAnimationFrame(arguments.callee)\n }))\n}\n\nfunction stopp() {\n if (staticx) {\n var child = document.getElementById(\"canvas_sakura\");\n child.parentNode.removeChild(child), window.cancelAnimationFrame(stop), staticx = !1\n } else startSakura()\n}\nclass SakuraList {\n constructor() {\n this.list = [];\n }\n push(sakura) {\n this.list.push(sakura);\n }\n update() {\n for (var i = 0, len = this.list.length; i < len; i++)\n this.list[i].update();\n }\n draw(cxt) {\n for (var i = 0, len = this.list.length; i < len; i++)\n this.list[i].draw(cxt);\n }\n get(i) {\n return this.list[i];\n }\n size() {\n return this.list.length;\n }\n}\nwindow.onresize = function () {\n var canvasSnow = document.getElementById(\"canvas_snow\")\n //TODO:FIX RESIZE\n}\n\nexport function start(amount) {\n switch (typeof amount) {\n case 'number':\n sakuraAmount = Math.floor(amount)\n break;\n case 'string':\n sakuraAmount = parseInt(amount)\n break;\n default:\n throw new TypeError('need a int as args, but get ' + typeof amount + ' instead')\n }\n img.src = new URL('sakura.png', import.meta.url)\n img.onload = function () {\n startSakura()\n };\n\n}","import { start } from \"./sakura\"\n\nconst amount = _iro.effect.amount\nlet sakura_num\nswitch (amount) {\n case 'half':\n sakura_num = 25\n break\n case 'less':\n sakura_num = 15\n break\n case 'quarter':\n sakura_num = 35\n break\n case 'native':\n sakura_num = 50\n break\n default:\n sakura_num = parseInt(amount)\n if (isNaN(sakura_num)) {\n console.error('wrong arg')\n sakura_num = 50\n }\n}\nstart(sakura_num)"],"names":["img","Image","sakuraAmount","Sakura","constructor","x","y","s","r","fn","this","draw","cxt","save","translate","rotate","drawImage","restore","update","window","innerWidth","innerHeight","getRandom","Math","random","option","ret","startSakura","requestAnimationFrame","mozRequestAnimationFrame","webkitRequestAnimationFrame","msRequestAnimationFrame","oRequestAnimationFrame","canvas","document","createElement","height","width","setAttribute","getElementsByTagName","appendChild","getContext","sakuraList","SakuraList","i","sakura","randomX","randomY","randomS","randomR","randomFnx","randomFny","randomFnR","push","clearRect","arguments","callee","list","len","length","get","size","onresize","getElementById","amount","_iro","effect","sakura_num","parseInt","isNaN","console","error","floor","TypeError","src","URL","onload","start"],"sourceRoot":""}
|