Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import or require. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              <!-- Nothing here required for app -->

<span>
<p><b><i>Following Eyes</i></b></p>
</span>

            
          
!
            
              /* Nothing here required for app */

html{
    height:100%;
}
body{
    background-color:#bfc51e;
    margin:0px;
    text-align: center;
}
sup{
    font-size: 55%;
}
span{
    display:inline-block;
    position:relative;
    margin:10px;
    padding:4px;
    width:300px;
    line-height: 18px;
    user-select: none;
    -moz-user-select: none;
    -webkit-user-select: none;
    -ms-user-select: none;
    cursor: default;
    background-color:#ee0000;
    border-radius:5px;
    font: 26px verdana;
    color: #fff; 
    text-align: center;
}
p {
margin: 5px;
}

            
          
!
            
              (function () {

    /* Following Eyes - kurt.grigg@yahoo.co.uk 2003 (Updated) */

    var eye = 50; //Eye size in pixels

    if (eye % 2 == 0){
        eye++;
    }
    var eye5 = eye / 2 | 0;
    var pup = 42 * eye / 100; 
    if (pup % 2 == 0){
        pup++;
    }
    var pup5 = (pup - 3) / 2;
    if (pup5 % 2 == 1){
        pup5++;
    }
    var grng = (eye - pup) / 2; 
    if (grng % 2 == 1){
        grng++;
    }
    var rng = eye5 / grng; 
    var d = document;
    var my = 0;
    var mx = 0;
    var fy = 0;
    var fx = 0;
    var ros = eye + 2;
    var rim = 0.25 * eye / 100;
    var scy = 0;
    var scx = 0;
    var pix = 'px';
    var mls = 1000 / 60;
    var lastEx = performance.now();
    var h, w;

    var cstyle =
        'position:absolute;top:0px;left:0px;width:'+(ros*2)+'px;height:'+ros+'px;'
        +'line-height:0px;margin:0px;border:none;padding:0px;display:inline-block;';

    var estyle =
        'position:absolute;top:0px;left:0px;height:'+eye+'px;'
        +'width:'+eye+'px;line-height:0px;background-color:#fff;'
        +'border-radius: 50%;border:'+rim+'px solid #888;'
        +'box-shadow: inset -'+eye/3+'px -'+eye/3+'px '+eye/2+
        'px -'+(eye/10|0)+'px rgba(0,0,0,0.16);';

    var pstyle =
        'position:absolute;top:45%;left:45%;height:'+pup+'px;'
        +'width:'+pup+'px;line-height:0px;border-radius: 50%;background-color:#222;';

    var shine = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 145 145"><g><ellipse cx="0" cy="-50" fill="#fff" transform="rotate(135)" ry="9.464" rx="21.25"/></g></svg>';

    var c = d.createElement('div');
    var e1 = d.createElement('div');
    var e2 = d.createElement('div');
    var p1 = d.createElement('div');
    var p2 = d.createElement('div');

    c.setAttribute('style', cstyle);
    e1.setAttribute('style', estyle);
    e2.setAttribute('style', estyle + 'left:'+(ros + (rim/2))+'px;');
    p1.setAttribute('style', pstyle);
    p2.setAttribute('style', pstyle);
    p1.innerHTML = shine;
    p2.innerHTML = shine;

    d.body.appendChild(c);
    c.appendChild(e1);
    c.appendChild(e2);
    d.body.appendChild(p1);
    d.body.appendChild(p2);

    function scrl(v) {
        var y, x;
        y = window.pageYOffset;
        x = window.pageXOffset;
        return (v == 0) ? y : x;
    }

    function initscroll() {
        scy = scrl(0);
        scx = scrl(1);
    }

    function windims() {
        var ddw = d.documentElement.clientWidth;
        var ddh = d.documentElement.clientHeight;
        var scrollBarRight = (typeof ddw == 'number') ? window.innerWidth - ddw : 0;
        var scrollBarBottom = (typeof ddh == 'number') ? window.innerHeight - ddh : 0;
        h = window.innerHeight - scrollBarBottom -1;
        w = window.innerWidth - scrollBarRight -1;
    }

    function mouse(e) {
        if (!e) {
            e = window.event;
        }
        my = e.pageY - window.pageYOffset;
        mx = e.pageX - window.pageXOffset;
    }

    function ani() {
        //Keep eyes on screen.
        var chy = Math.floor(fy - (ros*1.2));
        if (chy <= 0) {
            chy = 0;
        }
        if (chy >= h - ros) {
            chy = h - ros;
        }

        var chx = Math.floor(fx - ros);
        if (chx <= 0) {
            chx = 0;
        }
        if (chx >= w - (ros*2)) {
            chx = w - (ros*2);
        }

        //Eyeball centres.
        var yec = chy + eye5;
        var xec = chx + eye5;

        var d1 = Math.sqrt((my - yec) * (my - yec) + (mx - xec) * (mx - xec));
        var d2 = Math.sqrt((my - yec) * (my - yec) + (mx - (xec + ros)) * (mx - (xec + ros)));

        var a1 = Math.atan2(my - yec, mx - xec) * 180 / Math.PI;
        var a2 = Math.atan2(my - yec, mx - (xec + ros)) * 180 / Math.PI;

        var le = (d1 < eye5) ? d1 / rng : grng;
        var re = (d2 < eye5) ? d2 / rng : grng;

        c.style.top = chy + scy + pix;
        c.style.left = chx + scx + pix;

        p1.style.top = yec - pup5 + le * Math.sin(a1 * Math.PI / 180) + scy + pix;
        p1.style.left = xec - pup5 + le * Math.cos(a1 * Math.PI / 180) + scx + pix;

        p2.style.top = yec - pup5 + re * Math.sin(a2 * Math.PI / 180) + scy + pix;
        p2.style.left = (xec + ros) - pup5 + re * Math.cos(a2 * Math.PI / 180) + scx + pix;
    }

    function move() {
        var dy = fy += (my - fy) * 0.05;
        var dx = fx += (mx - fx) * 0.05;
        ani();
    }

    function init() {
        windims();
        draw();
    }

    function draw() {
        var now = performance.now();
        if ((now - lastEx) > (mls)) {
            move();
            lastEx = performance.now();
        }
        requestAnimationFrame(draw);
    }

    window.addEventListener("resize", windims, false);
    window.addEventListener("load", init, false);
    d.addEventListener("mousemove", mouse, false);
    window.addEventListener("scroll", initscroll, false);

})();

            
          
!
999px

Console