Пример:
HTML:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
<div class="smile-container"> <div class="l-smile smile"> <div class="face face-l"> <div class="eye eye-l"></div> <div class="eye eye-r"></div> <div class="mouth"></div> </div> </div> <div class="r-smile smile"> <div class="face face-r"> <div class="eye eye-l eye-r-p"></div> <div class="eye eye-r eye-r-p"></div> <div class="mouth mouth-r"></div> <div class="kiss-m"> <div class="kiss"></div> <div class="kiss"></div> </div> </div> </div> </div> |
CSS:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 |
.smile-container * { box-sizing: content-box; } .smile-container{ margin: auto; position: relative; display: flex; justify-content: center; align-items: center; margin: 20px auto; font-size: 0; } .face{ width:70px; height:30px; position:absolute; right:0; top:30px; border-top-right-radius:15px; } .r-smile{ animation: kiss 4s ease infinite; background-color:white; } .kiss{ width:13px; height:10px; background-color:white; border-radius:50%; border-left:5px solid; } .kiss-m{ position:absolute; left:20px; top:22px; opacity:0; animation:kiss-m 4s ease infinite; } .mouth-r{ animation:mouth-m 4s ease infinite; } .face:after{ position:absolute; content:""; width:18px; height:8px; background-color:#BFE2FF; left:-5px; top:20px; border-radius:50%; } .face:before{ position:absolute; content:""; width:18px; height:8px; background-color:#BFE2FF; right:-8px; top:20px; border-radius:50%; z-index:-1; } .face-r{ left:0; top:37px; } .face-r:after{ width:10px; height:10px; left:5px; } .face-r:before{ width:10px; height:10px; right:-4px; } .eye{ width:15px; height:14px; border-radius:50%; border-bottom:5px solid; position:absolute; } .eye-r-p{ border-top:5px solid; border-bottom:0px solid; } .eye-l{ left:10px; } .eye-r{ right:5px; } .mouth{ width:30px; height:14px; border-radius:50%; border-bottom:5px solid; position:absolute; bottom:-5px; transform:translate(3px); left:0; right:0; margin: auto; } .smile{ border: #337AB7 8px solid; width:100px; height:100px; border-radius:50%; display:inline-block; vertical-align:top; position:relative; } .r-smile{ position:relative; z-index:40; } .l-smile{ animation: close 4s ease infinite; position:relative; z-index:50; background-color:#fff; } .face-l{ animation: face 4s ease infinite; } @keyframes kiss{ 40%{transform:translate(0px);} 50%{transform:translate(30px) rotate(20deg);} 60%{transform:translate(-33px);} 67%{transform:translate(-33px);} 77%{transform:translate(0px);} } @keyframes kiss-m{ 0%{opacity:0;} 55%{opacity:0;} 55.1%{opacity:1;} 66%{opacity:1;} 66.1%{opacity:0;} } @keyframes mouth-m{ 0%{opacity:1;} 54.9%{opacity:1;} 55%{opacity:0;} 66%{opacity:0;} 66.1%{opacity:1;} } @keyframes close{ 0%{transform:translate(0)} 20%{transform:translate(20px)} 35%{transform:translate(20px)} 55%{transform:translate(0px)} 100%{transform:translate(0px)} } @keyframes face{ 0%{transform:translate(0) rotate(0);} 10%{transform:translate(0) rotate(0);} 20%{transform:translate(5px) rotate(-2deg);} 28%{transform:translate(0) rotate(0);} 35%{transform:translate(5px) rotate(-2deg);} 50%{transform:translate(0) rotate(0);} 100%{transform:translate(0) rotate(0);} } |
Найдено на codepen.io у пользователя Arturo Cabrera
Добавить комментарий: