OLD | NEW |
| (Empty) |
1 <!DOCTYPE html> | |
2 <html> | |
3 <head> | |
4 <script src="../resources/run-after-layout-and-paint.js"></script> | |
5 <script src="resources/test-runner-paint-worklet.js"></script> | |
6 <style> | |
7 #output { | |
8 width: 300px; | |
9 height: 400px; | |
10 background-image: paint(paths); | |
11 } | |
12 </style> | |
13 </head> | |
14 <body> | |
15 <div id="output"></div> | |
16 | |
17 <script id="code" type="text/worklet"> | |
18 registerPaint('paths', class { | |
19 paint(ctx, geom) { | |
20 ctx.beginPath(); | |
21 ctx.lineWidth = '10'; | |
22 ctx.strokeStyle = 'green'; | |
23 ctx.moveTo(15, 15); | |
24 ctx.lineTo(135, 15); | |
25 ctx.lineTo(70, 170); | |
26 ctx.closePath(); | |
27 ctx.stroke(); | |
28 | |
29 var path1 = new Path2D(); | |
30 path1.moveTo(250, 25); | |
31 path1.bezierCurveTo(110, 150, 110, 300, 200, 200); | |
32 ctx.strokeStyle = 'purple'; | |
33 ctx.setLineDash([ 10, 5 ]); | |
34 ctx.stroke(path1); | |
35 | |
36 ctx.fillStyle = 'red'; | |
37 ctx.beginPath() | |
38 ctx.arc(75, 325, 50, 0, Math.PI * 2, true); | |
39 ctx.arc(75, 325, 20, 0, Math.PI * 2, true); | |
40 ctx.fill('evenodd'); | |
41 } | |
42 }); | |
43 </script> | |
44 | |
45 <script> | |
46 importPaintWorkletAndTerminateTestAfterAsyncPaint(document.getElementById('c
ode').textContent); | |
47 </script> | |
48 </body> | |
49 </html> | |
OLD | NEW |