Commit bb5ba6a7 authored by Dave Griffiths's avatar Dave Griffiths

added card viz

parent ef8d4895
......@@ -127,19 +127,56 @@
(define canvas (document.getElementById "canvas"))
(define ctx (canvas.getContext "2d"))
(set! pos (+ pos 14))
(index-for-each
(lambda (i card)
(let ((x (+ (* i 14) 0)))
;(ctx.strokeRect x pos 12 12)
(ctx.beginPath)
(ctx.arc (+ x 2) (+ pos 2) 2 (* Math.PI 2) #f)
(set! ctx.fillStyle (if (eq? (card-a card) "#") "#000" "#fff"))
(ctx.fill)
(ctx.closePath)
(ctx.beginPath)
(ctx.arc (+ x 8) (+ pos 2) 2 (* Math.PI 2) #f)
(set! ctx.fillStyle (if (eq? (card-b card) "#") "#000" "#fff"))
(ctx.fill)
(ctx.closePath)
(ctx.beginPath)
(ctx.arc (+ x 8) (+ pos 8) 2 (* Math.PI 2) #f)
(set! ctx.fillStyle (if (eq? (card-c card) "#") "#000" "#fff"))
(ctx.fill)
(ctx.closePath)
(ctx.beginPath)
(ctx.arc (+ x 2) (+ pos 8) 2 (* Math.PI 2) #f)
(set! ctx.fillStyle (if (eq? (card-d card) "#") "#000" "#fff"))
(ctx.fill)
(ctx.closePath)
))
(card-loom-cards loom))
(index-for-each
(lambda (i card)
(let ((direction (card-to-direction card))
(colour (if (eq? (car (card-weave card)) "#") "black" "white")))
(ctx.drawImage (find-image (string-append "tabwarp-" direction "-" colour ".png"))
(* i 7) pos)))
(+ (* i 7) 120) pos)))
(card-loom-cards loom))
(index-for-each
(lambda (i card)
(let ((direction (card-to-direction card))
(colour (if (eq? (cadr (card-weave card)) "#") "black" "white")))
(ctx.drawImage (find-image (string-append "tabwarp-" direction "-" colour ".png"))
(+ (* i 7) 80) pos)))
(+ (* i 7) 200) pos)))
(card-loom-cards loom))
loom)
......
......@@ -4,13 +4,13 @@
<title>tablet weave livecoding</title>
<link href="css/style.css" rel="stylesheet" type="text/css">
<body style="background:#aaa;">
<div style="width:50%; margin:0 auto; float:left;">
<div style="width:30%; float:left;">
<h1>tablet weave livecoding</h1>
<!--<canvas class="canvas" id="webgl-canvas" width="640" height="480"></canvas> -->
<form id="code" action="." method="POST">
<textarea id="id_code" rows="20" cols="50" name="code">
<textarea id="id_code" rows="20" cols="30" name="code">
(twist 0 1 2 3)
(weave-forward 8)
(rotate-forward 1 2 3 4 5 6)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment