css实现emoji动态表情动画效果代码

代码语言:html

所属分类:动画

代码描述:css实现emoji动态表情动画效果代码

代码标签: css emoji 动画 表情

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>

<html lang="en">

<head>

    <meta charset="UTF-8">




    <style>
        body {
          text-align: center;
          margin: 80px auto 0;
          font-family: "Lucida Sans Unicode", "Lucida Grande", sans-serif;
        }
        
        .emoji {
          width: 120px;
          height: 120px;
          margin: 15px 15px 40px;
          background: #ffda6a;
          display: inline-block;
          border-radius: 50%;
          position: relative;
        }
        .emoji:after {
          position: absolute;
          bottom: -40px;
          font-size: 18px;
          width: 60px;
          left: calc(50% - 30px);
          color: #8a8a8a;
        }
        
        .emoji__face,
        .emoji__eyebrows,
        .emoji__eyes,
        .emoji__mouth,
        .emoji__tongue,
        .emoji__heart,
        .emoji__hand,
        .emoji__thumb {
          position: absolute;
        }
        .emoji__face:before, .emoji__face:after,
        .emoji__eyebrows:before,
        .emoji__eyebrows:after,
        .emoji__eyes:before,
        .emoji__eyes:after,
        .emoji__mouth:before,
        .emoji__mouth:after,
        .emoji__tongue:before,
        .emoji__tongue:after,
        .emoji__heart:before,
        .emoji__heart:after,
        .emoji__hand:before,
        .emoji__hand:after,
        .emoji__thumb:before,
        .emoji__thumb:after {
          position: absolute;
          content: "";
        }
        
        .emoji__face {
          width: inherit;
          height: inherit;
        }
        
        .emoji--like {
          background: #548dff;
        }
        .emoji--like:after {
          content: "Like";
        }
        .emoji--like .emoji__hand {
          left: 25px;
          bottom: 30px;
          width: 20px;
          height: 40px;
          background: #ffffff;
          border-radius: 5px;
          z-index: 0;
          -webkit-animation: hands-up 2s linear infinite;
                  animation: hands-up 2s linear infinite;
        }
        .emoji--like .emoji__hand:before {
          left: 25px;
          bottom: 5px;
          width: 40px;
          background: inherit;
          height: 10px;
          border-radius: 2px 10px 10px 2px;
          box-shadow: 1px -9px 0 1px #ffffff, 2px -19px 0 2px #ffffff, 3px -29px 0 3px #ffffff;
        }
        .emoji--like .emoji__thumb {
          border-bottom: 20px solid #ffffff;
          border-left: 20px solid transparent;
          top: -25px;
          right: -25px;
          z-index: 2;
          transform: rotate(5deg);
          transform-origin: 0% 100%;
          -webkit-animation: thumbs-up 2s linear infinite;
                  animation: thumbs-up 2s linear infinite;
        }
        .emoji--like .emoji__thumb:before {
          border-radius: 50% 50% 0 0;
          background: #ffffff;
          width: 10px;
          height: 12px;
          left: -10px;
          top: -8px;
          transform: rotate(-15deg);
          transform-origin: 100% 100%;
          box-shadow: -1px 4px 0 -1px #ffffff;
        }
        
        .emoji--love {
          background: #f55064;
        }
        .emoji--love:after {
          content: "Love";
        }
        .emoji--love .emoji__heart {
          left: calc(50% - 40px);
          top: calc(50% - 40px);
          width: 80px;
          height: 80px;
          -webkit-animation: heart-beat 1s linear infinite alternate;
                  animation: heart-beat 1s linear infinite alternate;
        }
        .emoji--love .emoji__heart:before, .emoji--love .emoji__heart:after {
          left: calc(50% - 20px);
          top: calc(50% - 32px);
          width: 40px;
          height: 64px;
          background: #ffffff;
          border-radius: 20px 20px 0 0;
        }
        .emoji--love .emoji__heart:before {
          transform: translate(20px) rotate(-45deg);
          transform-origin: 0 100%;
        }
        .emoji--love .emoji__heart:after {
          transform: translate(-20px) rotate(45deg);
          transform-origin: 100% 100%;
        }
        
        .emoji--haha:after {
          content: "Haha";
        }
        .emoji--haha .emoji__face {
          -webkit-animation: haha-face 2s linear infinite;
                  animation: haha-face 2s linear infinite;
        }
        .emoji--haha .emoji__eyes {
          width: 26px;
          height: 6px;
         .........完整代码请登录后点击上方下载按钮下载查看

网友评论0