动态背景 vanta.js

动态背景 vanta.js

vanta.js 可以为网站设置炫酷的动态背景 比如在网站登陆的首页

但是不直接支持 vue3 , 但是呢 ,也不是不可以添加

https://www.vantajs.com/

1. 展示

image-20220516230044977

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

image-20220517084336053

2. 使用

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <!--取消了body的边距-->
    <link href="https://cdn.bootcdn.net/ajax/libs/normalize/8.0.1/normalize.css" rel="stylesheet">
    <style>
        /*最后展示区域的大小取决于绑定元素的面积*/
        #my-background {
      
      
            overflow: hidden;
            width: 100vw;
            height: 100vh;
        }
    </style>
</head>
<body>
<div id="my-background">123</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r121/three.min.js"></script>
<script src="https://cdn.bootcdn.net/ajax/libs/vanta/0.5.22/vanta.birds.min.js"></script>
<script>
    VANTA.BIRDS({
      
      
        el: "#my-background",
        mouseControls: true,
        touchControls: true,
        gyroControls: false,
        minHeight: 200.00,
        minWidth: 200.00,
        scale: 1.00,
        scaleMobile: 1.00,
        backgroundColor: 0x191e20,
        color1: 0x7914b1,
        color2: 0xfc1eb,
        birdSize: 2.40,
        wingSpan: 25.00,
        speedLimit: 6.00,
        separation: 56.00,
        alignment: 44.00,
        cohesion: 39.00,
        quantity: 2.00
    })
</script>
</body>
</html>

image-20220517084122725

猜你喜欢

转载自blog.csdn.net/ximing020714/article/details/124813506