So I have been watching Torchwood. The bad guys have this cool spinning triangle (very sinister).
I wanted to harness the power of this but in JavaScript and HTML5 as I haven’t had enough chance to play around with this.
I did my usual swift search – which of the coding giants can help – why Bit101 has been monkeying around too. I shall stand on his shoulders to create my masterpiece!
First off I needed read his tutorials. I got to day 3 before needing to just get on with stuff (I only get to build stuff during Lori’s nap times so I have an excuse for my impatience).
Next I added my new triangle primative to the wirelib.js.
function addTriangle(x, y, z, w, h) {
this.addLine(x - w/2, y, z,
x + w/2, y, z,
x, y - h, z,
x- w/2, y, z);
}
Then I create my aTriangle.js file (whilst humming James Blunt’s Triangle)
var x = 30;
var y = 40;
wirelib.strokeStyle = '#ffffff';
wirelib.lineWidth = lineW;
wirelib.addTriangle(x, y, 0, 500, 500);
Nice ! but narrow
so i add width
and that screws with it – I have still to sort this out but have a look and feel its power