js+css实现宇宙之眼动画效果代码

代码语言:html

所属分类:动画

代码描述:js+css实现宇宙之眼动画效果代码

代码标签: js css 宇宙 之眼 动画

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

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

<head>
  <meta charset="UTF-8">
  
  
  
<style>
body,
.scene,
.box,
.chart,
.lines,
.line,
.cover,
.eye,
.tracker,
.scale,
.sun,
.rays,
.ray {
  position: absolute;
  transform-style: preserve-3d;
}

.scene,
.box,
.chart,
.lines,
.line,
.cover,
.eye,
.tracker,
.scale,
.sun,
.rays,
.ray {
  display: flex;
  align-items: center;
  justify-content: center;
}

body,
.scene {
  display: grid;
  place-self: center;
}
body > *,
.scene > * {
  place-self: center;
}

:root {
  --perspective: 400vmin;
}

*,
*::after,
*::before {
  margin: 0;
  border: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  perspective: var(--perspective);
  background: var(--background, #000);
}

@media screen and (orientation: portrait) {
  .themes {
    --test: portrait;
  }
}
@media screen and (orientation: landscape) {
  .themes {
    --test: landscape;
  }
}
.themes.horizontal {
  width: 100vw;
}
.themes.vertical {
  height: 100vh;
}
.themes-trigger, .themes-menu {
  position: absolute;
}
.themes-trigger, .themes-select {
  height: 48px;
  width: 48px;
  -webkit-appearance: none;
     -moz-appearance: none;
          appearance: none;
  border-radius: 50%;
  cursor: pointer;
}
.themes-menu {
  display: flex;
  overflow: hidden;
  will-change: transform;
  transition: transform 0.5s ease-in-out;
  /* width */
  /* Track */
  /* Handle */
  /* Handle on hover */
}
.themes-menu::-webkit-scrollbar-track {
  background: transparent;
}
.themes-menu::-webkit-scrollbar-thumb {
  background: var(--stroke, gray);
  border-radius: 10px;
}
.themes-menu::-webkit-scrollbar-thumb:hover {
  background: var(--hover, darkgray);
}
.themes.horizontal .themes-menu {
  flex-wrap: nowrap;
  overflow-x: scroll;
  height: 78px;
  width: calc(100% - 48px - 20px);
  bottom: -78px;
  /* width */
}
.themes.horizontal .themes-menu::-webkit-scrollbar {
  height: 10px;
}
.themes.vertical .themes-menu {
  flex-wrap: wrap;
  overflow-y: scroll;
  height: calc(100% - 48px - 20px);
  width: 78px;
  right: -78px;
  /* width */
}
.themes.vertical .themes-menu::-webkit-scrollbar {
  width: 10px;
}
.themes-select {
  flex: 0 0 48px;
  border: 2.5px solid var(--stroke);
  background: linear-gradient(var(--background) 0% 25%, var(--stroke) 25% 50%, var(--fill) 50% 75%, var(--hover) 75% 100%);
}
.themes.horizontal .themes-select {
  margin: 10px 5px;
}
.themes.vertical .themes-select {
  margin: 5px 10px;
}
.themes-trigger {
  right: 20px;
  bottom: 10px;
  background: conic-gradient(red, orange, yellow, green, blue, indigo, violet, red);
}
.themes-trigger, .themes-trigger::after {
  display: flex;
  justify-content: center;
  align-items: center;
}
.themes-trigger::after {
  content: "X";
  opacity: 0;
  border-radius: 50%;
  height: 48px;
  width: 48px;
  font-size: 32px;
  font-weight: bold;
  color: #000;
  transition: 0.35s ease-in-out;
  transition-property: opacity, color;
}
.themes-trigger:hover::after {
  color: #fff;
}
.themes-trigger:checked::after {
  opacity: 1;
}
.themes.horizontal .themes-trigger {
  right: 10px;
  bottom: 20px;
}
.themes.horizontal .themes-trigger:checked + .themes-menu {
  transform: translatey(-78px);
}
.themes.vertical .themes-trigger {
  right: 20px;
  bottom: 10px;
}
.themes.vertical .themes-trigger:checked + .themes-menu {
  transform: translatex(-78px);
}

:root {
  --length: 50;
}

.scene,
.box,
.chart,
.lines,
.line,
.cover,
.eye,
.tracker,
.scale,
.sun,
.rays,
.ray {
  position: absolute;
}

.box {
  width: 90vmin;
  height: 90vmin;
  pointer-events: all;
  transition: transform 1s ease-in-out;
}
.box * {
  pointer-events: none;
}
.box .tracker,
.box .scale {
  transition: transform 0.15s linear;
}
.box:hover .lines {
  background: var(--ho.........完整代码请登录后点击上方下载按钮下载查看

网友评论0