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 #library('sunflower'); | 5 #library('sunflower'); |
6 | 6 |
7 #import('dart:html'); | 7 #import('dart:html'); |
| 8 #import('dart:math', prefix: 'Math'); |
8 | 9 |
9 final SEED_RADIUS = 2; | 10 final SEED_RADIUS = 2; |
10 final SCALE_FACTOR = 4; | 11 final SCALE_FACTOR = 4; |
11 final TAU = Math.PI * 2; | 12 final TAU = Math.PI * 2; |
12 | 13 |
13 final MAX_D = 300; | 14 final MAX_D = 300; |
14 final ORANGE = "orange"; | 15 final ORANGE = "orange"; |
15 | 16 |
16 num centerX, centerY; | 17 num centerX, centerY; |
17 int seeds = 0; | 18 int seeds = 0; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 context.strokeStyle = ORANGE; | 65 context.strokeStyle = ORANGE; |
65 context.arc(x, y, SEED_RADIUS, 0, TAU, false); | 66 context.arc(x, y, SEED_RADIUS, 0, TAU, false); |
66 context.fill(); | 67 context.fill(); |
67 context.closePath(); | 68 context.closePath(); |
68 context.stroke(); | 69 context.stroke(); |
69 } | 70 } |
70 | 71 |
71 void displaySeedCount(num seedCount) { | 72 void displaySeedCount(num seedCount) { |
72 query("#notes").text = "${seedCount} seeds"; | 73 query("#notes").text = "${seedCount} seeds"; |
73 } | 74 } |
OLD | NEW |