previous

page 15

next
globals.js
var g_ctx;
var g_side=0;
var g_step;
my.js
function resize() {
var side=90*vmin();
if (side!=g_side) {
setup();
}
}
function setup() {
g_side=90*vmin();
var canvas=document.getElementById('c');
canvas.width=g_side; canvas.height=g_side;
g_ctx=canvas.getContext('2d');
g_step=g_side/800;
}
function vmin() {
var w=innerWidth; var h=innerHeight;
var v=w;
if (h<w) v=h;
return v/100;
}

Now we're ready to go "turtling" again!

previous
next