diff options
Diffstat (limited to 'base.js')
| -rw-r--r-- | base.js | 28 |
1 files changed, 17 insertions, 11 deletions
@@ -8,12 +8,14 @@ gen = function(s, c) { } console.log(v); + var W = 50; + var H = 50; - var r = Raphael(c, 250, 250); + var r = Raphael('c1', W, H); var hv = v[4] / 256; var sv = v[5] / 256; var bv = v[6] / 256; - r.path(['M', v[0], 0, 'L', 0, v[1], 'L', v[2], 250, 'L', 250, v[3], 'Z']).attr({ + r.path(['M', v[0] * W / 256, 0, 'L', 0, v[1] * H / 256, 'L', v[2] * W / 256, W, 'L', H, v[3] * H / 256, 'Z']).attr({ fill: Raphael.hsl(hv, sv, bv), stroke: Raphael.hsl(hv, sv, bv) }); @@ -21,7 +23,7 @@ gen = function(s, c) { hv = v[11] / 256; sv = v[12] / 256; bv = v[13] / 256; - r.path(['M', v[7], 0, 'L', 0, v[8], 'L', v[9], 250, 'L', 250, v[10], 'Z']).attr({ + r.path(['M', v[7] * W / 256, 0, 'L', 0, v[8] * H / 256, 'L', v[9] * W / 256, W, 'L', H, v[10] * H / 256, 'Z']).attr({ fill: Raphael.hsl(hv, sv, bv), stroke: Raphael.hsl(hv, sv, bv), 'fill-opacity': (v[14] / 512) + 0.3, @@ -29,13 +31,17 @@ gen = function(s, c) { }); }; +randStr = function(n){ + var text = ''; + var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; + for (var i=0; i<n; i++) + text += chars.charAt(Math.floor(Math.random() * chars.length)); + return text; +}; + + $(document).ready(function() { - gen('yuvals', 'c1'); - gen('yuvalsx', 'c2'); - gen('yuvalsd', 'c3'); - gen('yuvalse', 'c4'); - gen('yuv', 'c5'); - gen('yals', 'c6'); - gen('yuvl11', 'c7'); - gen('yuvals1242346', 'c8'); + for (var i=0; i<100; i++) { + gen(randStr(8)); + } }); |
