css实现鼠标悬浮科幻Sci fi大门打开动画效果代码

代码语言:html

所属分类:悬停

代码描述:css实现鼠标悬浮科幻Sci fi大门打开动画效果代码

代码标签: css 鼠标 悬浮 科幻 Sci fi 大门 打开 动画

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

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

<head>
  <meta charset="UTF-8">
  

  
  
  
<style>
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: #212121;
  min-height: 100dvh;
  width: 100%;
  display: flex;
  gap: 50px;
  flex-wrap: wrap;
  padding: 30px;
  justify-content: center;
  align-items: center;
}

.card {
  position: relative;
  height: 300px;
  width: 230px;
}
.card:nth-child(2) {
  filter: hue-rotate(300deg) brightness(1.3);
}
.card:nth-child(3) {
  filter: hue-rotate(200deg) brightness(1.5);
}
.card:nth-child(4) {
  filter: hue-rotate(60deg) brightness(3);
}
.card .boxshadow {
  position: absolute;
  height: 100%;
  width: 100%;
  border: 1px solid red;
  transform: scale(0.8);
  box-shadow: red 0px 30px 70px 0px;
  transition: all 0.5s cubic-bezier(0.785, 0.135, 0.15, 0.86);
}
.card .main {
  width: 230px;
  height: 300px;
  overflow: hidden;
  background: red;
  background: linear-gradient(0deg, #3e0000 0%, red 60%, #3e0000 100%);
  position: relative;
  clip-path: polygon(0 0, 100% 0, 100% 40px, 100% calc(100% - 40px), calc(100% - 40px) 100%, 40px 100%, 0 calc(100% - 40px));
  box-shadow: red 0px 7px 29px 0px;
  transition: all 0.3s cubic-bezier(0.785, 0.135, 0.15, 0.86);
}
.card .main .top {
  position: absolute;
  top: 0px;
  left: 0;
  width: 0px;
  height: 0px;
  z-index: 2;
  border-top: 115px solid black;
  border-left: 115px solid transparent;
  border-right: 115px solid transparent;
  transition: all 0.5s cubic-bezier(0.785, 0.135, 0.15, 0.86);
}
.card .main .side {
  position: absolute;
  width: 100%;
  top: 0;
  transform: translateX(-50%);
  height: 101%;
  background: black;
  clip-path: polygon(0% 0%, 50% 0, 95% 45%, 100% 100%, 0% 100%);
  transition: all 0.5s cubic-bezier(0.785, 0.135, 0.15, 0.86) 1s;
}
.card .main .left {
  left: 0;
}
.card .main .right {
  right: 0;
  transform: translateX(50%) scale(-1, 1);
}
.card .main .title {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: 90px;
  font-weight: bold;
  font-size: 25px;
  opacity: 0;
  z-index: -1;
  transition: all 0.2s ease-out 0s;
}
.card .main .button-container {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
}
.card .main .button-container .button {
  position: absolute;
  transform: translateX(-50%);
  padding: 5px 10px;
  clip-path: polygon(0 0, 100% 0, 81% 100%, 21% 100%);
  background: black;
  border: none;
  color: white;
  display: grid;
  place-content: center;
  transition: all 0.5s cubic-bezier(0.785, 0.135, 0.15, 0.86);
}
.card .main .button-container .button .svg {
  width: 15px;
  transition: all 0.2s cubic-bezier(0.785, 0.135, 0.15, 0.86);
}
.card .main .button-container .button:nth-child(1) {
  bottom: 300px;
  transition-delay: 0.4s;
}
.card .main .button-container .button:nth-child(2) {
  bottom: 300px;
  transition-delay: 0.6s;
}
.card .main .button-container .button:nth-child(3) {
  bottom: 300px;
  transition-delay: 0.8s;
}
.card .main .button-container .button:hover .svg {
  transform: scale(1.2);
}
.card .main .button-container .button:active .svg {
  transform: scale(0.7);
}

.card:hover .main {
  transform: scale(1.1);
}
.card:hover .main .top {
  top: -50px;
}
.card:hover .main .left {
  left: -50px;
  transition: all 0.5s cubic-bezier(0.785, 0.135, 0.15, 0.86) 0.1s;
}
.card:hover .main .right {
  right: -50px;
  transition: all 0.5s cubic-bezier(0.785, 0.135, 0.15, 0.86) 0.1s;
}
.card:hover .main .title {
  opacity: 1;
  transition: all 0.2s ease-out 1.3s;
}
.card:hover .main .button-container .button:nth-child(1) {
  bottom: 80px;
  transition-delay: 0.8s;
}
.card:hover .main .button-container .button:nth-child(2) {
  bottom: 40px;
  transition-delay: 0.6s;
}
.card:hover .main .button-container .button:nth-child(3) {
  bottom: 0;
  transition-delay: 0.4s;
}
</style>



  
  
</head>

<body >
  <div class="card">
    <div class="boxshadow"></div>
    <div class="main">
        <div class="top"></div>
        <div class="left side"></div>
        <div class="right side"></div>
        <div class="title">TITLE</div>
        <div class="button-container">
            <button class="button"><svg class="svg" xmlns="http://www.w3.org/2000/svg" width="24" height="24"
                    viewBox="0 0 24 24" stroke="red" fill="none" stroke-width="2" stroke-linecap="round"
                    stroke-linejoin="round">
                    <rect width="20" height="20" x="2" y="2" rx="5" ry="5"></rect>
           .........完整代码请登录后点击上方下载按钮下载查看

网友评论0