Skip to content

Instantly share code, notes, and snippets.

@lizheming
Last active January 3, 2016 02:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lizheming/8395291 to your computer and use it in GitHub Desktop.
Save lizheming/8395291 to your computer and use it in GitHub Desktop.
d=document;
var m = {
e: d.querySelectorAll('input'),
r: parseInt( d.body.clientWidth / 20 ),
c: parseInt( d.getElementById('container').clientHeight / 19),
o: function() {return {x: 0,y: Math.floor(m.c / 2)};},
g: function(x, y) {return m.e[(m.o().y - y) * m.r + x];}
};
var e = function(x, y) {
if( y>=0 )
return Math.pow(x - 28,2) + Math.pow(y,2) <= 50 || Math.pow(x - 14,2) + Math.pow(y,2) <= 50 ? true : false;
else
return y >= -x+6 && y >= x-36? true : false;
};
for(x=m.o().x;x<m.r;x++) {
for(y=m.o().y;y>-m.o().y;y--) {
m.g(x,y).checked = e(x,y);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment