有趣的边框动态变换效果

代码语言:html

所属分类:视觉差异

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

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

<title> Funky Border Animation Rough Prototype</title>
<style>
  :root {
  --border-width: 3rem;
  --squish-speed: 0.8s;
}

body {
  min-height: 100vh;
  margin: 0;
}

.funky {
  display: flex;
  position: absolute;
  background: orange;
}

.funky--top {
  top: 0;
  left: 0;
  z-index: 1;
  width: 100%;
}

.funky--right {
  right: 0;
  top: 0;
  height: 100vh;
  width: var(--border-width);
  flex-direction: column;
}

.funky--bottom {
  bottom: 0;
  left: 0;
  z-index: 1;
  width: 100%;
}

.funky--left {
  top: 0;
  left: 0;
  height: 100%;
  width: var(--border-width);
  flex-direction: column;
}

.funky > * {
  display: block;
  flex: 1;
  height: var(--border-width);
  background: orange;
  transition: all var(--squish-speed) ease-out;
  -webkit-animation: grow var(--squish-speed) ease-out;
          animation: grow var(--squish-speed) ease-out;
}

@-webkit-keyframes grow {
  0% {
    flex-grow: 0.00001;
  }
  100% {
    flex-grow: 1;
  }
}

@keyframes grow {
  0% {
    flex-grow: 0.00001;
  }
  100% {
    flex-grow: 1;
  }
}
</style>

</head>
&l.........完整代码请登录后点击上方下载按钮下载查看

网友评论0