[NetBehaviour] Objet d'art 2

Pall Thayer pallthay at gmail.com
Tue Jul 21 17:31:18 CEST 2015


var lobjetdart2 = function () {
    var theCanvas;
    var howLong = window.innerWidth;
    var howHi = window.innerHeight;

    var init = function () {
        theCanvas = document.createElement("canvas");
        theCanvas.id = "thecanvas";
        theCanvas.width = howLong;
        theCanvas.height = howHi;
        document.body.appendChild(theCanvas);
        stripe(howLong/40);
    };

    var stripe = function (spacing) {
        var ctx = document.getElementById("thecanvas").getContext("2d");
        for(var i = 0;i < howLong;i += spacing) {
            ctx.fillStyle = "rgb("+makePretty()+", "+makePretty()+",
"+makePretty()+")";
            ctx.fillRect(i, 0, spacing, howLong);
        }

    };

    var makePretty = function() {
        return parseInt(Math.random()*255);
    }

    init();
};
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.netbehaviour.org/pipermail/netbehaviour/attachments/20150721/ac39b4fe/attachment.htm>


More information about the NetBehaviour mailing list