mojs实现圣诞节礼物交互动画效果代码

代码语言:html

所属分类:动画

代码描述:mojs实现圣诞节礼物交互动画效果代码

代码标签: 礼物 交互 动画 效果

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


<!DOCTYPE html>
<html lang="en" >

<head>

  <meta charset="UTF-8">
  

<link type="text/css" rel="stylesheet" href="//repo.bfw.wiki/bfwrepo/css/splitting.css">
<link type="text/css" rel="stylesheet" href="//repo.bfw.wiki/bfwrepo/css/splitting-cells.css">
  
<style>
@import url("https://fonts.googleapis.com/css2?family=Fredoka+One&display=swap");
body {
  background: #34E1FF;
  font-family: 'Fredoka One', cursive;
  overflow-x: hidden;
}

.container {
  position: absolute;
  top: 50%;
  left: 50%;
  -webkit-transform: translate(-50%, -50%);
          transform: translate(-50%, -50%);
}

.text {
  min-width: 100%;
  text-align: center;
  color: white;
  text-shadow: 1px 1px #2C3A49;
  font-size: 3em;
}

.text .char {
  -webkit-animation: slide-in 1s cubic-bezier(0.5, 0, 0.5, 1) both;
          animation: slide-in 1s cubic-bezier(0.5, 0, 0.5, 1) both;
  -webkit-animation-delay: calc(60ms * var(--char-index));
          animation-delay: calc(60ms * var(--char-index));
}

@-webkit-keyframes slide-in {
  from {
    -webkit-transform: translateY(-1em) rotate(-0.5turn) scale(0.5);
            transform: translateY(-1em) rotate(-0.5turn) scale(0.5);
    opacity: 0;
  }
}

@keyframes slide-in {
  from {
    -webkit-transform: translateY(-1em) rotate(-0.5turn) scale(0.5);
            transform: translateY(-1em) rotate(-0.5turn) scale(0.5);
    opacity: 0;
  }
}
.presents {
  display: -webkit-box;
  display: flex;
  -webkit-box-pack: center;
          justify-content: center;
  -webkit-box-align: end;
          align-items: flex-end;
  height: 200px;
}

.green {
  position: relative;
  left: -20px;
  width: 100px;
  height: 100px;
  z-index: 1;
}
.green:hover {
  -webkit-animation: 0.5s green;
          animation: 0.5s green;
}
.green .lid {
  background: #3DDC81;
}
.green .box {
  background-image: radial-gradient(#fff 20%, transparent 20%), radial-gradient(#fff 20%, transparent 20%);
  background-color: #3DDC81;
}
.green .ribbon {
  background: #F75D4C;
}
.green .ribbon::before {
  top: 21%;
}
.green .bow {
  background: #F75D4C;
}
.green .bow::before, .green .bow::after {
  background: #F75D4C;
}
@-webkit-keyframes green {
  0% {
    width: 100px;
    height: 100px;
  }
  30% {
    width: calc(100px + 10px);
    height: calc(100px - 10px);
  }
  60% {
    width: calc(100px - 10px);
    height: calc(100px + 10px);
  }
  100% {
    width: 100px;
    height: 100px;
  }
}
@keyframes green {
  0% {
    width: 100px;
    height: 100px;
  }
  30% {
    width: calc(100px + 10px);
    height: calc(100px - 10px);
  }
  60% {
    width: calc(100px - 10px);
    height: calc(100px + 10px);
  }
  100% {
    width: 100px;
    height: 100px;
  }
}
.orange {
  position: relative;
  left: 20px;
  width: 130px;
  height: 120px;
  z-index: 10;
}
.orange:hover {
  -webkit-animation: 0.5s orange;
          animation: 0.5s orange;
}
.orange .lid {
  background: #FFA726;
}
.orange .box {
  background-image: radial-gradient(#2C3A49 20%, transparent 20%), radial-gradient(#2C3A49 20%, transparent 20%);
  background-color: #FFA726;
}
.orange .ribbon {
  background: #F75D4C;
}
.orange .ribbon::before {
  top: 21%;
}
.orange .bow {
  background: #F75D4C;
}
.orange .bow::before, .orange .bow::after {
  background: #F75D4C;
}
@-webkit-keyframes orange {
  0% {
    width: 130px;
    height: 120px;
  }
  30% {
    width: calc(130px + 10px);
    height: calc(120px - 10px);
  }
  60% {
    width: calc(130px - 10px);
    height: calc(120px + 10px);
  }
  100% {
    width: 130px;
    height: 120px;
  }
}
@keyframes orange {
  0% {
    width: 130px;
    height: 120px;
  }
  30% {
    width: calc(130px + 10px);
    height: calc(120px - 10px);
  }
  60% {
    width: calc(130px - 10px);
    height: calc(120px + 10px);
  }
  100% {
    width: 130px;
    height: 120px;
  }
}
.blue {
  position: relative;
  left: 0;
  width: 120px;
  height: 160px;
  z-index: 0;
}
.blue:hover {
  -webkit-animation: 0.5s blue;
          animation: 0.5s blue;
}
.blue .lid {
  background: #1BB5FE;
}
.blue .box {
  background-image: radial-gradient(transparent 20%, transparent 20%), radial-gradient(transparent 20%, transparent 20%);
  background-color: #1BB5FE;
}
.blue .ribbon {
  background: #3DDC81;
}
.blue .ribbon::before {
  top: 21%;
}
.blue .bow {
  background: #3DDC81;
}
.blue .bow::before, .blue .bow::after {
  background: #3DDC81;
}
@-webkit-keyframes blue {
  0% {
    width: 120px;
    height: 160px;
  }
  30% {
    wid.........完整代码请登录后点击上方下载按钮下载查看

网友评论0