|
|
|
|
|
by Retr0spectrum
4066 days ago
|
|
Just playing around: import js
c = js.globals.document.createElement("canvas")
js.globals.document.body.appendChild(c)
ctx = c.getContext("2d")
ctx.fillRect(10, 10, 10, 10)
Edit: Here is a simple animation: import js
import math
import time
c = js.globals.document.createElement("canvas")
js.globals.document.body.appendChild(c)
ctx = c.getContext("2d")
def render():
ctx.clearRect(0, 0, c.width, c.height)
t = time.time()
ctx.fillRect(20+math.sin(t*10)*10, 20+math.cos(t*10)*10, 10, 10)
js.globals.window.setInterval(render, 20)
Here's a version you can paste in properly: http://pastebin.com/raw.php?i=67GadSUV |
|
(ChromeOS v43 beta-channel)