Skip to content

Instantly share code, notes, and snippets.

@rahmatov
Created February 7, 2022 09:40
Show Gist options
  • Save rahmatov/8b9a2508acc3d00e66a87b0db7a66072 to your computer and use it in GitHub Desktop.
Save rahmatov/8b9a2508acc3d00e66a87b0db7a66072 to your computer and use it in GitHub Desktop.

Revisions

  1. rahmatov created this gist Feb 7, 2022.
    7 changes: 7 additions & 0 deletions 500-error-page-challenge.markdown
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,7 @@
    500 Error Page Challenge
    ------------------------
    Eyes following the cursor. Designed in a 500 error page. :)

    A [Pen](https://codepen.io/Kxrl/pen/BOPNXN) by [rps](https://codepen.io/Kxrl) on [CodePen](https://codepen.io).

    [License](https://codepen.io/license/pen/BOPNXN).
    10 changes: 10 additions & 0 deletions index.html
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    <div class="full-screen">
    <div class='container'>
    <span class="error-num">5</span>
    <div class='eye'></div>
    <div class='eye'></div>

    <p class="sub-text">Oh eyeballs! Something went wrong. We're <span class="italic">looking</span> to see what happened.</p>
    <a href="">Go back</a>
    </div>
    </div>
    13 changes: 13 additions & 0 deletions script.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@
    $(".full-screen").mousemove(function(event) {
    var eye = $(".eye");
    var x = (eye.offset().left) + (eye.width() / 2);
    var y = (eye.offset().top) + (eye.height() / 2);
    var rad = Math.atan2(event.pageX - x, event.pageY - y);
    var rot = (rad * (180 / Math.PI) * -1) + 180;
    eye.css({
    '-webkit-transform': 'rotate(' + rot + 'deg)',
    '-moz-transform': 'rotate(' + rot + 'deg)',
    '-ms-transform': 'rotate(' + rot + 'deg)',
    'transform': 'rotate(' + rot + 'deg)'
    });
    });
    1 change: 1 addition & 0 deletions scripts
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
    55 changes: 55 additions & 0 deletions style.scss
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,55 @@
    .full-screen {
    background-color: rgb(51, 51, 51);
    width: 100vw;
    height: 100vh;
    color: white;
    font-family: 'Arial Black';
    text-align: center;
    }

    .container {
    padding-top: 4em;
    width: 50%;
    display: block;
    margin: 0 auto;
    }

    .error-num {
    font-size: 8em;
    }

    .eye {
    background: #fff;
    border-radius: 50%;
    display: inline-block;
    height: 100px;
    position: relative;
    width: 100px;
    &::after {
    background: #000;
    border-radius: 50%;
    bottom: 56.1px;
    content: ' ';
    height: 33px;
    position: absolute;
    right: 33px;
    width: 33px;
    }
    }

    .italic {
    font-style: italic;
    }

    p {
    margin-bottom: 4em;
    }

    a {
    color: white;
    text-decoration: none;
    text-transform: uppercase;
    &:hover {
    color: lightgray;
    }
    }