Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
- <meta charset="utf-8">
- <title>Document</title>
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
- <style type="text/css">
- .SunRotate
- {
- position: absolute;
- top: 0%;
- left: 0%;
- width: 100%;
- -webkit-animation:spin 40s linear infinite;
- -moz-animation:spin 40s linear infinite;
- animation:spin 40s linear infinite;
- z-index: 2;
- display: inline-block;
- }
- @-moz-keyframes spin { 100% { -moz-transform: rotate(360deg); } }
- @-webkit-keyframes spin { 100% { -webkit-transform: rotate(360deg); } }
- @keyframes spin { 100% { -webkit-transform: rotate(360deg); transform:rotate(360deg); } }
- .SunCircle
- {
- position: absolute;
- top: 0%;
- left: 0%;
- width: 100%;
- z-index: 3;
- display: inline-block;
- }
- .SunDiv
- {
- position: absolute;
- top: 14%;
- right: 1%;
- width: 16%;
- height: auto;
- background-color: green;
- }
- .EyesSunPositionDiv
- {
- position: absolute;
- top: 26%;
- right: 6.5%;
- width: 5%;
- height: 10%;
- z-index: 4;
- }
- .InvisibilityDivToBlinkEyesOfTheSun
- {
- position: absolute;
- width: 55%;
- height: 7%;
- top: 24.5%;
- left: 20%;
- z-index: 108;
- background-color: lightgray;
- }
- .BlinkingEyesAnimationCSS
- {
- /* Safari 4.0 - 8.0 */
- -webkit-animation-name: example;
- -webkit-animation-duration: 3s;
- -webkit-animation-timing-function: linear;
- -webkit-animation-iteration-count: infinite;
- -webkit-animation-direction: alternate;
- /* Standard syntax */
- animation-name: example;
- animation-duration: 3s;
- animation-timing-function: linear;
- animation-iteration-count: infinite;
- animation-direction: alternate;
- }
- .eye {
- position: relative;
- display: inline-block;
- border-radius: 50%;
- height: 40%;
- width: 40%;
- background-color: gray;
- }
- .eye:after { /*pupil*/
- position: absolute;
- right: 10px;
- width: 40%;
- height: 40%;
- background: #000;
- border-radius: 50%;
- content: " ";
- }
- @-webkit-keyframes example {
- 75% {
- width: 40%;
- }
- 100% {
- width: 5%;
- }
- }
- @keyframes example {
- 75% {
- width: 40%;
- }
- 100% {
- width: 5%;
- }
- }
- .BodyDiv
- {
- background-color: black;
- position: absolute;
- margin: 0%;
- width: 100%;
- height: 100%;
- }
- </style>
- </head>
- <body>
- <div class="BodyDiv">
- <div class="InvisibilityDivToBlinkEyesOfTheSun" id="Pole"></div>
- <span class="SunDiv">
- <img src="http://www.onlygfx.com/wp-content/uploads/2017/11/grunge-circle-frame-1-1024x982.png" class="SunCircle">
- <img src="http://www.pngmart.com/files/4/Circle-PNG-Picture.png" class="SunCircle">
- <img src="https://png.pngtree.com/element_pic/17/07/11/a76c77c519c61cd7300f5bdb2ef4dea4.jpg" class="SunRotate">
- </span>
- <div class="EyesSunPositionDiv">
- <div class='eye' id="EyesID1"></div>
- <div class='eye' id="EyesID2"></div>
- </div>
- </div>
- <script>
- $('#Pole').mouseenter(function() {
- $('.eye').addClass('BlinkingEyesAnimationCSS'); //Jak tutaj wprowadzić .eye:after?
- });
- $('#Pole').mouseleave(function() {
- $('.eye').removeClass('BlinkingEyesAnimationCSS'); //Jak tutaj wprowadzić .eye:after?
- });
- //Oczy slonca - animacja podazania za kursorem
- $(".BodyDiv").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)'
- });
- });
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement