OLD | NEW |
1 <script> | 1 <script> |
2 import "dart:sky"; | 2 import "dart:sky"; |
3 | 3 |
4 void main() { | 4 void main() { |
5 var root = document.createElement('div'); | 5 var root = document.createElement('div'); |
6 root.style['display'] = 'paragraph'; | 6 root.style['display'] = 'paragraph'; |
7 root.appendChild(new Text('Hello World')); | 7 root.appendChild(new Text('Hello World')); |
8 document.appendChild(root); | 8 document.appendChild(root); |
9 root.offsetWidth; // force layout. | 9 root.offsetWidth; // force layout. |
10 | 10 |
11 double width = window.innerWidth.toDouble(); | 11 double width = window.innerWidth.toDouble(); |
12 double height = window.innerHeight.toDouble(); | 12 double height = window.innerHeight.toDouble(); |
13 PictureRecorder recorder = new PictureRecorder(width, height); | 13 PictureRecorder recorder = new PictureRecorder(width, height); |
14 Paint paint = new Paint()..color = Color.fromARGB(255, 0, 255, 0); | 14 Paint paint = new Paint()..color = const Color.fromARGB(255, 0, 255, 0); |
15 recorder.drawCircle(50.0, 50.0, 50.0, paint); | 15 recorder.drawCircle(50.0, 50.0, 50.0, paint); |
16 recorder.translate(10.0, 10.0); | 16 recorder.translate(10.0, 10.0); |
17 root.paint(recorder); | 17 root.paint(recorder); |
18 recorder.translate(10.0, 10.0); | 18 recorder.translate(10.0, 10.0); |
19 root.paint(recorder); | 19 root.paint(recorder); |
20 recorder.translate(10.0, 10.0); | 20 recorder.translate(10.0, 10.0); |
21 root.paint(recorder); | 21 root.paint(recorder); |
22 document.rootPicture = recorder.endRecording(); | 22 document.rootPicture = recorder.endRecording(); |
23 } | 23 } |
24 </script> | 24 </script> |
OLD | NEW |