diff options
| author | Yuval Adam <yuv.adm@gmail.com> | 2012-07-23 16:05:33 +0300 |
|---|---|---|
| committer | Yuval Adam <yuv.adm@gmail.com> | 2012-07-23 16:05:33 +0300 |
| commit | 03ca33740539966af5bef5a36f5021749a8880fb (patch) | |
| tree | 3e27cd6cf6696a373c47f205ebcc331aaa600680 | |
| parent | 5e888dfd552a4b487fd6b3904371a7606c7981e0 (diff) | |
100 random ones
| -rw-r--r-- | base.css | 5 | ||||
| -rw-r--r-- | base.js | 28 |
2 files changed, 17 insertions, 16 deletions
@@ -2,11 +2,6 @@ body { margin: 30px 25px 40px 25px; } -.canvas { - height: 250px; - width: 250px; -} - .mat { margin: 20px; } @@ -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)); + } }); |
