Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(24)

Side by Side Diff: dart/site/try/src/samples.dart

Issue 289073009: Rename variable from "ORANGE" to "SEED_COLOR". (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 trydart.samples; 5 library trydart.samples;
6 6
7 const String EXAMPLE_HELLO = r''' 7 const String EXAMPLE_HELLO = r'''
8 // Go ahead and modify this example. 8 // Go ahead and modify this example.
9 9
10 var greeting = "Hello, World!"; 10 var greeting = "Hello, World!";
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 const String EXAMPLE_SUNFLOWER = ''' 77 const String EXAMPLE_SUNFLOWER = '''
78 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 78 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
79 // for details. All rights reserved. Use of this source code is governed by a 79 // for details. All rights reserved. Use of this source code is governed by a
80 // BSD-style license that can be found in the LICENSE file. 80 // BSD-style license that can be found in the LICENSE file.
81 81
82 library sunflower; 82 library sunflower;
83 83
84 import "dart:html"; 84 import "dart:html";
85 import "dart:math"; 85 import "dart:math";
86 86
87 const String ORANGE = "orange"; 87 const String SEED_COLOR = "orange";
88 const int SEED_RADIUS = 2; 88 const int SEED_RADIUS = 2;
89 const int SCALE_FACTOR = 4; 89 const int SCALE_FACTOR = 4;
90 const num TAU = PI * 2; 90 const num TAU = PI * 2;
91 const int MAX_D = 300; 91 const int MAX_D = 300;
92 const num centerX = MAX_D / 2; 92 const num centerX = MAX_D / 2;
93 const num centerY = centerX; 93 const num centerY = centerX;
94 94
95 final InputElement slider = query("#slider"); 95 final InputElement slider = query("#slider");
96 final Element notes = query("#notes"); 96 final Element notes = query("#notes");
97 final num PHI = (sqrt(5) + 1) / 2; 97 final num PHI = (sqrt(5) + 1) / 2;
(...skipping 19 matching lines...) Expand all
117 final num r = sqrt(i) * SCALE_FACTOR; 117 final num r = sqrt(i) * SCALE_FACTOR;
118 drawSeed(centerX + r * cos(theta), centerY - r * sin(theta)); 118 drawSeed(centerX + r * cos(theta), centerY - r * sin(theta));
119 } 119 }
120 notes.text = "\${seeds} seeds"; 120 notes.text = "\${seeds} seeds";
121 } 121 }
122 122
123 /// Draw a small circle representing a seed centered at (x,y). 123 /// Draw a small circle representing a seed centered at (x,y).
124 void drawSeed(num x, num y) { 124 void drawSeed(num x, num y) {
125 context..beginPath() 125 context..beginPath()
126 ..lineWidth = 2 126 ..lineWidth = 2
127 ..fillStyle = ORANGE 127 ..fillStyle = SEED_COLOR
128 ..strokeStyle = ORANGE 128 ..strokeStyle = SEED_COLOR
129 ..arc(x, y, SEED_RADIUS, 0, TAU, false) 129 ..arc(x, y, SEED_RADIUS, 0, TAU, false)
130 ..fill() 130 ..fill()
131 ..closePath() 131 ..closePath()
132 ..stroke(); 132 ..stroke();
133 } 133 }
134 134
135 const String MATH_PNG = 135 const String MATH_PNG =
136 "https://dart.googlecode.com/svn/trunk/dart/samples/sunflower/web/math.png"; 136 "https://dart.googlecode.com/svn/trunk/dart/samples/sunflower/web/math.png";
137 const String BODY = """ 137 const String BODY = """
138 <h1>drfibonacci\'s Sunflower Spectacular</h1> 138 <h1>drfibonacci\'s Sunflower Spectacular</h1>
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 margin: auto; 196 margin: auto;
197 } 197 }
198 198
199 .center { 199 .center {
200 display: block; 200 display: block;
201 margin: 0px auto; 201 margin: 0px auto;
202 text-align: center; 202 text-align: center;
203 } 203 }
204 """; 204 """;
205 '''; 205 ''';
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698