OLD | NEW |
1 <sky> | 1 <sky> |
2 <style> | 2 <style> |
3 div { | 3 div { |
4 height: 200px; | 4 height: 200px; |
5 background-color: lightblue; | 5 background-color: lightblue; |
6 } | 6 } |
7 </style> | 7 </style> |
8 <div id="canvas" /> | 8 <div id="canvas" /> |
9 <script> | 9 <script> |
10 import 'dart:math' as math; | 10 import 'dart:math' as math; |
11 import 'dart:sky'; | 11 import 'dart:sky'; |
12 | 12 |
13 void main() { | 13 void main() { |
14 var element = document.getElementById('canvas'); | 14 var element = document.getElementById('canvas'); |
15 element.requestPaint((PaintingContext context) { | 15 element.requestPaint((PaintingContext context) { |
16 Paint paint = new Paint(); | 16 Paint paint = new Paint(); |
17 paint.setARGB(128, 0, 255, 0); | 17 paint.setARGB(128, 0, 255, 0); |
18 double radius = math.min(context.width, context.height) / 2.0; | 18 double radius = math.min(context.width, context.height) / 2.0; |
19 context.drawCircle(context.width / 2.0, context.height / 2.0, radius, paint)
; | 19 context.drawCircle(context.width / 2.0, context.height / 2.0, radius, paint)
; |
20 context.commit(); | 20 context.commit(); |
21 }); | 21 }); |
22 } | 22 } |
23 </script> | 23 </script> |
24 </sky> | 24 </sky> |
OLD | NEW |