-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.opa
40 lines (32 loc) · 779 Bytes
/
test.opa
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import stdlib.web.canvas
function do_it(){
mycan = Canvas.get(#myCanvas);
match(mycan){
case {none}:{};
case {some:mycan}:
{
//mycan=Canvas.get(#test);
Canvas.canvas meincan=mycan;
mytext=Canvas.get_context_2d(mycan);
match(mytext){
case{none}:{}
case{some:mytext}:
{
Canvas.begin_path(_);
Canvas.move_to(mytext,10,10);
Canvas.line_to(mytext,200,200);
Canvas.stroke(mytext);
}
}
};
}
}
function page(){
<div id=test onready={function(_){do_it()}}> test</div>
<canvas id="myCanvas" width="578" height="200" style="background-color:gray;"></canvas>
}
Server.start(Server.http,
[ {resources: @static_resource_directory("resources")}
, {title: "Canvas Test", ~page}
]
)