css实现望远镜悬停动画效果代码

代码语言:html

所属分类:悬停

代码描述:css实现望远镜悬停动画效果代码

代码标签: 悬停 动画 效果

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


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

<head>

  <meta charset="UTF-8">

  
<style>
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

.binoculars {
  width: 100px;
  height: 100px;
  position: relative;
  will-change: transform;
}
.binoculars .bino--lensBack {
  position: absolute;
  top: 20%;
  left: 20%;
  width: 22%;
  height: 22%;
  border-radius: 50%;
  background: #ffb142;
  transition: all 0.3s ease-in-out;
}
.binoculars .bino--lensBack:nth-child(2) {
  left: 55%;
}
.binoculars .bino--body {
  position: absolute;
  top: 30%;
  left: 5%;
  transform-origin: center;
  transform: skew(-20deg);
  width: 60%;
  height: 40%;
  border-radius: 10px 0 0 5px;
  background: linear-gradient(#8cd0ee, #34ace0);
  transition: all 0.3s ease-in-out;
}
.binoculars .bino--body:nth-child(2n) {
  left: 35%;
  transform: skew(20deg);
  border-radius: 0 10px 5px 0;
}
.binoculars .bino--mid {
  position: absolute;
  top: 55%;
  left: 50%;
  transform: translate(-50%);
  width: 25%;
  height: 25%;
  border-radius: 50%;
  background: #ffb142;
  transition: all 0.3s ease-in-out;
}
.binoculars .bino--lens {
  position: absolute;
  top: 50%;
  left: -2%;
  width: 40%;
  height: 40%;
  border-radius: 50%;
  background: linear-gradient(-45deg, #60bee7, #34ace0);
  transition: all 0.3s ease-in-out;
}
.binoculars .bino--lens:nth-child(2n) {
  left: 62%;
}
.binoculars .bino--lens__lens {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width.........完整代码请登录后点击上方下载按钮下载查看

网友评论0