选项卡菜单切换跳跃动画效果

代码语言:html

所属分类:选项卡

代码描述:选项卡菜单切换跳跃动画效果

代码标签: 切换 跳跃 动画 效果

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


<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">

<style>
:root {
  --tab-background: hsl(0deg, 33%, 99%);
  --background: hsl(313deg, 96%, 10%);
  --stroke-color: hsl(358deg, 99%, 65%);
}

body {
  display: -webkit-box;
  display: flex;
  -webkit-box-pack: center;
          justify-content: center;
  -webkit-box-align: center;
          align-items: center;
  min-height: 100vh;
  margin: 0;
  padding: 20px;
  box-sizing: border-box;
  background: var(--background);
}

svg:not(.twitter-icon) {
  color: var(--stroke-color);
  height: inherit;
  fill: var(--tab-background);
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
  position: absolute;
}

#container {
  --r: 50px;
  min-width: 400px;
  width: 400px;
  max-width: 400px;
  height: 380px;
  display: -webkit-box;
  display: flex;
  -webkit-box-align: end;
          align-items: flex-end;
  border-radius: 2px 2px var(--r) var(--r);
  overflow: hidden;
}

#tab {
  background: var(--tab-background);
  width: inherit;
  height: 120px;
  border-radius: inherit;
  padding: 20px 80px;
  box-sizing: border-box;
  position: relative;
  display: -webkit-box;
  display: flex;
  -webkit-box-pack: justify;
          justify-content: space-between;
  -webkit-box-align: center;
          align-items: center;
}

.icon {
  width: 38px;
  height: 38px;
  position: relative;
  z-index: 5;
  cursor: pointer;
}
.icon.active.box .l1, .icon.active.home .l1, .icon.active.calender .l1 {
  --in: -252px;
  -webkit-animation: in 0.4s 1.1s forwards, landed 0.5s 1.5s forwards;
          animation: in 0.4s 1.1s forwards, landed 0.5s 1.5s forwards;
}
.icon.active.box .l2 {
  --in: -212px;
}
.icon.active.box .l3 {
  --in: -200px;
}
.icon.active.home .l2 {
  --in: -216px;
  -webkit-animation: in 0.26s 1.14s forwards, landed 0.5s 1.5s forwards;
          animation: in 0.26s 1.14s forwards, landed 0.5s 1.5s forwards;
}
.icon.active.box .l2, .icon.active.box .l3, .icon.active.calender .l2, .icon.active.calender .l3 {
  -.........完整代码请登录后点击上方下载按钮下载查看

网友评论0