Changeset 29634 for other-projects/nz-flag-design/trunk/render-3d
- Timestamp:
- 2014-12-15T13:07:02+13:00 (9 years ago)
- Location:
- other-projects/nz-flag-design/trunk/render-3d
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
other-projects/nz-flag-design/trunk/render-3d/CSS/button.css
r29579 r29634 4 4 -webkit-border-radius:42px; 5 5 border-radius:100%; 6 border:1vh solid # 057fd0;6 border:1vh solid #7F90B9; 7 7 display: block; 8 8 cursor:pointer; -
other-projects/nz-flag-design/trunk/render-3d/flag.html
r29620 r29634 27 27 transition: right 0.5s; 28 28 background-image: url("./images/slider.png"); 29 background-size: 25vw 150vh;29 background-size: cover; 30 30 background-position: center; 31 31 } … … 67 67 <!--Toggle: 68 68 <a onclick="wind = !wind;">Wind</a> |--> 69 <a class="myButton" style="background-image:url('./images/sunButton.jpg')" onclick=" fine = !fine;"></a>69 <a class="myButton" style="background-image:url('./images/sunButton.jpg')" onclick="sunny = !sunny;"></a> 70 70 <a class="myButton" style="background-image:url('./images/rainButton.jpg')" onclick="raining = !raining;"></a> 71 71 <a class="myButton" style="background-image:url('./images/snowButton.jpg')" onclick="snowing = !snowing;"></a> … … 80 80 function openclose(){ 81 81 if (open){ 82 document.getElementById("menuContainer").style.right = "- 20vw";82 document.getElementById("menuContainer").style.right = "-19vw"; 83 83 document.getElementById("arrow").style.transform = "rotate(360deg)"; 84 84 }else{document.getElementById("menuContainer").style.right = "0vw"; … … 101 101 <script type="text/javascript" src="./weather/rain.js"></script> 102 102 <script type="text/javascript" src="./weather/snow.js"></script> 103 <script type="text/javascript" src="./weather/sun.js"></script> 103 104 104 105 <script type="text/javascript" src="./Flag_files/KeyboardState.js"></script> … … 161 162 /* Weather variables */ 162 163 var weatherSystem; 164 163 165 var raining = false; 164 166 var snowing = false; 167 var sunny = false; 168 165 169 var snowSystem; 166 170 var rainSystem; 171 var sunSystem; 167 172 168 173 /* Mouse variables */ … … 184 189 185 190 var object, tmpFlag, arrow; 191 186 192 187 193 var rotate = false; … … 259 265 rainSystem = new rain(); 260 266 snowSystem = new snow(); 267 sunSystem = new sun(); 261 268 weatherSystem = new weatherSystem(scene); 262 269 … … 285 292 arrow = new THREE.ArrowHelper( new THREE.Vector3( 0, 1, 0 ), new THREE.Vector3( 0, 0, 0 ), 50, 0xff0000 ); 286 293 arrow.position.set( -200, -50, -200 ); 294 arrow.setLength( 0 ); 295 arrow.setDirection( 0 ); 287 296 //scene.add( arrow ); 288 297 … … 423 432 424 433 var time = Date.now(); 434 425 435 windStrength = Math.cos( time / 7000 ) * 100 + 200; 426 436 windForce.set( 1000,500,Math.sin( time / 1000 ) ).normalize().multiplyScalar( windStrength ); 427 437 arrow.setLength( windStrength ); 428 438 arrow.setDirection( windForce ); 439 429 440 controls.update(); 430 441 simulate(time); … … 468 479 if(raining && weatherSystem.type != rainSystem){ 469 480 snowing = false; 481 sunny = false; 470 482 weatherSystem.swap(rainSystem); 471 483 }else if(snowing && weatherSystem.type != snowSystem){ 472 484 raining = false; 485 sunny = false; 473 486 weatherSystem.swap(snowSystem); 487 }else if(sunny && weatherSystem.type != sunSystem){ 488 raining = false; 489 snowing = false; 490 weatherSystem.swap(sunSystem); 474 491 } 475 492 -
other-projects/nz-flag-design/trunk/render-3d/weather/rain.js
r29475 r29634 3 3 4 4 this.isInit = false; 5 this.MASS = 0.01; 5 6 6 7 this.init = function() { … … 13 14 14 15 // create the particle variables 15 this.particleCount = 1800,16 this.particleCount = 3500, 16 17 this.particles = new THREE.Geometry(), 17 18 this.pMaterial = new THREE.ParticleBasicMaterial({ … … 31 32 // create a particle with random 32 33 // position values, -250 -> 250 33 var pX = Math.random() * window.innerWidth * 2 - window.innerWidth,34 35 pZ = Math.random() * window.innerWidth * 2 - window.innerWidth;36 this.particle = new THREE.Vector3(pX, pY, pZ); 34 var pX = (Math.random() * 3000) - 1500, 35 pY = Math.random() * window.innerHeight * 3 - window.innerHeight, 36 pZ = (Math.random() * 3000) - 1500; 37 this.particle = new THREE.Vector3(pX, pY, pZ); 37 38 38 39 // create a velocity vector 39 40 0, // x41 -Math.random(), // y42 0); // z40 this.particle.velocity = new THREE.Vector3( 41 (windForce.x * this.MASS), // x 42 -Math.random() * 0.01, // y 43 (windForce.z * this.MASS)); // z 43 44 44 45 // add it to the geometry … … 70 71 71 72 // check if we need to reset 72 if(this.particle.y < - 200) {73 this.particle.y = Math.random() * window.innerHeight+10;73 if(this.particle.y < -10) { 74 this.particle.y = (window.innerHeight*2)+(Math.random() * 100); 74 75 this.particle.velocity.y = 0; 76 this.particle.x = (Math.random() * 4000) - 2000; 77 this.particle.z = (Math.random() * 4000) - 2000; 78 75 79 } 76 80 77 81 // update the velocity 78 this.particle.velocity.y -= Math.random() * .1;82 this.particle.velocity.y -= Math.random() * 0.01; 79 83 80 84 // and the position -
other-projects/nz-flag-design/trunk/render-3d/weather/snow.js
r29547 r29634 3 3 4 4 this.isInit = false; 5 this.M ass = 0.01;5 this.MASS = 0.005; 6 6 7 7 this.init = function() { … … 14 14 15 15 // create the particle variables 16 this.particleCount = 2000,16 this.particleCount = 3000, 17 17 this.particles = new THREE.Geometry(), 18 18 … … 32 32 33 33 // create a particle with random 34 // position values , -250 -> 25035 var pX = Math.random() * window.innerWidth * 3 - window.innerWidth,36 pY = Math.random() * window.innerHeight * 4- window.innerHeight,37 pZ = Math.random() * window.innerWidth * 3 - window.innerWidth;34 // position values 35 var pX = (Math.random() * 3000) - 1500, 36 pY = Math.random() * window.innerHeight * 3 - window.innerHeight, 37 pZ = (Math.random() * 3000) - 1500; 38 38 this.particle = new THREE.Vector3(pX, pY, pZ); 39 39 40 40 // create a velocity vector 41 41 this.particle.velocity = new THREE.Vector3( 42 0, // x 43 -Math.random(), // y 44 0); // z 45 42 (windForce.x * this.MASS), // x 43 -Math.random() * 0.01, // y 44 (windForce.z * this.MASS)); // z 45 46 //this.particle.velocity.z = arrow.direction.z * this.MASS; 46 47 // add it to the geometry 47 48 this.particles.vertices.push(this.particle); … … 73 74 74 75 // check if we need to reset 75 if(this.particle.y < - 200) {76 this.particle.y = Math.random() * window.innerHeight+10;76 if(this.particle.y < -10) { 77 this.particle.y = (window.innerHeight*2)+(Math.random() * 100); 77 78 this.particle.velocity.y = 0; 79 this.particle.x = (Math.random() * 4000) - 2000; 80 this.particle.z = (Math.random() * 4000) - 2000; 81 78 82 } 79 83 80 84 // update the velocity 81 this.particle.velocity.y -= Math.random() * this.Mass; 82 85 this.particle.velocity.y -= Math.random() * 0.001; 86 //this.particle.velocity.x = (windForce.x * this.MASS); 87 //this.particle.velocity.z = (windForce.z * this.MASS); 88 83 89 // and the position 84 90 this.particle.addVectors( -
other-projects/nz-flag-design/trunk/render-3d/weather/weather.js
r29475 r29634 23 23 this.swap = function(w){ 24 24 if(this.type != w){ 25 if(this.type !== null) this.scene.remove(this.getWeather()); 25 if(this.type !== null){ 26 this.scene.remove(this.getWeather()); 27 } 26 28 this.set(w); 27 29 } 28 30 } 29 30 31 31 32 32 this.isSet = function(){
Note:
See TracChangeset
for help on using the changeset viewer.