Skip to content

Instantly share code, notes, and snippets.

Created November 3, 2015 22:31
Show Gist options
  • Select an option

  • Save anonymous/0c719611e6a97926af90 to your computer and use it in GitHub Desktop.

Select an option

Save anonymous/0c719611e6a97926af90 to your computer and use it in GitHub Desktop.

Revisions

  1. @invalid-email-address Anonymous created this gist Nov 3, 2015.
    9 changes: 9 additions & 0 deletions Party.markdown
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,9 @@
    Party
    -----
    Rainbows!

    Forked from [Anders K](http://codepen.io/and3k5/)'s Pen [Party](http://codepen.io/and3k5/pen/PPKjwg/).

    A [Pen](http://codepen.io/thehalvo/pen/wKxNwE) by [Jordan Halvorsen](http://codepen.io/thehalvo) on [CodePen](http://codepen.io/).

    [License](http://codepen.io/thehalvo/pen/wKxNwE/license).
    1 change: 1 addition & 0 deletions index.html
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    <canvas width="400" height="400"></canvas>
    33 changes: 33 additions & 0 deletions script.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,33 @@
    var canvas = document.querySelector("canvas");
    var ctx = canvas.getContext("2d");

    ctx.font = "900 80px sans-serif";
    ctx.lineWidth=2;
    var str = "FTW";
    var strwidth = ctx.measureText(str).width;

    var width=canvas.width;

    var c=0;
    var color=0;
    var img;

    (function a() {
    img=ctx.getImageData(0,0,width,width);
    ctx.putImageData(img,0,10);
    ctx.save();
    ctx.translate((width/2),width/2);
    ctx.rotate(Math.PI*(c++/200));

    ctx.fillStyle='hsla('+(color=color+4%360)+', 100%, 50%, 1)';
    ctx.fillText("FTW",-(strwidth/2),20);
    ctx.strokeText("FTW",-(strwidth/2),20);

    ctx.restore();

    requestAnimationFrame(a);
    })();




    17 changes: 17 additions & 0 deletions style.css
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,17 @@
    html,body,canvas {
    padding:0px;
    margin:0px;
    overflow:hidden;
    height:100%;
    }

    body {
    background: #ffffff);
    }

    canvas {
    display:block;
    margin:auto;
    width:100vmin;
    height:100vmin;
    }