| OLD | NEW |
| 1 dart_library.library('sunflower', null, /* Imports */[ | 1 dart_library.library('sunflower', null, /* Imports */[ |
| 2 'dart_sdk' | 2 'dart_sdk' |
| 3 ], function(exports, dart_sdk) { | 3 ], function(exports, dart_sdk) { |
| 4 'use strict'; | 4 'use strict'; |
| 5 const core = dart_sdk.core; | 5 const core = dart_sdk.core; |
| 6 const html = dart_sdk.html; | 6 const html = dart_sdk.html; |
| 7 const math = dart_sdk.math; | 7 const math = dart_sdk.math; |
| 8 const dart = dart_sdk.dart; | 8 const dart = dart_sdk.dart; |
| 9 const dartx = dart_sdk.dartx; | 9 const dartx = dart_sdk.dartx; |
| 10 const sunflower = Object.create(null); | 10 const sunflower = Object.create(null); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 sunflower.draw = function() { | 53 sunflower.draw = function() { |
| 54 sunflower.seeds = core.int.parse(sunflower.slider[dartx.value]); | 54 sunflower.seeds = core.int.parse(sunflower.slider[dartx.value]); |
| 55 sunflower.context[dartx.clearRect](0, 0, sunflower.MAX_D, sunflower.MAX_D); | 55 sunflower.context[dartx.clearRect](0, 0, sunflower.MAX_D, sunflower.MAX_D); |
| 56 for (let i = 0; i < dart.notNull(sunflower.seeds); i++) { | 56 for (let i = 0; i < dart.notNull(sunflower.seeds); i++) { |
| 57 let theta = i * painter.TAU / dart.notNull(sunflower.PHI); | 57 let theta = i * painter.TAU / dart.notNull(sunflower.PHI); |
| 58 let r = dart.notNull(math.sqrt(i)) * sunflower.SCALE_FACTOR; | 58 let r = dart.notNull(math.sqrt(i)) * sunflower.SCALE_FACTOR; |
| 59 let x = sunflower.centerX + r * dart.notNull(math.cos(theta)); | 59 let x = sunflower.centerX + r * dart.notNull(math.cos(theta)); |
| 60 let y = sunflower.centerY - r * dart.notNull(math.sin(theta)); | 60 let y = sunflower.centerY - r * dart.notNull(math.sin(theta)); |
| 61 new sunflower.SunflowerSeed(x, y, sunflower.SEED_RADIUS).draw(sunflower.co
ntext); | 61 new sunflower.SunflowerSeed(x, y, sunflower.SEED_RADIUS).draw(sunflower.co
ntext); |
| 62 } | 62 } |
| 63 sunflower.notes[dartx.text] = `${sunflower.seeds} seeds`; | 63 sunflower.notes[dartx.text] = dart.str`${sunflower.seeds} seeds`; |
| 64 }; | 64 }; |
| 65 dart.fn(sunflower.draw, dart.void, []); | 65 dart.fn(sunflower.draw, dart.void, []); |
| 66 circle.Circle = class Circle extends core.Object { | 66 circle.Circle = class Circle extends core.Object { |
| 67 new(x, y, radius) { | 67 new(x, y, radius) { |
| 68 this.x = x; | 68 this.x = x; |
| 69 this.y = y; | 69 this.y = y; |
| 70 this.radius = radius; | 70 this.radius = radius; |
| 71 } | 71 } |
| 72 }; | 72 }; |
| 73 dart.setSignature(circle.Circle, { | 73 dart.setSignature(circle.Circle, { |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 return dart.as(painter.canvas[dartx.getContext]('2d'), html.CanvasRenderin
gContext2D); | 120 return dart.as(painter.canvas[dartx.getContext]('2d'), html.CanvasRenderin
gContext2D); |
| 121 } | 121 } |
| 122 }); | 122 }); |
| 123 // Exports: | 123 // Exports: |
| 124 exports.sunflower = sunflower; | 124 exports.sunflower = sunflower; |
| 125 exports.circle = circle; | 125 exports.circle = circle; |
| 126 exports.painter = painter; | 126 exports.painter = painter; |
| 127 }); | 127 }); |
| 128 | 128 |
| 129 //# sourceMappingURL=sunflower.js.map | 129 //# sourceMappingURL=sunflower.js.map |
| OLD | NEW |