css+js实现可输入编辑文字渐变填充动画效果代码

代码语言:html

所属分类:其他

代码描述:css+js实现可输入编辑文字渐变填充动画效果代码,可点击输入修改文字。

代码标签: css js 输入 编辑 文字 渐变 填充 动画

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


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

<head>

  <meta charset="UTF-8">

  
  
  
<style>
@font-face {
  font-family: "Mona Sans";
  src: url("//repo.bfw.wiki/bfwrepo/font/Mona-Sans.woff2") format("woff2 supports variations"), url("//repo.bfw.wiki/bfwrepo/font/Mona-Sans.woff2") format("woff2-variations");
  font-weight: 100 1000;
}
@property --bg-1-x {
  syntax: "<number>";
  inherits: true;
  initial-value: 0;
}
@property --bg-2-x {
  syntax: "<number>";
  inherits: true;
  initial-value: 0;
}
@property --bg-2-y {
  syntax: "<number>";
  inherits: true;
  initial-value: 0;
}
@property --bg-3-x {
  syntax: "<number>";
  inherits: true;
  initial-value: 0;
}
@property --bg-3-y {
  syntax: "<number>";
  inherits: true;
  initial-value: 0;
}
:root {
  --bg-color: hsl(240deg 10% 12%);

  --bg-grain: url("data:image/svg+xml,%3Csvg viewBox='0 0 600 600' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
  --shadow-size: max(140px, 40vw);
  --shadow-size-fallback: 40vw;
  --shadow-blur: 60;
  --color-1: #6328da;
  --color-2: #ff1bf1;
  --color-3: #008cea;
  --bg-1-x: 0;
  --bg-1-y: 0;
  --bg-2-x: 0;
  --bg-2-y: 0;
  --bg-3-x: 0;
  --bg-3-y: 0;
}

@supports (color: color(display-p3 1 1 1)) {
  :root {
    --color-1: color(display-p3 0.36 0.17 0.82);
    --color-2: color(display-p3 0.95 0.04 0.95);
    --color-3: color(display-p3 0.01 0.53 0.99);
  }
}
@media (min-width: 960px) {
  :root {
    --shadow-size: max(72px, 25vw);
    --shadow-size-fallback: 25vw;
    --shadow-blur: 80;
  }
}
* {
  box-sizing: border-box;
  outline: calc(var(--debug) * 1px) dashed red;
}
*:before, *:after {
  outline: calc(var(--debug) * 1px) dashed red;
}

html,
body {
  width: 100%;
  height: 100%;
  padding: 0;
  margin: 0;
}

body {
  font-family: "Mona Sans", sans-serif;
  display: grid;
  grid-template-columns: repeat(1, 1fr);
  background: var(--bg-color);
  z-index: 1;
  position: relative;
}
body:before {
  content: "";
  position: absolute;
  display: block;
  width: 100%;
  height: 100%;
  z-index: 1;
  background: radial-gradient(circle var(--shadow-size, var(--shadow-size-fallback)) at 20vw 0, var(--color-1, red) 100%, transparent 0), radial-gradient(circle var(--shadow-size, var(--shadow-size-fallback)) at 100vw 0, var(--color-2, red) 100%, transparent 0), radial-gradient(circle calc(var(--shadow-size, var(--shadow-size-fallback)) * 1.2) at 50vw 115vh, var(--color-3, red) 100%, transparent 0);
  top: 0;
  left: 0;
  opacity: 0.5;
  filter: blur(calc(var(--shadow-blur) * 1px));
  mix-blend-mode: hue;
}
body:after {
  content: "";
  display: block;
  width: 100%;
  height: 100%;
  position: absolute;
  z-index: -1;
  top: 0;
  left: 0;
  filter: contrast(145%) brightness(650%) invert(100%);
  mix-blend-mode: screen;
  background: var(--bg-grain);
  background-size: 500px;
}

main {
  width: 100%;
  height: 100%;
  position: absolute;
 .........完整代码请登录后点击上方下载按钮下载查看

网友评论0