svg+gsap实现mac电脑波纹背景效果代码

代码语言:html

所属分类:背景

代码描述:svg+gsap实现mac电脑波纹背景效果代码

代码标签: 电脑 波纹 背景 效果

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


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

<head>

  <meta charset="UTF-8">
  

  <meta name="viewport" content="width=device-width, initial-scale=1">
  
  
  
<style>
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1rem;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
  color: hsl(0, 0%, 10%);
  background: hsl(0, 0%, 100%);
}

.canvas-wrapper {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.canvas {
  width: 100vw;
  height: 100vh;
}

.controls {
  position: relative;
  display: grid;
  grid-gap: 1rem;
  grid-template-columns: 1fr;
  width: 100%;
  max-width: 24rem;
  padding: 1rem;
  background: hsla(0, 0%, 100%, 0.25);
  z-index: 1;
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-radius: 0.5rem;
  border: 1px solid hsla(0, 0%, 100%, 0.25);
  opacity: 0;
}

.controls p {
  grid-column: -1 / 1;
  font-style: italic;
  text-align: center;
  font-size: 0.75rem;
}

button {
  width: 100%;
  height: 2.25rem;
  border: 0;
  font-weight: 500;
  font-family: inherit;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  line-height: 2.25rem;
  background: hsla(0, 0%, 100%, 0.25);
  cursor: pointer;
}

button:nth-of-type(1) {
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  display: none;
}

button:nth-of-type(2) {
  background: linear-gradient(to bottom, #287cfe, #0466ff);
  color: #fff;
}

@media only screen and (min-width: 640px) {
  .controls {
    grid-template-columns: 1fr 1fr;
  }

  .controls p {
    display: none;
  }

  .controls button:nth-of-type(1) {
    display: block;
  }
}
</style>

 

</head>

<body  >
  <div class="canvas-wrapper">
  <svg class="canvas" viewBox="0 0 1920 1080" preserveAspectRatio="xMaxYMid slice"></svg>
</div>
<div class="controls">
  <p>* Export is disabled for mobile devices</p>
  <button class="download">Copy SVG</button>
  <button class="regenerate">Regenerate</button>
</div>
  
  
      <script type="module">
console.clear();

import { SVG } from "https://cdn.skypack.dev/@svgdotjs/svg.js";
import {
  random,
  map,
  spline,
  pointsInPath
} from "https://cdn.skypack.dev/@georgedoescode/generative-utils@1.0.0";
import tinycolor from "https://cdn.skypack.dev/tinycolor2@1.4.2";
import "https://cdn.skypack.dev/@svgdotjs/svg.filter.js";
import copy from "htt.........完整代码请登录后点击上方下载按钮下载查看

网友评论0