霓虹灯闪烁特效

公司15周年庆典 不想再站一排呆呆的念台词 做了个小效果在这里插入图片描述
上代码把
纯css样式 控制 复制就能跑

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>CSS3霓虹灯文字闪烁特效</title>

<style>
@import url("https://fonts.googleapis.com/css?family=Poppins:900&display=swap");
html,
body {
  background-color: black;
  
  margin: 5rem 6rem;
  text-align: center;
  font-family: 'Poppins', 'sans-serif';
  
}
/* 文字的盒子的淡出效果 */
.aaa{
-webkit-animation-name: fadeIn; /*动画名称*/
-webkit-animation-duration: 3s; /*动画持续时间*/
-webkit-animation-iteration-count: 1; /*动画次数*/
-webkit-animation-delay: 0s; /*延迟时间*/
}

@-webkit-keyframes fadeIn {
0% {
opacity: 0; /*初始状态 透明度为0*/
}
50% {
opacity: 0; /*中间状态 透明度为0*/
}
100% {
opacity: 1; /*结尾状态 透明度为1*/
}
}

h1, h2 {
  margin: 0;
  padding: 0;
  color: white;
  display: inline-block;
  font-size: 10rem;
  text-shadow: 0 0 10px #fff, 0 0 20px #fff, 0 0 30px #e60073, 0 0 40px #e60073, 0 0 50px #e60073, 0 0 60px #e60073, 0 0 70px #e60073;
}

h2 {
  font-size: 8rem;
}

h1:nth-child(0n + 0), h2:nth-child(5n + 0) {
  -webkit-animation-name: animateGlithcy;
          animation-name: animateGlithcy;
  -webkit-animation-delay: 0s;
          animation-delay: 0s;
  -webkit-animation-duration: 0s;
          animation-duration: 0s;
  -webkit-animation-timing-function: linear;
          animation-timing-function: linear;
  animation-direction: alternate-reverse;
  -webkit-animation-iteration-count: infinite;
          animation-iteration-count: infinite;
}

h1:nth-child(0n + 1), h2:nth-child(5n + 1) {
  -webkit-animation-name: animateGlithcy;
          animation-name: animateGlithcy;
  -webkit-animation-delay: 0.2s;
          animation-delay: 0.2s;
  -webkit-animation-duration: 0.5s;
          animation-duration: 0.5s;
  -webkit-animation-timing-function: linear;
          animation-timing-function: linear;
  animation-direction: alternate-reverse;
  -webkit-animation-iteration-count: infinite;
          animation-iteration-count: infinite;
}

h1:nth-child(0n + 2), h2:nth-child(5n + 2) {
  -webkit-animation-name: animateGlithcy;
          animation-name: animateGlithcy;
  -webkit-animation-delay: 0.4s;
          animation-delay: 0.4s;
  -webkit-animation-duration: 1s;
          animation-duration: 1s;
  -webkit-animation-timing-function: linear;
          animation-timing-function: linear;
  animation-direction: alternate-reverse;
  -webkit-animation-iteration-count: infinite;
          animation-iteration-count: infinite;
}

h1:nth-child(0n + 3), h2:nth-child(5n + 3) {
  -webkit-animation-name: animateGlithcy;
          animation-name: animateGlithcy;
  -webkit-animation-delay: 0.6s;
          animation-delay: 0.6s;
  -webkit-animation-duration: 1.5s;
          animation-duration: 1.5s;
  -webkit-animation-timing-function: linear;
          animation-timing-function: linear;
  animation-direction: alternate-reverse;
  -webkit-animation-iteration-count: infinite;
          animation-iteration-count: infinite;
}

h1:nth-child(0n + 4), h2:nth-child(5n + 4) {
  -webkit-animation-name: animateGlithcy;
          animation-name: animateGlithcy;
  -webkit-animation-delay: 0.8s;
          animation-delay: 0.8s;
  -webkit-animation-duration: 2s;
          animation-duration: 2s;
  -webkit-animation-timing-function: linear;
          animation-timing-function: linear;
  animation-direction: alternate-reverse;
  -webkit-animation-iteration-count: infinite;
          animation-iteration-count: infinite;
}

h1:nth-child(0n + 5), h2:nth-child(5n + 5) {
  -webkit-animation-name: animateGlithcy;
          animation-name: animateGlithcy;
  -webkit-animation-delay: 1s;
          animation-delay: 1s;
  -webkit-animation-duration: 2.5s;
          animation-duration: 2.5s;
  -webkit-animation-timing-function: linear;
          animation-timing-function: linear;
  animation-direction: alternate-reverse;
  -webkit-animation-iteration-count: infinite;
          animation-iteration-count: infinite;
}

@-webkit-keyframes animateGlithcy {
  0% {
    opacity: .1;
    background-position: 0 0;
    -webkit-filter: hue-rotate(0deg);
            filter: hue-rotate(0deg);
  }
  10% {
    background-position: 5px 0;
  }
  20% {
    background-position: -5px 0;
  }
  30% {
    background-position: 15px 0;
  }
  40% {
    background-position: -5px 0;
  }
  50% {
    background-position: -25px 0;
  }
  60% {
    background-position: -50px 0;
  }
  70% {
    background-position: 0 -20px;
  }
  80% {
    background-position: -60px -20px;
  }
  81% {
    background-position: 0 0;
  }
  100% {
    opacity: 1;
    background-position: 0 0;
    -webkit-filter: hue-rotate(360deg);
            filter: hue-rotate(360deg);
  }
}

@keyframes animateGlithcy {
  0% {
    opacity: .1;
    background-position: 0 0;
    -webkit-filter: hue-rotate(0deg);
            filter: hue-rotate(0deg);
  }
  10% {
    background-position: 5px 0;
  }
  20% {
    background-position: -5px 0;
  }
  30% {
    background-position: 15px 0;
  }
  40% {
    background-position: -5px 0;
  }
  50% {
    background-position: -25px 0;
  }
  60% {
    background-position: -50px 0;
  }
  70% {
    background-position: 0 -20px;
  }
  80% {
    background-position: -60px -20px;
  }
  81% {
    background-position: 0 0;
  }
  100% {
    opacity: 1;
    background-position: 0 0;
    -webkit-filter: hue-rotate(360deg);
            filter: hue-rotate(360deg);
  }
}
</style>

</head>
<body>
<div class="aaa">
   <h1>庆</h1>
   <h1>x</h1>
   <h1>x</h1>
   <br/>
   <h2>15</h2>
   <h2>周</h2>
   <h2>年</h2>
   <h2>快</h2>
   <h2>乐</h2>
</div>
</body>
</html>

单独这一个觉的有些单调 又加入了隧道跳转
在这里插入图片描述
计算好时间节点 隧道–>霓虹灯这样
隧道的代码量很大
html 两个js 一个css

<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<title>CodePen - Three.js Tube</title>

<link rel="stylesheet" href="css/style.css">

</head>
<body>
   
<script src='js/three.min.js'></script>
<script src="js/script.js"></script>
<script src="../jquery.min.js"></script>
<script>
    // setTimeout("window.location.href='../jiaoben7579/index.html'",5000)
</script>
</body>
</html>

css

body {
  margin: 0;
  overflow: hidden;
}

script.js

window.addEventListener("load", init);

function init() {
    // 幅と高さを指定
    const width = window.innerWidth;
    const height = window.innerHeight;

    // レンダラーを作成
    const renderer = new THREE.WebGLRenderer();
    document.body.appendChild(renderer.domElement);
  
    // シーンを作成
    const scene = new THREE.Scene();

    // カメラを作成
    const camera = new THREE.PerspectiveCamera(45, width / height, 0.1, 1000);
    camera.position.z = 500;

    // ポイントを作成
    const points = [
      [60,180], [120,240], [180,300], [280,180], [180,120], [60,60], [60,180]
    ];
    for (let i = 0; i < points.length; i++) {
      const x = points[i][0];
      const y = points[i][0];
      const z = points[i][1];
      points[i] = new THREE.Vector3(x, y, z);
    }
    
    // パスを作成
    const path = new THREE.CatmullRomCurve3(points);

    // ジオメトリを作成
    const geometry = new THREE.TubeGeometry(path, 100, 10, 10, true);

    // マテリアルを作成
    const material = new THREE.MeshLambertMaterial({
      color: 0x64E5E8,
      wireframe: true
    });

    // メッシュを作成
    const mesh = new THREE.Mesh(geometry, material);
    const ambient = new THREE.AmbientLight();
    scene.add(mesh, ambient);

    let percentage = 0;
    function render() {
      percentage += 0.00100;
      const p1 = path.getPointAt(percentage % 1);
      const p2 = path.getPointAt((percentage + 0.01) % 1);
      camera.position.set(p1.x, p1.y, p1.z);
      camera.lookAt(p2);
      renderer.render(scene, camera);
      requestAnimationFrame(render);
    }

    render();
  
    window.addEventListener("resize", onResize);
  
    // リサイズ処理
    function onResize() {
      renderer.setPixelRatio(window.devicePixelRatio);
      renderer.setSize(width, height);
      camera.aspect = width / height;
      camera.updateProjectionMatrix();
    }

    onResize();
}

three.min.js

这个js太大  去网上搜一下吧  作者放不上来
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值