{"id":204364,"student_id":12205,"content":"","created_at":"2020-11-14T16:03:31.694+08:00","updated_at":"2020-11-14T16:03:31.694+08:00","name":"世界國旗 副本","language":"javascript","screenshot":{"url":null},"parent_id":10369,"plugin":"var grid = [];\nvar padding = 10;\npen.size = 0;\n\nforever(function(){\n\n var w,h;\n\n w = grid.length;\n h = 1;\n for(var i=0; i\u003cgrid.length; i++) {\n if(grid[i].constructor === Array \u0026\u0026 grid[i].length \u003e h) {\n h = grid[i].length;\n }\n }\n\n var a = (640 - padding*2) / w;\n var b = (480 - padding*2) / h;\n var cellWidth = a \u003e b ? b : a;\n\n var offsetX = (640 - cellWidth * w) / 2;\n var offsetY = (480 - cellWidth * h) / 2;\n\n var time = Date.now()/1000;\n\n for(var i=0; i\u003cgrid.length; i++) {\n if(grid[i].constructor === Array) {\n for(var j=0; j\u003cgrid[i].length; j++) {\n if(grid[i][j]===undefined) continue;\n pen.fillColor = grid[i][j];\n if(window.shape == 'rect' \u0026\u0026 !animate) {\n pen.drawRect(offsetX + i*cellWidth, offsetY + j*cellWidth, cellWidth - cellWidth/10, cellWidth - cellWidth/10);\n }\n if(window.shape == 'circle' \u0026\u0026 !animate) {\n pen.drawCircle(offsetX + i*cellWidth + cellWidth/2, offsetY + j*cellWidth + cellWidth/2, cellWidth/2 - cellWidth/10);\n }\n if(animate) {\n var waveX = Math.sin(time*3 - Math.PI*i/7);\n var waveY = Math.sin(time*3 - Math.PI*i/7 + Math.PI/2);\n }\n if(window.shape == 'rect' \u0026\u0026 animate) {\n pen.drawRect(offsetX + i*cellWidth + waveX*3, offsetY + j*cellWidth + waveY*10, cellWidth - cellWidth/10 - waveX*1.2, cellWidth - cellWidth/10 - waveX*2);\n }\n if(window.shape == 'circle' \u0026\u0026 animate) {\n pen.drawCircle(offsetX + i*cellWidth + cellWidth/2 + waveX*3, offsetY + j*cellWidth + cellWidth/2 + waveY*10, cellWidth/2 - cellWidth/10 - waveX*2);\n }\n }\n } else {\n if(grid[i]===undefined) continue;\n pen.fillColor = grid[i];\n if(window.shape == 'rect') {\n pen.drawRect(offsetX + i*cellWidth, offsetY, cellWidth - cellWidth/10, cellWidth - cellWidth/10);\n } else {\n pen.drawCircle(offsetX + i*cellWidth + cellWidth/2, offsetY + cellWidth/2, cellWidth/2 - cellWidth/10);\n }\n }\n }\n\n if(showIndex) {\n for(var i=0; i\u003cw; i++) {\n print(i, offsetX + i*cellWidth, offsetY - cellWidth/2, \"white\", cellWidth/3);\n }\n if(h \u003e 1) {\n for(var i=0; i\u003ch; i++) {\n print(i, offsetX - cellWidth/2, offsetY + i*cellWidth, \"white\", cellWidth/3);\n }\n }\n }\n});\n\n//------------------------------------------------//\nsetBackdrop(\"#222\");\nvar shape = 'circle';\nvar showIndex = false;\nvar animate = true;\nvar flagName = 'ddd';\n\nforever(function(){\n print(flagName, 50, 450, \"white\", 30);\n});\n\nfunction a () { \n flagName = \"印度尼西亞共和國\"\n grid = [];\n for(var i=0; i\u003c30; i++) {\n grid[i] = [];\n for(var j=0; j\u003c20; j++) {\n if(j\u003c10){\n grid[i][j] = \"red\";\n }else{\n grid[i][j] = \"white\";\n }\n }\n }\n}\n\nfunction b () { \n flagName = \"泰王國國旗\"\n grid = [];\n for(var i=0; i\u003c45; i++) {\n grid[i] = [];\n for(var j=0; j\u003c30; j++) {\n if(j\u003c5){\n grid[i][j] = \"red\";\n }else if(j\u003c10){\n grid[i][j] = \"white\";\n }else if(j\u003c20){\n grid[i][j] = \"darkslateblue\";\n }else if(j\u003c25){\n grid[i][j] = \"white\";\n }else{\n grid[i][j] = \"red\";\n }\n }\n }\n}\n\nfunction c () { \n flagName = \"阿拉伯聯合大公國國旗\"\n grid = [];\n for(var i=0; i\u003c40; i++) {\n grid[i] = [];\n for(var j=0; j\u003c20; j++) {\n if(j\u003c7){\n grid[i][j] = \"green\";\n }else if(j\u003c13){\n grid[i][j] = \"white\";\n }else{\n grid[i][j] = \"black\";\n }\n if(i \u003c 9){\n grid[i][j] = \"red\";\n }\n }\n }\n}\n\nfunction d () { \n flagName = \"葉門共和國國旗\";\n grid = [];\n for(var i=0; i\u003c45; i++) {\n grid[i] = [];\n for(var j=0; j\u003c30; j++) {\n if(j\u003c10){\n grid[i][j] = \"red\";\n }else if(j\u003c20){\n grid[i][j] = \"white\";\n }else{\n grid[i][j] = \"black\";\n }\n }\n }\n}\n\nfunction e () { \n flagName = \"亞美尼亞共和國國旗\";\n grid = [];\n for(var i=0; i\u003c45; i++) {\n grid[i] = [];\n for(var j=0; j\u003c30; j++) {\n if(j\u003c10){\n grid[i][j] = \"red\";\n }else if(j\u003c20){\n grid[i][j] = \"blue\";\n }else{\n grid[i][j] = \"gold\";\n }\n }\n }\n}\n\nfunction f () { \n flagName = \"南奧塞提亞共和國國旗\";\n grid = [];\n for(var i=0; i\u003c45; i++) {\n grid[i] = [];\n for(var j=0; j\u003c30; j++) {\n if(j\u003c10){\n grid[i][j] = \"white\";\n }else if(j\u003c20){\n grid[i][j] = \"red\";\n }else{\n grid[i][j] = \"yellow\";\n }\n }\n }\n}\n\nfunction g () { \n flagName = \"喬治亞國旗\";\n grid = [];\n for(var i=0; i\u003c45; i++) {\n grid[i] = [];\n for(var j=0; j\u003c30; j++) {\n grid[i][j] = \"white\";\n if((i \u003e= 18 \u0026\u0026 i \u003c 26)){\n grid[i][j] = \"red\";\n }\n if((j \u003e= 12 \u0026\u0026 j \u003c 18)){\n grid[i][j] = \"red\";\n }\n }\n }\n}\nfunction h () { \n flagName = \"法蘭西共和國國旗\"\n grid = [];\n for(var i=0; i\u003c45; i++) {\n grid[i] = [];\n for(var j=0; j\u003c30; j++) {\n if(i \u003c 15){\n grid[i][j] = \"blue\";\n }else if(i \u003c 30){\n grid[i][j] = \"white\";\n }else{\n grid[i][j] = \"red\";\n }\n }\n }\n}\n\nfunction i () { \n flagName = \"荷蘭王國國旗\"\n grid = [];\n for(var i=0; i\u003c45; i++) {\n grid[i] = [];\n for(var j=0; j\u003c30; j++) {\n if(j \u003c 10){\n grid[i][j] = \"red\";\n }else if(j\u003c 20){\n grid[i][j] = \"white\";\n }else{\n grid[i][j] = \"blue\";\n }\n }\n }\n}\nfunction j () { \n flagName = \"比利時王國國旗\"\n grid = [];\n for(var i=0; i\u003c30; i++) {\n grid[i] = [];\n for(var j=0; j\u003c26; j++) {\n if(i \u003c 10){\n grid[i][j] = \"black\";\n }else if(i\u003c 20){\n grid[i][j] = \"yellow\";\n }else{\n grid[i][j] = \"red\";\n }\n }\n }\n}\n\nfunction k () { \n flagName = \"摩納哥公國國旗\"\n grid = [];\n for(var i=0; i\u003c35; i++) {\n grid[i] = [];\n for(var j=0; j\u003c26; j++) {\n if(j \u003c 13){\n grid[i][j] = \"red\";\n }else{\n grid[i][j] = \"white\";\n }\n }\n }\n}\n\nfunction l () { \n flagName = \"愛爾蘭共和國國旗\"\n grid = [];\n for(var i=0; i\u003c30; i++) {\n grid[i] = [];\n for(var j=0; j\u003c24; j++) {\n if(i\u003c10){\n grid[i][j] = \"green\";\n }else if(i \u003c20){\n grid[i][j] = \"white\";\n }else{\n grid[i][j] = \"orange\";\n }\n }\n }\n}\nl();\n\nfunction m () { \n flagName = \"盧森堡大公國國旗\"\n grid = [];\n for(var i=0; i\u003c40; i++) {\n grid[i] = [];\n for(var j=0; j\u003c27; j++) {\n if(j\u003c9){\n grid[i][j] = \"red\";\n }else if(j\u003c18){\n grid[i][j] = \"white\";\n }else{\n grid[i][j] = \"cyan\";\n }\n }\n }\n}\n\nfunction n () {\n flagName = \"波蘭共和國國旗\"\n grid = [];\n for(var i=0; i\u003c32; i++) {\n grid[i] = [];\n for(var j=0; j\u003c20; j++) {\n if(j\u003c10){\n grid[i][j] = \"white\";\n }else{\n grid[i][j] = \"red\";\n }\n }\n }\n}\n\nvar flag = [a, b, c, d, e, f, g, h, i, j, k, l, m, n];\nvar count = 0;\nvar clock = 0;\nforever(function(){\n clock++;\n if(clock%200 == 0) {\n count\n if(++count\u003e=flag.length) count=0;\n flag[count++]();\n }\n});\nflag[count++]();","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":30,"hashid":"kdms6669e","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
1:1:1
1:1
full
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦