{"id":8233,"student_id":1470,"content":"var pen = Game.pen;\nvar numOfBalls = 4;\nvar balls = [];\nvar ballPosition = [];\nvar radius = 100;\npen.size = 1;\n\nfor (var i = 0; i \u003c numOfBalls; i++) {\n balls.push({\n bias: Math.PI/(numOfBalls+1)*i*(Math.random()+1),\n biasQ: Math.PI/(numOfBalls)*i*(Math.random()+1),\n velocity: Math.random()*0.3,\n // velocity: (Math.random()-0.5)/10,\n amplitude: {x: radius, y: radius},\n // amplitude: {x: Math.random() * radius, y: Math.random() * radius},\n angle: 0,\n oscillate: function () {\n this.angle += this.velocity;\n },\n display: function () {\n var x = Math.cos(this.angle) * radius * Math.cos(this.bias)+ 320;\n var y = Math.sin(this.angle) * radius * Math.cos(this.biasQ)+ 240;\n pen.drawCircle(x, y, 5);\n pen.drawLine(320, 240, x, y);\n ballPosition.push({x: x, y: y});\n if(ballPosition.length\u003enumOfBalls*300){\n ballPosition.splice(0,1);\n }\n },\n update: function () {\n this.oscillate();\n this.display();\n for(var i = 0; i \u003c ballPosition.length; i++){\n pen.color = \"#333\";\n pen.drawRect(ballPosition[i].x, ballPosition[i].y, 1, 1);\n }\n pen.color = \"black\";\n }\n });\n\n}\n\nforever(function () {\n if(balls.length \u003e= numOfBalls){\n for (var i = 0; i \u003c numOfBalls; i++) {\n balls[i].update();\n }\n \n }\n \n})\n\n","created_at":"2017-03-01T20:52:04.729+08:00","updated_at":"2019-11-09T19:14:14.244+08:00","name":"公轉軌跡","language":"javascript","screenshot":{"url":"https://cdn1.koding.school/uploads/project/screenshot/8233/da786cdddf9c9e70c6e3f0694aba919f.jpg"},"parent_id":2,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":470,"hashid":"9ygskjp","is_content_changed":null,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":182475,"file_name":"0.png","project_id":8233,"asset_id":6,"created_at":"2017-07-26T16:02:24.332+08:00","updated_at":"2017-07-26T16:02:24.332+08:00"},{"id":182476,"file_name":"1.svg","project_id":8233,"asset_id":7,"created_at":"2017-07-26T16:02:24.334+08:00","updated_at":"2017-07-26T16:02:24.334+08:00"},{"id":182477,"file_name":"2.png","project_id":8233,"asset_id":8,"created_at":"2017-07-26T16:02:24.336+08:00","updated_at":"2017-07-26T16:02:24.336+08:00"},{"id":182478,"file_name":"0.wav","project_id":8233,"asset_id":9,"created_at":"2017-07-26T16:02:24.337+08:00","updated_at":"2017-07-26T16:02:24.337+08:00"},{"id":182479,"file_name":"1.wav","project_id":8233,"asset_id":10,"created_at":"2017-07-26T16:02:24.339+08:00","updated_at":"2017-07-26T16:02:24.339+08:00"}]
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
繁中
简中
English
日本語
1:1:1
1:1
全寬
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦