| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * A solar system visualization. | 6 * A solar system visualization. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 library solar; | 9 library solar; |
| 10 | 10 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 /** | 25 /** |
| 26 * Display the animation's FPS in a div. | 26 * Display the animation's FPS in a div. |
| 27 */ | 27 */ |
| 28 void showFps(num fps) { | 28 void showFps(num fps) { |
| 29 if (fpsAverage == null) { | 29 if (fpsAverage == null) { |
| 30 fpsAverage = fps; | 30 fpsAverage = fps; |
| 31 } | 31 } |
| 32 | 32 |
| 33 fpsAverage = fps * 0.05 + fpsAverage * 0.95; | 33 fpsAverage = fps * 0.05 + fpsAverage * 0.95; |
| 34 | 34 |
| 35 query("#notes").text = "${fpsAverage.round().toInt()} fps"; | 35 query("#notes").text = "${fpsAverage.round()} fps"; |
| 36 } | 36 } |
| 37 | 37 |
| 38 // TODO: remove this once dart:html Point works cross-platform | 38 // TODO: remove this once dart:html Point works cross-platform |
| 39 class Point { | 39 class Point { |
| 40 num x, y; | 40 num x, y; |
| 41 | 41 |
| 42 Point(this.x, this.y); | 42 Point(this.x, this.y); |
| 43 } | 43 } |
| 44 | 44 |
| 45 /** | 45 /** |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 } else { | 267 } else { |
| 268 num angle = solarSystem.renderTime * orbitSpeed; | 268 num angle = solarSystem.renderTime * orbitSpeed; |
| 269 | 269 |
| 270 return new Point( | 270 return new Point( |
| 271 orbitRadius * cos(angle) + x, | 271 orbitRadius * cos(angle) + x, |
| 272 orbitRadius * sin(angle) + y); | 272 orbitRadius * sin(angle) + y); |
| 273 } | 273 } |
| 274 } | 274 } |
| 275 | 275 |
| 276 } | 276 } |
| OLD | NEW |