tanguymario / jscanvas

A Nim wrapper for the Canvas API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

JsCanvas — A Nim wrapper for the Canvas API

Example

import jscanvas, colors, dom, math

var canvas = document.getElementById("canvas").CanvasElement
canvas.width = 480
canvas.height = 320

var ctx = canvas.getContext2d()

# Draw a ball
var x = canvas.width div 2
var y = canvas.height - 30
var ballRadius = 10

ctx.beginPath()
ctx.arc(x, y, ballRadius, 0, Pi*2)
ctx.fillStyle = $colBlack # could also be: $rgb(0, 0, 0) or just "rgb(0,0,0)"
ctx.fill()
ctx.closePath()

About

A Nim wrapper for the Canvas API

License:Other


Languages

Language:Nim 100.0%