! Сегодня

Главная » Web и Технологии » Новогоднее украшение для сайта - шар с котом

Новогоднее украшение для сайта - шар с котом

Если хочешь узнать человека, не слушай, что о нём говорят другие, послушай, что он говорит о других.

22-сентября-2023, 20:31   3   0

Новогоднее украшение для сайта - шар с котом

Осень не заметно пролетит как наступят холода и конечно же долгожданные зимние праздники. А какие же праздники без украшений?! Сегодня я хочу с вами поделится оригинальным украшением для сайта, а именно снежным шаром с котиком. Снежный шар имеет переключатель при нажатии на который начинает идти снег  и вскоре кота заносит снегом , остается только силуэт и красивые глазки которые следят за курсором мышки.  Снежный шар с котом станет отличным дополнением для украшения вашего сайта или блога к Новому году. Установка не замысловата , приступим. Кстати если Вам понадобятся еще какие либо украшения для сайта , просто кликните по тегу внизу поста и Вам откроется масса интересных решений как для Нового года, так и для других подобных моментов.

HTML

<div class="snow-globe">
    <div class="globe-wrapper">
        <div class="globe">
            <div class="globe-inner">
                <div class="snow-storm"></div>
                <div class="tree">
                    <span class="star">&#9734;</span>
                    <span class="bulbs">
                        <span class="bulb"></span>
                        <span class="bulb"></span>
                        <span class="bulb"></span>
                        <span class="bulb"></span>
                        <span class="bulb"></span>
                        <span class="bulb"></span>
                        <span class="bulb"></span>
                        <span class="bulb"></span>
                        <span class="bulb"></span>
                        <span class="bulb"></span>
                        <span class="bulb"></span>
                        <span class="bulb"></span>
                        <span class="bulb"></span>
                    </span>
                    <div class="tree-section">
                        <div class="tree-leaves"></div>
                        <div class="tree-snow"></div>
                    </div>
                    <div class="tree-section">
                        <div class="tree-leaves"></div>
                        <div class="tree-snow"></div>
                    </div>
                    <div class="tree-section">
                        <div class="tree-leaves"></div>
                        <div class="tree-snow"></div>
                    </div>
                    <div class="tree-section">
                        <div class="tree-leaves"></div>
                        <div class="tree-snow"></div>
                    </div>
                    <div class="tree-section">
                        <div class="tree-leaves"></div>
                        <div class="tree-snow"></div>
                    </div>
                </div>
                <div class="snowman">
                    <div class="buddy">
                        <div class="head">
                            <div class="ear left">
                                <div class="hat"></div>
                            </div>
                            <div class="ear right"></div>
                            <div class="face">
                                <div class="eyes">
                                    <div class="eyefix right"></div>
                                    <div class="eyefix left"></div>
                                    <div class="eye left">
                                        <div class="eyelid top"></div>
                                        <div class="eyelid bottom"></div>
                                        <div class="pupil"></div>
                                    </div>
                                    <div class="eye right">
                                        <div class="eyelid top"></div>
                                        <div class="eyelid bottom"></div>
                                        <div class="pupil"></div>
                                    </div>
                                </div>
                                <div class="snoot"></div>
                                <div class="mouth">
                                    <div class="whisker-pad left">
                                        <div class="whiskers">
                                            <div class="whisker"></div>
                                            <div class="whisker"></div>
                                            <div class="whisker"></div>
                                        </div>
                                    </div>
                                    <div class="whisker-pad right">
                                        <div class="whiskers">
                                            <div class="whisker"></div>
                                            <div class="whisker"></div>
                                            <div class="whisker"></div>
                                        </div>
                                    </div>
                                </div>
                                <div class="snow-face"></div>
                            </div>
                        </div>
                        <div class="body">
                            <div class="chest"></div>
                            <div class="back-leg left"></div>
                            <div class="back-leg right"></div>
                            <div class="front-leg left">
                                <div class="foot left">
                                    <div class="bean"></div>
                                    <div class="bean"></div>
                                    <div class="bean"></div>
                                </div>
                            </div>
                            <div class="front-leg right">
                                <div class="foot right">
                                    <div class="bean"></div>
                                    <div class="bean"></div>
                                    <div class="bean"></div>
                                </div>
                            </div>
                        </div>
                        <div class="tail"></div>
                        <div class="snow-pile-head"></div>    
                        <div class="snow-pile-upper-body"></div>    
                        <div class="snow-pile-lower-body"></div>    
                        <div class="snow-pile-feet left"></div>    
                        <div class="snow-pile-feet right"></div>    
                    </div>
                </div>
                <div class="hill front-mask"></div>
                <div class="hill front"></div>
                <div class="hill middle"></div>
                <div class="hill back"></div>
            </div>
        </div>
    </div>
    <div class="base">
        <div class="base-top">
            <div class="plate-top"></div>
            <div class="plate-sides"></div>
            <div class="plate-bottom"></div>
        </div>
        <div class="base-middle">
            <div class="plate-top"></div>
            <div class="plate-sides">
                <label class="switch">
                    <input type="checkbox" name="globe-switch">
                    <span class="button round"></span>
                </label>
            </div>
            <div class="plate-bottom"></div>
        </div>
        <div class="base-bottom">
            <div class="plate-top"></div>
            <div class="plate-sides"></div>
            <div class="plate-bottom"></div>
        </div>
    </div>
</div>


CSS

/*************************/
/******* SNOW GLOBE ******/
/*************************/
.snow-globe {
    margin: auto;
    transform-origin: top;
    transform: scale(0.5);
    position: relative;
    left: -50%;    
    width: 200%;
    height: 480px;    
}
@media (max-width: 768px){ 
    .snow-globe {
        transform: scale(0.3);
        left: -100%;    
        width: 300%;  
        height: 290px; 
    }
} 
@media (max-width: 500px){ 
    .snow-globe {
        transform: scale(0.2);
        left: -200%;    
        width: 500%;        
        height: 200px;
    }
} 
.globe-wrapper {
    display: flex;
    z-index: 1;
    margin: auto;
    width: 800px;
    height: 800px;
    position: relative;
    overflow: hidden;
    clip-path: ellipse(85% 47% at 50% 48%);
}
.globe {
    display: flex;
    z-index: 1;
    border-radius: 50%;
    margin: auto;
    width: 95%;
    height: 95%;
    top: 10px;
    position: relative;
    background-color: #BFE2FF;
    border-bottom: 3px solid white;
    border-top: 1px solid white;
}
.globe-inner {
    width: 95%;
    height: 95%;
    padding: 10px;
    position: relative;
    margin: auto;
    border-radius: 50%;
    overflow: hidden;
    z-index: 1;
}
.globe-inner:after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 999;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0) 50%, #cef0ff 100%);
}
/*************************/
/******* LANDSCAPE *******/
/*************************/
.hill {
    border-radius: 50%;
    width: 130%;
    height: 60%;
    position: absolute;
    overflow: hidden;
    background: #7fc885;
}
.frosty .hill {
    animation: snowy-fields-main 19s;
    animation-fill-mode: forwards;
}
.hill.front {
    bottom: -210px;
    right: -260px;
    z-index: 4;
}
.hill.front:after {
    content: '';
    position: absolute;
    background: linear-gradient(-15deg, rgba(255, 255, 255, 0) 84%, #538257 100%);
    width: 100%;
    height: 100%;
}
.frosty .hill.front:after {
    animation: snowy-fields-highlights-front 1s 11s;
    animation-fill-mode: forwards;
}
.hill.front-mask {
    z-index: 11;
    bottom: -305px;
    right: -260px;
    z-index: 11;
    background: #7fc885;
    border-radius: 0;
    transform: rotate(-8deg);
    box-shadow: 5px 10px 21px 20px #7fc885;
}
.frosty .hill.front-mask {
    animation: snowy-fields-main 19s, border-fix 19s;
    animation-fill-mode: forwards;
}
.hill.front-mask:after {
    content: '';
    position: absolute;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0) 50%, #538257 100%);
    bottom: 245px;
    right: 40px;
    border-radius: 50% 50% 50% 50%;
    width: 99%;
    height: 60%;
    transform: rotate(-3deg);
}
.frosty .hill.front-mask:after {
    animation: snowy-fields-highlights-front-mask 1s 11s;
    animation-fill-mode: forwards;
}
.hill.middle {
    bottom: -180px;
    right: 200px;
    z-index: 3;
}
.hill.middle:after {
    content: '';
    position: absolute;
    background: linear-gradient(171deg, rgba(255, 255, 255, 0) 24%, #538257 100%);
    width: 100%;
    height: 100%;
}
.frosty .hill.middle:after {
    animation: snowy-fields-highlights-middle 1s 11s;
    animation-fill-mode: forwards;
}
.hill.back {
    bottom: -120px;
    right: -310px;
    width: 90%;
    z-index: 2;
}
.hill.back:after {
    content: '';
    position: absolute;
    background: linear-gradient(207deg, rgba(255, 255, 255, 0) 24%, #538257 100%);
    width: 100%;
    height: 100%;
}
.frosty .hill.back:after {
    animation: snowy-fields-highlights-back 1s 11s;
    animation-fill-mode: forwards;
}
/*************************/
/********* TREE **********/
/*************************/
.tree {
    position: absolute;
    width: 27%;
    height: 50%;
    z-index: 10;
    bottom: 30%;
    left: 10%;
    z-index: 3;
}
.tree-section {
    width: 30%;
    height: 30%;
    margin: 0 auto;
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
}
.tree-section:nth-of-type(1) {
    z-index: 1;
    height: 30%;
    bottom: 2%;
    width: 95%;
}
.tree-section:nth-of-type(2) {
    z-index: 2;
    height: 30%;
    width: 80%;
    bottom: 14%;
}
.tree-section:nth-of-type(3) {
    z-index: 3;
    height: 30%;
    width: 60%;
    bottom: 27%;
}
.tree-section:nth-of-type(4) {
    z-index: 4;
    height: 30%;
    width: 50%;
    bottom: 39%;
}
.tree-section:nth-of-type(5) {
    z-index: 5;
    height: 25%;
    width: 36%;
    bottom: 52%;
}
.tree-snow {
    z-index: 10;
    position: absolute;
    border-radius: 130% 120% 100% 70%;
    margin: 0 auto;
    transform-origin: top;
    background: linear-gradient(180deg, rgba(255,255,255,1) 0%, #c9f6ff 86%, rgba(0,212,255,1) 100%);
    background-size: 400% 400%;
    background-position: 16% -80%;
    height: 7%;
    border-radius: 50% 60% 30% 30%;
    width: 100%;
    left: 0;
    right: 0;
    bottom: -2%;
    opacity: 0;
}
.frosty .tree-snow {
    animation: all-the-snow 1s 11s;
    animation-fill-mode: forwards;
}
.tree-leaves {
    background: linear-gradient(0deg, #6ba770 0%, #538257 80%, #365539 100%);
    -webkit-clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
    clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
    height: 100%;
}
.tree-section:nth-of-type(5) .tree-leaves {
    background: #6ba770;
    background: linear-gradient(0deg, #6ba770 0%, #7fc885 100%);
}
 
.bulbs {
    position: absolute;
    top: 22%;
    left: 16%;
    right: 16%;
    bottom: 0;
    z-index: 7;
    opacity: 0;
}
.frosty .bulbs {
    animation: all-the-snow 1s 11s;
    animation-fill-mode: forwards;
}
.bulb {
    width: 15px;
    height: 15px;
    position: absolute;
    border-radius: 50%;
    top: 40px;
    left: 25px;
    z-index: 1;
}
.bulb:nth-child(3n+1) {
    background: lightblue;
    animation: colours-one 2s ease-in-out infinite;
}
.bulb:nth-child(3n+2) {
    background: gold;
    animation: colours-two 2s ease-in-out infinite;
}
.bulb:nth-child(3n+3) {
    background: purple;
    animation: colours-three 2s ease-in-out infinite;
}
.bulb:nth-child(1) {
    top: 35px;
    left: 61px;
}
.bulb:nth-child(2) {
    top: 65px;
    left: 55px;
}
.bulb:nth-child(3) {
    top: 122px;
    left: 84px;
}
.bulb:nth-child(4) {
    top: 105px;
    left: 65px;
}
.bulb:nth-child(5) {
    top: 120px;
    left: 40px;
}
.bulb:nth-child(6) {
    top: 155px;
    left: 30px;
}
.bulb:nth-child(7) {
    top: 165px;
    left: 58px;
}
.bulb:nth-child(8) {
    top: 155px;
    left: 90px;
}
.bulb:nth-child(9) {
    top: 215px;
    left: 110px;
}
.bulb:nth-child(10) {
    top: 215px;
    left: 60px;
}
.bulb:nth-child(11) {
    top: 215px;
    left: 10px;
}
.bulb:nth-child(12) {
    top: 200px;
    left: 30px;
}
.bulb:nth-child(13) {
    top: 200px;
    left: 90px;
}
.star {
    font-size: 70px;
    color: gold;
    display: inline-block;
    position: absolute;
    left: 0;
    right: 0;
    margin: 0 auto;
    width: 35%;
    text-align: center;
    bottom: 69%;
    z-index: 10;
    font-weight: bold;
    opacity: 0;
}
.frosty .star {
    animation: all-the-snow 1s 11s;
    animation-fill-mode: forwards;
}
/*************************/
/******** SNOWMAN ********/
/*************************/
.snowman {
    position: absolute;
    width: 200px;
    height: 400px;
    right: 30%;
    bottom: 25%;
    margin: auto;
    z-index: 5;
}
/*************************/
/********* SNOW **********/
/*************************/
.flake {
    position: absolute;
    cursor: default;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    -o-user-select: none;
    user-select: none;
    opacity: 0;
    animation: snow-fade-in 0.5s 0.5s;
    animation-fill-mode: forwards;
}
.snow-storm {
    width: 500%;
    height: 100%;
    background: orange;
    position: absolute;
    left: -500%;
    right: 0;
    top: 0;
    bottom: 0;
    z-index: 20;
    background: white;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.4178046218) 15%, #ddf9ff 40%, #ddf9ff 60%, rgba(255, 255, 255, 0.4514180672) 85%, rgba(255, 255, 255, 0) 100%);
}
.frosty .snow-storm {
    animation: snow-storm 12s 8.75s ease-out;
    animation-fill-mode: forwards;
}
.buddy {
    margin: auto;
    position: relative;
}
.head {
    position: relative;
    display: inline-block;
    margin: auto;
    z-index: 3;
}
.ear {
    width: 100px;
    height: 90px;
    background: grey;
    border-radius: 111% 58% 0% 0%;
    position: absolute;
    top: -10px;
    border-radius: 70px 14px;
}
.ear.right {
    right: -5px;
    rotate: 45deg;
    border-top: 3px solid lightgrey;
}
.ear.left {
    left: -5px;
    transform: rotate(-90deg);
    border-right: 3px solid lightgrey;
}
.frosty .ear {
    animation: snowy-floof 1s 11s;
    animation-fill-mode: forwards;
}
.face {
    width: 200px;
    height: 200px;
    background: grey;
    border-radius: 50% 50% 50% 50%;
    z-index: 2;
    position: relative;
    border-left: 2px solid lightgrey;
    border-right: 2px solid lightgrey;
    border-bottom: 0.5px solid lightgrey;
    border-top: 6px solid grey;
}
.frosty .face {
    animation: snowy-floof 1s 11s, snowy-borders 1s 11s;
    animation-fill-mode: forwards;
}
.eyes {
    display: grid;
    width: 80%;
    justify-content: space-around;
    margin: 0 auto;
    left: 0;
    right: 0;
    top: 25%;
    position: absolute;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr;
    justify-items: center;
    z-index: 1;
}
.eyefix {
    position: absolute;
    z-index: 999;
    border: 6px solid grey;
    z-index: 999;
    border-radius: 50%;
    width: 68px;
    height: 68px;
    margin: auto;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
}
.eyefix.left {
    grid-column: 1 / span 1;
}
.eyefix.right {
    grid-column: 2 / span 1;
}
.frosty .eyefix {
    animation: snowy-floof-eye-fix 1s 11s;
    animation-fill-mode: forwards;
}
.eye {
    width: 70px;
    height: 70px;
    display: flex;
    border-radius: 50%;
    position: relative;
    overflow: hidden;
    grid-column: 1 / span 1;
}
.eye.right {
    grid-column: 2 / span 1;
}
.eye:before {
    content: '';
    width: 100%;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: gold;
    position: absolute;
    border-radius: 50%;
}
.eye:after {
    content: '';
    width: 10px;
    height: 10px;
    background: white;
    border-radius: 50%;
    position: absolute;
    left: 10px;
    right: 0;
    margin: auto;
    top: 10px;
}
.eyelid {
    position: absolute;
    width: 100%;
    z-index: 10;
    animation: blink 5s ease-out infinite;
    background: grey;
}
.hunter .eyelid {
    animation: none;
}
.eyelid.top {
    top: -1px;
    border-bottom: 1px solid #444444;
}
.eyelid.bottom {
    bottom: -1px;
    border-top: 1px solid #444444;
}
.pupil {
    width: 20px;
    height: 40px;
    background: #000;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    transition: height .4s, width .2s ease-in-out;
}
.hunter .pupil {
    width: 55px;
    height: 55px;
}
.snoot {
    position: absolute;
    transform: rotate(45deg);
    width: 18px;
    height: 18px;
    border-radius: 100% 20% 50% 20%;
    top: 112px;
    background-color: #444444;
    left: 0;
    right: 0;
    margin: auto;
    z-index: 2;
}
.frosty .snoot {
    animation: icy-background 1s 11s;
    animation-fill-mode: forwards;
}
.mouth {
    position: absolute;
    top: 110px;
    left: 0;
    right: 0;
    margin: auto;
    display: flex;
    justify-content: center;
}
.mouth .whisker-pad {
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border-bottom: 5px solid #444444;
}
.frosty .mouth .whisker-pad {
    animation: icy-borders 1s 11s;
    animation-fill-mode: forwards;
}
.whisker {
    width: 70px;
    height: 10px;
    margin: auto;
    border-radius: 50%;
    border-top: 2px solid lightgrey;
    position: absolute;
}
.whisker:nth-of-type(1) {
    transform: rotate(5deg);
    left: -52px;
    top: 17px;
}
.right .whisker:nth-of-type(1) {
    transform: rotate(-5deg);
    left: 25px;
}
.whisker:nth-of-type(2) {
    top: 25px;
    transform: rotate(0deg);
    left: -48px;
}
.right .whisker:nth-of-type(2) {
    transform: rotate(0deg);
    left: 21px;
}
.whisker:nth-of-type(3) {
    top: 36px;
    transform: rotate(-12deg);
    left: -26px;
    width: 50px;
}
.right .whisker:nth-of-type(3) {
    transform: rotate(12deg);
    left: 20px;
}
.frosty .whisker {
    animation: icy-borders 1s 11s;
    animation-fill-mode: forwards;
}
.body {
    width: 160px;
    height: 240px;
    background: grey;
    border-radius: 44%;
    margin: -40px auto 0;
    position: relative;
    z-index: 1;
}
.chest {
    background: grey;
    position: absolute;
    z-index: 3;
    width: 120px;
    height: 90px;
    margin: 0 auto;
    left: 0;
    right: 0;
    top: 10px;
    border-radius: 50%;
}
.back-leg {
    background: grey;
    width: 100px;
    height: 180px;
    bottom: 0;
    position: absolute;
}
.back-leg.left {
    border-radius: 60% 0px 33% 50%;
    left: -30px;
    border-left: 2px solid lightgrey;
}
.back-leg.right {
    border-radius: 0px 60% 50% 33%;
    right: -30px;
    border-right: 2px solid lightgrey;
}
.front-leg {
    background: grey;
    width: 50px;
    height: 240px;
    bottom: 0;
    position: absolute;
    border: 2px solid lightgrey;
}
.front-leg.left {
    border-radius: 113% 50% 85% 120%;
    left: -10px;
}
.front-leg.right {
    border-radius: 50% 113% 85% 120%;
    right: -10px;
}
.foot {
    width: 60px;
    height: 30px;
    display: flex;
    position: absolute;
    bottom: 0;
    left: -3px;
}
.bean {
    background: grey;
    width: 30px;
    height: 30px;
    border: 2px solid lightgrey;
    border-top: 0;
    position: absolute;
    bottom: -8px;
}
.right .bean {
    border-radius: 40% 72% 50% 80%;
    border-left-color: grey;
    transform: rotate(5deg);
}
.right .bean:nth-of-type(1) {
    left: 20px;
    top: 4px;
}
.right .bean:nth-of-type(2) {
    top: 7px;
    left: 14px;
}
.right .bean:nth-of-type(3) {
    left: 5px;
    border-left-color: lightgrey;
}
.left .bean {
    border-radius: 72% 40% 80% 50%;
    border-right-color: grey;
    transform: rotate(5deg);
}
.left .bean:nth-of-type(1) {
    left: 0px;
    top: 4px;
}
.left .bean:nth-of-type(2) {
    top: 7px;
    left: 6px;
}
.left .bean:nth-of-type(3) {
    left: 14px;
    border-right-color: lightgrey;
}
.tail {
    width: 25px;
    height: 200px;
    background: grey;
    position: absolute;
    bottom: 20px;
    border: 3px solid lightgrey;
    border-radius: 100% 100% 60% 60%;
    left: 60px;
    transform: rotate(-45deg);
    transform-origin: bottom right;
    animation: tail 5s ease-out infinite;
}
.hunter .tail {
    animation: none;
}
.frosty .tail {
    animation: snowy-floof 1s 11s;
    animation-fill-mode: forwards;
}
.snow-pile-head {
    z-index: 3;
    position: absolute;
    transform: rotate(230deg);
    width: 0px;
    height: 0px;
    border-radius: 150% 30% 100% 30%;
    background-color: #444444;
    left: 0;
    right: 0;
    top: 20px;
    margin: 0 auto;
    transform-origin: top;
    background: linear-gradient(-50deg, rgba(255,255,255,1) 54%, rgba(0,212,255,1) 100%);
    background-size: 400% 400%;
    background-position: 6% -42%;
}
.frosty .snow-pile-head {
    animation: snow-animation-head 12s 1.5s ease-in;
    animation-fill-mode: forwards;
}
.snow-pile-feet {
    z-index: 3;
    position: absolute;
    width: 50px;
    height: 50px;
    opacity: 0;
    border-radius: 130% 120% 100% 70%;
    background-color: #444444;
    left: 8px;
    bottom: 14px;
    margin: 0 auto;
    transform-origin: center bottom;
    transform: scale(0, 0);
    background: linear-gradient(170deg, rgba(255,255,255,1) 54%, rgba(0,212,255,1) 100%);
    background-size: 400% 400%;
    background-position: 16% -80%;
}
.snow-pile-feet.right {
    left: auto;
    right: 10px;
}
.frosty .snow-pile-feet {
    animation: snow-animation-feet 12s 1.5s ease-in;
    animation-fill-mode: forwards;
}
.snow-face {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    z-index: -1;
    background: linear-gradient(170deg, rgba(255,255,255,1) 54%, rgba(0,212,255,1) 100%);
    background-size: 400% 400%;
    background-position: 16% -70%;
    opacity: 0;
}
.frosty .snow-face {
    animation: all-the-snow 1s 11s;
    animation-fill-mode: forwards;
}
.snow-pile-lower-body {
    z-index: 1;
    position: absolute;
    width: 120%;
    height: 205px;
    border-radius: 50% 50% 40% 40%;
    border-bottom: 2px solid rgba(173, 216,230,1);
    border-left: 1px solid rgba(173, 216,230,1);
    border-right: 1px solid rgba(173, 216,230,1);
    background-color: #444444;
    left: -10%;
    right: -10%;
    bottom: -10px;
    margin: 0 auto;
    transform-origin: top;
    background: linear-gradient(170deg, rgba(255,255,255,1) 54%, rgba(0,212,255,1) 100%);
    background-size: 400% 400%;
    background-position: 16% -70%;
    opacity: 0;
}
.frosty .snow-pile-lower-body {
    animation: all-the-snow 1s 11s;
    animation-fill-mode: forwards;
}
.snow-pile-upper-body {
    z-index: 2;
    position: absolute;
    width: 200px;
    height: 150px;
    border-radius: 50% 50% 45% 45%;
    left: 0;
    right: 0;
    bottom: 130px;
    margin: 0 auto;
    transform-origin: top;
    background: linear-gradient(170deg, rgba(255,255,255,1) 54%, rgba(0,212,255,1) 100%);
    border-bottom: 2px solid rgba(173, 216,230,1);
    border-left: 1px solid rgba(173, 216,230,1);
    border-right: 1px solid rgba(173, 216,230,1);
    background-size: 400% 400%;
    background-position: 16% -73%;
    opacity: 0;
}
.frosty .snow-pile-upper-body {
    animation: all-the-snow 1s 11s;
    animation-fill-mode: forwards;
}
.base {
    bottom: 91px;
    z-index: 0;
    position: relative;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 860px;
}
.plate-top {
    width: 100%;
    height: 60px;
    background: linear-gradient(87deg, rgba(140,140,140,1) 55%, rgba(208,208,208,1) 92%);
    border-radius: 50%;
    position: relative;
    z-index: 3;
}
.plate-sides {
    content: '';
    width: 100%;
    height: 20px;
    display: block;
    position: absolute;
    bottom: 10px;
    left: 0;
    right: 0;
    background: linear-gradient(87deg, rgba(140,140,140,1) 0%, rgba(208,208,208,1) 8%, rgba(140,140,140,1) 50%, rgba(208,208,208,1) 92%, rgba(140,140,140,1) 100%);
    z-index: 2;
}
.plate-bottom {
    content: '';
    width: 100%;
    height: 60px;
    display: block;
    position: absolute;
    bottom: -19px;
    left: 0;
    right: 0;
    background: linear-gradient(87deg, rgba(140,140,140,1) 0%, rgba(208,208,208,1) 8%, rgba(140,140,140,1) 50%, rgba(208,208,208,1) 92%, rgba(140,140,140,1) 100%);
    border-radius: 50%;
    z-index: 1;
}
.base-top {
    position: relative;
    z-index: 3;
    width: 60%;
}
.base-middle {
    position: relative;
    z-index: 2;
    width: 70%;
    top: -30px;
}
.base-middle .plate-top {
    height: 70px;
}
.base-middle .plate-sides {
    height: 90px;
    bottom: -55px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.base-middle .plate-bottom {
    bottom: -85px;
}
.base-bottom {
    position: relative;
    z-index: 1;
    width: 80%;
    top: 10px;
}
.base-bottom .plate-top {
    height: 70px;
    bottom: 5px;
}
.base-bottom .plate-sides {
    bottom: 20px;
}
.base-bottom .plate-bottom {
    bottom: -10px;
}
.switch {
    position: relative;
    display: inline-block;
    width: 100px;
    height: 40px;
    margin: 60px auto 0;
}
.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.button {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle, black 57%, #8c8c8c 120%);
    -webkit-transition: .4s;
    transition: .4s;
    border-radius: 34px;
}
.button:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 5px;
    bottom: 5px;
    background: radial-gradient(circle, white 0%, #ddb900 23%);
    background-size: 200% 200%;
    background-position: 41% 66%;
    transition: all .26s ease-in-out;
    border-radius: 50%;
    border: 2px solid black;
}
input:checked + .button:before {
    transform: translateX(60px);
}
.hat {
    width: 70px;
    height: 75px;
    background: linear-gradient(87deg, black 0%, #4e4e4e 81%, #6e6e6e 100%);
    position: absolute;
    top: -27px;
    z-index: 10;
    left: 64px;
    transform: rotate(54deg);
    border-radius: 10px 10px 0 0;
    opacity: 0;
}
.hat:before {
    content: '';
    background: linear-gradient(87deg, #ac0101 0%, red 44%, #ff5656 100%);
    position: absolute;
    width: 102%;
    left: -1%;
    right: -1%;
    height: 10px;
    bottom: 0;
}
.hat:after {
    content: '';
    background: linear-gradient(87deg, black 0%, #4e4e4e 81%, #6e6e6e 100%);
    position: absolute;
    width: 160%;
    left: -30%;
    right: -30%;
    height: 10px;
    bottom: -10px;
    border-radius: 4px;
}
.frosty .hat {
    animation: all-the-snow 1s 11s;
    animation-fill-mode: forwards;
}
/*************************/
/**** ANIMATIONS HERE ****/
/*************************/
@keyframes blink {
    0% {
        height: 0;
    }
    3% {
        height: 50%;
    }
    9% {
        height: 0;
    }
    100% {
        height: 0%;
    }
}
@keyframes tail {
    0% {
        transform: rotate(-45deg);
    }
    50% {
        transform: rotate(-45deg);
    }
    53% {
        transform: rotate(-20deg);
    }
    56% {
        transform: rotate(-45deg);
    }
    59% {
        transform: rotate(-20deg);
    }
    62% {
        transform: rotate(-45deg);
    }
    100% {
        transform: rotate(-45deg);
    }
}
@keyframes snow-animation-feet {
    2% {
        opacity: 1;
    }
    70% {
        width: 60px;
        opacity: 1;
        background-position: 16% -60%;
        transform: scale(1, 1);
        border-radius: 80px 80px 60px 60px;
    }
    72% {
        opacity: 1;
    }
    76% {
        opacity: 0;
    }
    100% {
        width: 60px;
        background-position: 16% -60%;
        transform: scale(1, 1);
        border-radius: 80px 80px 60px 60px;
        opacity: 0;
    }
}
@keyframes snow-animation-head {
    70% {
        background-position: 6% -60%;
        width: 80px;
        height: 83px;
        border-radius: 100% 20% 40% 20%;
        left: -67px;
        top: 50px;
        opacity: 1;
    }
    72% {
        opacity: 1;
    }
    76% {
        opacity: 0;
    }
    100% {
        background-position: 6% -60%;
        width: 80px;
        height: 83px;
        border-radius: 100% 20% 40% 20%;
        left: -67px;
        top: 50px;
        opacity: 0;
    }
}
@keyframes snow-storm {
    0% {
        left: -500%;
    }
    100% {
        left: 500%;
    }
}
@keyframes all-the-snow {
    100% {
        opacity: 1;
    }
}
@keyframes snowy-fields-main {
    100% {
        background: rgba(255,255,255,1);
    }
}
@keyframes snowy-fields-highlights-front {
    0% {
        background: linear-gradient(-15deg, rgba(255, 255, 255, 0) 84%, rgba(0,212,255,1) 100%);
    }
    100% {
        background: linear-gradient(-15deg, rgba(255, 255, 255, 0) 84%, rgba(0,212,255,1) 100%);
    }
}
@keyframes snowy-fields-highlights-front-mask {
    0% {
        background: linear-gradient(180deg, rgba(255, 255, 255, 0) 50%, rgba(0,212,255,1) 100%);
    }
    100% {
        background: linear-gradient(180deg, rgba(255, 255, 255, 0) 50%, rgba(0,212,255,1) 100%);
    }
}
@keyframes snowy-fields-highlights-middle {
    0% {
        background: linear-gradient(171deg, rgba(255, 255, 255, 0) 24%, rgba(0,212,255,1) 100%);
    }
    100% {
        background: linear-gradient(171deg, rgba(255, 255, 255, 0) 24%, rgba(0,212,255,1) 100%);
    }
}
@keyframes snowy-fields-highlights-back {
    0% {
        background: linear-gradient(207deg, rgba(255, 255, 255, 0) 24%, rgba(0,212,255,1) 100%);
    }
    100% {
        background: linear-gradient(207deg, rgba(255, 255, 255, 0) 24%, rgba(0,212,255,1) 100%);
    }
}
@keyframes snowy-floof {
    0% {
        background: rgba(255,255,255,1);
        border-color: rgba(173, 216,230,1);
    }
    100% {
        background: rgba(255,255,255,1);
        border-color: rgba(173, 216,230,1);
    }
}
@keyframes snowy-floof-eye-fix {
    0% {
        border-color: rgba(255,255,255,1);
    }
    100% {
        border-color: rgba(255,255,255,1);
    }
}
@keyframes snowy-borders {
    0% {
        border-color: rgba(255,255,255,1);
    }
    100% {
        border-color: rgba(255,255,255,1);
    }
}
@keyframes icy-borders {
    0% {
        border-color: rgba(173, 216,230,1);
    }
    100% {
        border-color: rgba(173, 216,230,1);
    }
}
@keyframes icy-background {
    0% {
        background: rgba(173, 216,230,1);
    }
    100% {
        background: rgba(173, 216,230,1);
    }
}
@keyframes border-fix {
    0% {
        box-shadow: 5px 10px 21px 20px #7fc885;
    }
    100% {
        box-shadow: 5px 10px 21px 20px white;
    }
}
@keyframes snow-fade-in {
    0% {
        opacity: 0;
    }
    100% {
        opacity: 1;
    }
}
@keyframes colours-one {
    0% {
        background: lightblue;
    }
    50% {
        background: teal;
    }
    100% {
        background: lightblue;
    }
}
@keyframes colours-two {
    0% {
        background: gold;
    }
    50% {
        background: hotpink;
    }
    100% {
        background: gold;
    }
}
@keyframes colours-three {
    0% {
        background: purple;
    }
    50% {
        background: yellow;
    }
    100% {
        background: purple;
    }
}


JS

const pupils = document.querySelectorAll('.pupil');
const buddy = document.querySelector('.buddy');
const eyeTrigger = document.querySelectorAll('.switch');
const eyeTracking = (e) => {
    var x = event.clientX * 100 / window.innerWidth + "%";
    var y = event.clientY * 100 / window.innerHeight + "%";
    pupils.forEach(pupil => {
        pupil.style.left = x;
        pupil.style.top = y;
        pupil.style.transform = `translate(-${x}, -${y})`;
    });
};
window.addEventListener('mousemove', eyeTracking);
eyeTrigger.forEach(trigger => {
    trigger.addEventListener('mouseenter', e => {
        buddy.classList.add('hunter');
    });
    trigger.addEventListener('mouseleave', e => {
        buddy.classList.remove('hunter');
    });
});
// SNOW! based on kurisu brooks' snow.js
// Settings
// let snowMax = 100; SET IN THE TOGGLE.
const snowColor = ["#DDD", "#EEE"];
const snowEntity = "&#x2022;";
const snowSpeed = 0.3;
const snowMinSize = 8;
const snowMaxSize = 40;
const snowRefresh = 10;
let snow = [],
pos = [],
coords = [],
lefr = [],
marginBottom,
marginRight;
const randomise = range => {
    rand = Math.floor(range * Math.random());
    return rand;
}
const initSnow = () => {
    if(snowMax > 0) {    
        const globeypls = document.querySelector('.globe-inner');
        for (i = 0; i <= snowMax; i++) {
            const flake = document.createElement('span');
            flake.innerHTML = `${snowEntity}`;
            flake.classList.add(`flake`, `flake${i}`);
            globeypls.appendChild(flake);        
        }
        let snowSize = snowMaxSize - snowMinSize;
        marginBottom = document.body.scrollHeight - 5;
        marginRight = document.body.clientWidth - 15;
        for (i = 0; i <= snowMax; i++) {
            coords[i] = 0;
            lefr[i] = Math.random() * 15;
            pos[i] = 0.03 + Math.random() / 10;
            snow[i] = document.querySelector(".flake" + i);
            snow[i].style.fontFamily = "inherit";
            snow[i].size = randomise(snowSize) + snowMinSize;
            snow[i].style.fontSize = snow[i].size + "px";
            snow[i].style.color = snowColor[randomise(snowColor.length)];
            snow[i].style.zIndex = Math.round(Math.random() * 10);
            snow[i].sink = snowSpeed * snow[i].size / 5;
            snow[i].posX = randomise(marginRight - snow[i].size);
            snow[i].posY = randomise(2 * marginBottom - marginBottom - 2 * snow[i].size);
            snow[i].style.left = snow[i].posX + "px";
            snow[i].style.top = snow[i].posY + "px";
        }
        moveSnow();
    }
}
const resize = () => {
    marginBottom = document.body.scrollHeight - 5;
    marginRight = document.body.clientWidth - 15;
}
const moveSnow = () => {
    if(snowMax > 0) {
        for (i = 0; i <= snowMax; i++) {
            coords[i] += pos[i];
            snow[i].posY += snow[i].sink;
            snow[i].style.left = snow[i].posX + lefr[i] * Math.sin(coords[i]) + "px";
            snow[i].style.top = snow[i].posY + "px";
            if (snow[i].posY >= marginBottom - 2 * snow[i].size || parseInt(snow[i].style.left) > (marginRight - 3 * lefr[i])) {
                snow[i].posX = randomise(marginRight - snow[i].size);
                snow[i].posY = 0;
            }
        }
        setTimeout("moveSnow()", snowRefresh);
    }
}
// GLOBE CONTROL
const checkbox = document.querySelector("input[name=globe-switch]");
const globe = document.querySelector('.globe');
checkbox.addEventListener( 'change', function() {
    if(this.checked) {
        snowMax = 100;
        initSnow();
        globe.classList.add('frosty');
        buddy.classList.remove('hunter');
        } else {
        globe.classList.remove('frosty');
        snowMax = 0;
        snow = [];
        pos = [];
        coords = [];
        lefr = [];
        let flakeQty = document.querySelectorAll('.flake');
        flakeQty.forEach(flake => {
            flake.remove();
        });
    }
});


+1

Поделиться

Tags

  • bowtiesmilelaughingblushsmileyrelaxedsmirk
    heart_eyeskissing_heartkissing_closed_eyesflushedrelievedsatisfiedgrin
    winkstuck_out_tongue_winking_eyestuck_out_tongue_closed_eyesgrinningkissingstuck_out_tonguesleeping
    worriedfrowninganguishedopen_mouthgrimacingconfusedhushed
    expressionlessunamusedsweat_smilesweatdisappointed_relievedwearypensive
    disappointedconfoundedfearfulcold_sweatperseverecrysob
    joyastonishedscreamtired_faceangryragetriumph
    sleepyyummasksunglassesdizzy_faceimpsmiling_imp
    neutral_faceno_mouthinnocent
Имя Гагарина ?

Редакторы выбирают

Web и Технологии