{"id":19637,"student_id":2591,"content":"setBackdrop(\"black\");\r\n\r\nconst MAXX=640;\r\nconst MAXY=480;\r\nconst NUM=300;\r\nconst BOOMTIME=10;\r\n\r\nvar Light = function(){\r\n\r\n this.pauseTime=BOOMTIME;\r\n this.lastCursorX=cursor.x;\r\n this.lastCursorY=cursor.y;\r\n\r\n this.x = Math.random()*MAXX;\r\n this.y = Math.random()*MAXX;\r\n this.vx = Math.random()*6-3;\r\n this.vy = Math.random()*6-3;\r\n if(this.vx\u003e=0 \u0026\u0026 this.vx\u003c1) this.vx+=1;\r\n if(this.vx\u003c=0 \u0026\u0026 this.vx\u003e-1) this.vx-=1;\r\n if(this.vy\u003e=0 \u0026\u0026 this.vy\u003c1) this.vy+=1;\r\n if(this.vy\u003c=0 \u0026\u0026 this.vy\u003e-1) this.vy-=1;\r\n\r\n if(this.x\u003ecursor.x) this.vx=-Math.abs(this.vx);\r\n else this.vx=Math.abs(this.vx);\r\n if(this.y\u003ecursor.y) this.vy=-Math.abs(this.vy);\r\n else this.vy=Math.abs(this.vy);\r\n\r\n this.R=Math.floor(Math.random()*225+30);\r\n this.G=Math.floor(Math.random()*225+30);\r\n this.B=Math.floor(Math.random()*225+30);\r\n this.vR=Math.floor(Math.random()*10-5);\r\n this.vG=Math.floor(Math.random()*10-5);\r\n this.vB=Math.floor(Math.random()*10-5);\r\n\r\n this.r = Math.random()*18+1;\r\n this.vr = Math.random()*1-0.5;\r\n}\r\n\r\nLight.prototype.drawCircle=function(){\r\n\r\n var cursorX=cursor.x;\r\n var cursorY=cursor.y;\r\n if(cursorX==this.lastCursorX \u0026\u0026 cursorY==this.lastCursorY) \r\n this.pauseTime++;\r\n else this.pauseTime=0;\r\n\r\n this.lastCursorX=cursorX;\r\n this.lastCursorY=cursorY;\r\n\r\n if(this.pauseTime\u003cBOOMTIME){\r\n if(this.x\u003ecursorX) this.vx=-Math.abs(this.vx);\r\n else this.vx=Math.abs(this.vx);\r\n if(this.y\u003ecursorY) this.vy=-Math.abs(this.vy);\r\n else this.vy=Math.abs(this.vy);\r\n }\r\n\r\n if(this.x+this.vx\u003eMAXX-this.r || this.x+this.vx\u003c0) this.vx=-this.vx;\r\n if(this.y+this.vy\u003eMAXY-this.r || this.y+this.vy\u003c0) this.vy=-this.vy;\r\n\r\n this.x += this.vx;\r\n this.y += this.vy;\r\n\r\n if(this.r+this.vr\u003e20 || this.r+this.vr\u003c1) this.vr=-this.vr;\r\n this.r += this.vr;\r\n\r\n if(this.R+this.vR\u003e255 || this.R+this.vR\u003c30) this.vR=-this.vR;\r\n if(this.G+this.vG\u003e255 || this.G+this.vG\u003c30) this.vG=-this.vG;\r\n if(this.B+this.vB\u003e255 || this.B+this.vB\u003c30) this.vB=-this.vB;\r\n\r\n this.R += this.vR;this.G += this.vG;this.B += this.vB;\r\n\r\n this.color = \"rgb(\"+\r\n this.R + \",\" + this.G + \",\" + this.B + \")\";\r\n\r\n pen.size = 0;\r\n pen.fillColor = this.color;\r\n pen.drawCircle(this.x, this.y, this.r);\r\n};\r\n\r\nvar lights=[];\r\nfor(var i=0;i\u003cNUM;i++){\r\n lights[i]=new Light();\r\n}\r\n\r\nforever(function(){\r\n for(var i=0;i\u003cNUM;i++){\r\n lights[i].drawCircle();\r\n }\r\n});","created_at":"2018-01-08T17:41:25.708+08:00","updated_at":"2019-06-17T22:54:25.776+08:00","name":"彩色火花","language":"javascript","screenshot":{"url":"https://cdn5.koding.school/uploads/project/screenshot/19637/bd87985f006b8018018f9ee76cd2894d.jpg"},"parent_id":12399,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":122,"hashid":"rdvs44j4","is_content_changed":false,"review_status":"pending","submitted_at":"2018-02-02T10:21:25.983+08:00","reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":390018,"file_name":"0.png","project_id":19637,"asset_id":32205,"created_at":"2018-01-08T17:41:25.722+08:00","updated_at":"2018-01-08T17:41:25.722+08:00"},{"id":390019,"file_name":"1.svg","project_id":19637,"asset_id":32206,"created_at":"2018-01-08T17:41:25.730+08:00","updated_at":"2018-01-08T17:41:25.730+08:00"},{"id":390020,"file_name":"2.png","project_id":19637,"asset_id":32207,"created_at":"2018-01-08T17:41:25.733+08:00","updated_at":"2018-01-08T17:41:25.733+08:00"},{"id":390021,"file_name":"0.wav","project_id":19637,"asset_id":32208,"created_at":"2018-01-08T17:41:25.735+08:00","updated_at":"2018-01-08T17:41:25.735+08:00"},{"id":390022,"file_name":"1.wav","project_id":19637,"asset_id":32209,"created_at":"2018-01-08T17:41:25.738+08:00","updated_at":"2018-01-08T17:41:25.738+08:00"}]
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
繁中
简中
English
日本語
1:1:1
1:1
全寬
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦