1
0
mirror of https://shylinux.com/x/ContextOS synced 2025-04-25 08:48:06 +08:00
This commit is contained in:
harveyshao 2022-12-24 23:44:22 +08:00
parent a348e92770
commit f7a9439acb

22
src/hi/he.js Normal file
View File

@ -0,0 +1,22 @@
Volcanos(chat.ONIMPORT, {_init: function(can, msg) {
function degToRad(n) { return n * 2 * Math.PI / 360 }
function drawFill(ctx, cb) { ctx.beginPath(), cb(), ctx.fill() }
var ctx = can.page.Append(can, can._output, [{type: html.CANVAS, height: can.ConfHeight(), width: can.ConfWidth()}])._target.getContext("2d")
drawFill(ctx, function() {
ctx.strokeStyle = "red"
ctx.fillStyle = "green"
ctx.lineWidth = 2
ctx.fillRect(0, 0, 200, 200)
ctx.moveTo(200, 200), ctx.arc(200, 200, 100, degToRad(-45), degToRad(90), false), ctx.lineTo(200, 200)
can.misc.Debug("what", 123)
ctx.strokeStyle = "white"
ctx.lineWidth = 2
ctx.font = "36px arial"
ctx.strokeText("Canvas text", 50, 50)
ctx.fillStyle = "red"
ctx.font = "48px georgia"
ctx.fillText("Canvas text", 50, 150)
})
}})