| 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:math'; | 7 import 'dart:math'; |
| 8 import 'dom.dart'; | 8 import 'dom.dart'; |
| 9 | 9 |
| 10 const ORANGE = "orange"; | 10 const ORANGE = "orange"; |
| 11 const SEED_RADIUS = 2; | 11 const SEED_RADIUS = 2; |
| 12 const SCALE_FACTOR = 4; | 12 const SCALE_FACTOR = 4; |
| 13 const TAU = PI * 2; | 13 const TAU = PI * 2; |
| 14 const MAX_D = 300; | 14 const MAX_D = 300; |
| 15 // TODO(sigmund): remove `num` here, this is to workaround dartbug.com/22937 | 15 const centerX = MAX_D / 2; |
| 16 const num centerX = MAX_D / 2; | 16 const centerY = centerX; |
| 17 const num centerY = centerX; | |
| 18 | 17 |
| 19 Element querySelector(String selector) => document.querySelector(selector); | 18 Element querySelector(String selector) => document.querySelector(selector); |
| 20 | 19 |
| 21 final InputElement slider = querySelector("#slider"); | 20 final InputElement slider = querySelector("#slider"); |
| 22 final notes = querySelector("#notes"); | 21 final notes = querySelector("#notes"); |
| 23 final PHI = (sqrt(5) + 1) / 2; | 22 final PHI = (sqrt(5) + 1) / 2; |
| 24 int seeds = 0; | 23 int seeds = 0; |
| 25 final CanvasRenderingContext2D context = | 24 final CanvasRenderingContext2D context = |
| 26 (querySelector("#canvas") as CanvasElement).getContext('2d'); | 25 (querySelector("#canvas") as CanvasElement).getContext('2d'); |
| 27 | 26 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 ..closePath() | 67 ..closePath() |
| 69 ..stroke(); | 68 ..stroke(); |
| 70 } | 69 } |
| 71 } | 70 } |
| 72 | 71 |
| 73 class Circle { | 72 class Circle { |
| 74 final num x, y, radius; | 73 final num x, y, radius; |
| 75 | 74 |
| 76 Circle(this.x, this.y, this.radius); | 75 Circle(this.x, this.y, this.radius); |
| 77 } | 76 } |
| OLD | NEW |