git @ Cat's Eye Technologies The-Dipple / cc26d84
Merge. Chris Pressey 9 years ago
1 changed file(s) with 12 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
6363 svg.style.border = "1px solid blue";
6464
6565 input.onchange = function() {
66 var x = Math.floor(Math.random() * ((width / 2) - 20)) + 10;
67 var y = Math.floor(Math.random() * (height - 20)) + 10;
68 var size = 10 + Math.floor(Math.random() * 10);
6669 var e = yoob.makeSVGElem(svg, "text", {
67 x: Math.floor(Math.random() * ((width / 2) - 20)) + 10,
68 y: Math.floor(Math.random() * (height - 20)) + 10,
70 x: x,
71 y: y,
6972 fill: "black",
70 "font-size": 10 + Math.floor(Math.random() * 10)
73 "font-size": size
7174 });
7275 e.innerHTML = input.value;
7376 input.value = "";
77
78 /* You can also do this by changing the SVG element's innerHTML, like so: */
79
80 /*
81 svg.innerHTML += '<text x="' + x + '" y="' + y + '" fill="black" font-size="' + size + '">' + text + '</text>';
82 */
7483 };
7584
7685 input.focus();