2013-06-13 21:46:14 +02:00
|
|
|
# updates the canvas
|
|
|
|
update_canvas = (width, height) ->
|
|
|
|
canvas.width = width
|
|
|
|
canvas.height = height
|
2013-06-13 21:15:18 +02:00
|
|
|
|
2013-06-13 21:46:14 +02:00
|
|
|
# a range mapper which maps 's' to 'to' based on 'from'
|
2013-06-13 21:15:18 +02:00
|
|
|
map_range = (from, to, s) ->
|
|
|
|
to[0] + (s-from[0]) * (to[1] - to[0]) / (from[1] - from[0])
|