Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
15
Task/Draw-a-pixel/ReScript/draw-a-pixel-1.re
Normal file
15
Task/Draw-a-pixel/ReScript/draw-a-pixel-1.re
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
type document // abstract type for a document object
|
||||
type context = { mutable fillStyle: string, }
|
||||
|
||||
@val external doc: document = "document"
|
||||
|
||||
@send external getElementById: (document, string) => Dom.element = "getElementById"
|
||||
@send external getContext: (Dom.element, string) => context = "getContext"
|
||||
|
||||
@send external fillRect: (context, int, int, int, int) => unit = "fillRect"
|
||||
|
||||
let canvas = getElementById(doc, "my_canvas")
|
||||
let ctx = getContext(canvas, "2d")
|
||||
|
||||
ctx.fillStyle = "#F00"
|
||||
fillRect(ctx, 100, 100, 1, 1)
|
||||
30
Task/Draw-a-pixel/ReScript/draw-a-pixel-2.re
Normal file
30
Task/Draw-a-pixel/ReScript/draw-a-pixel-2.re
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Draw a Pixel</title>
|
||||
<style rel="stylesheet" type="text/css">
|
||||
body {
|
||||
background-color:#777;
|
||||
}
|
||||
canvas {
|
||||
background-color:#888;
|
||||
margin:60px 120px;
|
||||
border:1px solid #555;
|
||||
box-shadow: -1px 2px 6px 1px rgba(0,0,0,0.3);
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<canvas id="my_canvas" width="320" height="240">
|
||||
No support for HTML5 Canvas.<br />
|
||||
</canvas>
|
||||
|
||||
<script type="text/javascript" src="draw.bs.js"></script>
|
||||
|
||||
<noscript>
|
||||
No support for Javascript.<br />
|
||||
</noscript>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Loading…
Add table
Add a link
Reference in a new issue