{"id":43945,"student_id":1981,"content":"{\"html\":\"\\r\\n\u003cdiv id=\\\"container\\\"\u003e\u003c/div\u003e\\r\\n\u003cscript src=\\\"//a-jie.github.io/three.proton/engine/lib/three.min.js\\\"\u003e\u003c/script\u003e\\r\\n\u003cscript src=\\\"//a-jie.github.io/three.proton/engine/build/three.proton.min.js\\\"\u003e\u003c/script\u003e\\r\\n\u003cscript src=\\\"//a-jie.github.io/three.proton/engine/example/js/lib/TrackballControls.js\\\"\u003e\u003c/script\u003e\",\"css\":\"body {\\r\\n font-family: Monospace;\\r\\n background-color: #fff;\\r\\n margin: 0;\\r\\n padding: 0;\\r\\n overflow: hidden;\\r\\n}\\r\\n\\r\\n.tips {\\r\\n position: absolute;\\r\\n right: 20px;\\r\\n top: 10px;\\r\\n color: #fff;\\r\\n}\\r\\n\\r\\n.tips a {\\r\\n color: #999;\\r\\n}\",\"js\":\"var proton, emitter;\\r\\nvar camera, scene, renderer, stats, clock, spring, controls;\\r\\nvar color1, color2,\\r\\n tha = 0,\\r\\n hcolor = 0;\\r\\n\\r\\ninit();\\r\\n\\r\\nfunction init() {\\r\\n addScene();\\r\\n addControls();\\r\\n addLights();\\r\\n addStars();\\r\\n addProton();\\r\\n animate();\\r\\n}\\r\\n\\r\\nfunction addScene() {\\r\\n camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 1, 1000);\\r\\n camera.position.z = 500;\\r\\n scene = new THREE.Scene();\\r\\n scene.fog = new THREE.Fog(0xffffff, 1, 10000);\\r\\n\\r\\n renderer = new THREE.WebGLRenderer();\\r\\n renderer.setPixelRatio(window.devicePixelRatio);\\r\\n renderer.setSize(window.innerWidth, window.innerHeight);\\r\\n\\r\\n document.body.appendChild(renderer.domElement);\\r\\n window.addEventListener('resize', onWindowResize, false);\\r\\n}\\r\\n\\r\\nfunction addControls() {\\r\\n controls = new THREE.TrackballControls(camera);\\r\\n controls.rotateSpeed = 1.0;\\r\\n controls.zoomSpeed = 1.2;\\r\\n controls.panSpeed = 0.8;\\r\\n controls.noZoom = false;\\r\\n controls.noPan = false;\\r\\n controls.staticMoving = true;\\r\\n controls.dynamicDampingFactor = 0.3;\\r\\n}\\r\\n\\r\\nfunction addLights() {\\r\\n var ambientLight = new THREE.AmbientLight(0x101010);\\r\\n scene.add(ambientLight);\\r\\n\\r\\n var pointLight = new THREE.PointLight(0xffffff, 2, 1000, 1);\\r\\n pointLight.position.set(0, 200, 200);\\r\\n scene.add(pointLight);\\r\\n}\\r\\n\\r\\nfunction addStars() {\\r\\n var geometry = new THREE.Geometry();\\r\\n for (var i = 0; i \u003c 10000; i++) {\\r\\n var vertex = new THREE.Vector3();\\r\\n vertex.x = THREE.Math.randFloatSpread(2000);\\r\\n vertex.y = THREE.Math.randFloatSpread(2000);\\r\\n vertex.z = THREE.Math.randFloatSpread(2000);\\r\\n geometry.vertices.push(vertex);\\r\\n }\\r\\n var particles = new THREE.Points(geometry, new THREE.PointsMaterial({\\r\\n color: 0x888888\\r\\n }));\\r\\n scene.add(particles);\\r\\n}\\r\\n\\r\\nfunction addProton() {\\r\\n proton = new Proton();\\r\\n\\r\\n emitter = new Proton.Emitter();\\r\\n //setRate\\r\\n emitter.rate = new Proton.Rate(new Proton.Span(4, 16), new Proton.Span(.01));\\r\\n //addInitialize\\r\\n emitter.addInitialize(new Proton.Position(new Proton.PointZone(0, 0)));\\r\\n emitter.addInitialize(new Proton.Mass(1));\\r\\n emitter.addInitialize(new Proton.Radius(6, 12));\\r\\n emitter.addInitialize(new Proton.Life(3));\\r\\n emitter.addInitialize(new Proton.V(45, new Proton.Vector3D(0, 1, 0), 180));\\r\\n //addBehaviour\\r\\n emitter.addBehaviour(new Proton.Alpha(1, 0));\\r\\n emitter.addBehaviour(new Proton.Scale(.1, 1.3));\\r\\n\\r\\n color1 = new THREE.Color();\\r\\n color2 = new THREE.Color();\\r\\n colorBehaviour = new Proton.Color(color1, color2);\\r\\n emitter.addBehaviour(colorBehaviour);\\r\\n\\r\\n emitter.emit();\\r\\n //add emitter\\r\\n proton.addEmitter(emitter);\\r\\n proton.addRender(new Proton.SpriteRender(scene));\\r\\n}\\r\\n\\r\\nfunction createSprite() {\\r\\n var map = new THREE.TextureLoader().load(\\\"./img/dot.png\\\");\\r\\n var material = new THREE.SpriteMaterial({\\r\\n map: map,\\r\\n color: 0xff0000,\\r\\n blending: THREE.AdditiveBlending,\\r\\n fog: true\\r\\n });\\r\\n return new THREE.Sprite(material);\\r\\n}\\r\\n\\r\\nfunction setColor() {\\r\\n hcolor += .01;\\r\\n color1.setHSL(hcolor - (hcolor \u003e\u003e 0), 1, .5);\\r\\n color2.setHSL(hcolor - (hcolor \u003e\u003e 0) + .3, 1, .5);\\r\\n //colorBehaviour.reset(color1, color2);\\r\\n}\\r\\n\\r\\nfunction animate() {\\r\\n requestAnimationFrame(animate);\\r\\n render();\\r\\n}\\r\\n\\r\\nvar ctha = 0;\\r\\nvar r = 500;\\r\\n\\r\\nfunction render() {\\r\\n setColor();\\r\\n proton.update();\\r\\n tha += Math.PI / 150;\\r\\n var p = 300 * Math.sin(2 * tha)\\r\\n emitter.p.x = p * Math.cos(tha);\\r\\n emitter.p.y = p * Math.sin(tha);\\r\\n emitter.p.z = p * Math.tan(tha) / 2;\\r\\n\\r\\n renderer.render(scene, camera);\\r\\n //controls.update();\\r\\n camera.lookAt(scene.position);\\r\\n\\r\\n ctha += .016;\\r\\n r = 300;\\r\\n camera.position.x = Math.sin(ctha) * r;\\r\\n camera.position.z = Math.cos(ctha) * r;\\r\\n camera.position.y = Math.sin(ctha) * r;\\r\\n}\\r\\n\\r\\nfunction onWindowResize() {\\r\\n\\r\\n}\"}","created_at":"2018-10-05T15:43:09.264+08:00","updated_at":"2019-10-18T01:48:15.063+08:00","name":"www","language":"web","screenshot":{"url":"https://cdn1.koding.school/uploads/project/screenshot/43945/e7d6ba5d7fbbb413737de67d4af12a35.jpg"},"parent_id":null,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":78,"hashid":"9ygsr622","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
到這台電腦