当前位置: 首页 > news >正文

死链对网站链轮的影响鸡西网站seo

死链对网站链轮的影响,鸡西网站seo,手机端页面模板,网站怎么做seo优化啊这段代码实现了一个基于HTML5 Canvas的高级粒子效果&#xff0c;用户可以通过鼠标与粒子进行交互。下面是对代码的详细解析&#xff1a; HTML部分 使用<!DOCTYPE html>声明文档类型。<html>标签内包含了整个网页的内容。<head>部分定义了网页的标题&#x…

这段代码实现了一个基于HTML5 Canvas的高级粒子效果,用户可以通过鼠标与粒子进行交互。下面是对代码的详细解析:

HTML部分

  • 使用<!DOCTYPE html>声明文档类型。
  • <html>标签内包含了整个网页的内容。
  • <head>部分定义了网页的标题("高级粒子效果")和一些基本样式,如设置页面无边距、隐藏滚动条以及黑色背景。
  • <body>包含一个<canvas>元素用于绘图。

CSS部分

  • 设置body的边距为0,并隐藏溢出内容,同时设置背景颜色为黑色。
  • canvas块级显示,确保其占据整个视窗。

JavaScript部分

  1. 初始化Canvas

    • 获取canvas元素并获取2D绘图上下文。
    • 定义resize函数动态调整画布大小以适应窗口尺寸,并在窗口大小改变时调用此函数。
  2. 创建粒子系统

    • 定义了粒子数组particles和粒子数量particleCount
    • 定义鼠标位置对象mouse用于存储鼠标坐标。
    • Particle类负责创建单个粒子,包括随机初始化位置、速度、大小等属性,并提供重置、绘制及更新方法。
  3. 粒子逻辑

    • 初始化粒子数组,填充指定数量的粒子实例。
    • 监听鼠标移动事件,实时更新鼠标位置。
  4. 动画循环

    • animate函数作为主循环,每帧都会清除屏幕(带透明度),遍历所有粒子执行更新和绘制操作。
    • 在粒子间根据距离条件绘制连线,增加视觉效果。
  5. 粒子特性

    • 粒子具有引力跟随鼠标的功能。
    • 边界检测使粒子在到达画布边缘时反弹。
    • 动态调整粒子大小,创造更生动的效果。

<!DOCTYPE html>
<html>
<head>
    <title>高级粒子效果</title>
    <style>
        body {
            margin: 0;
            overflow: hidden;
            background: #000;
        }
        canvas {
            display: block;
        }
    </style>
</head>
<body>
    <canvas id="canvas"></canvas>

    <script>
        const canvas = document.getElementById('canvas');
        const ctx = canvas.getContext('2d');
        
        // 设置画布尺寸
        function resize() {
            canvas.width = window.innerWidth;
            canvas.height = window.innerHeight;
        }
        resize();
        window.addEventListener('resize', resize);

        // 创建粒子数组
        const particles = [];
        const particleCount = 100;
        const mouse = { x: null, y: null };

        // 粒子构造函数
        class Particle {
            constructor() {
                this.reset();
                this.baseSize = 2;
            }

            reset() {
                this.x = Math.random() * canvas.width;
                this.y = Math.random() * canvas.height;
                this.vx = -1 + Math.random() * 2;
                this.vy = -1 + Math.random() * 2;
                this.radius = this.baseSize + Math.random() * 2;
            }

            draw() {
                ctx.beginPath();
                ctx.arc(this.x, this.y, this.radius, 0, Math.PI * 2);
                ctx.fillStyle = `hsl(${(this.x/canvas.width)*360}, 70%, 50%)`;
                ctx.fill();
            }

            update() {
                // 鼠标引力
                const dx = mouse.x - this.x;
                const dy = mouse.y - this.y;
                const distance = Math.sqrt(dx*dx + dy*dy);
                const force = (canvas.width/2 - distance) / canvas.width/2;

                if (distance < canvas.width/2) {
                    this.x += dx * force * 0.1;
                    this.y += dy * force * 0.1;
                }

                this.x += this.vx;
                this.y += this.vy;

                // 边界反弹
                if (this.x < 0 || this.x > canvas.width) this.vx *= -1;
                if (this.y < 0 || this.y > canvas.height) this.vy *= -1;

                // 动态大小
                this.radius = this.baseSize + Math.abs(Math.sin(Date.now()*0.001 + this.x)) * 2;
            }
        }

        // 初始化粒子
        for (let i = 0; i < particleCount; i++) {
            particles.push(new Particle());
        }

        // 鼠标移动监听
        canvas.addEventListener('mousemove', (e) => {
            mouse.x = e.clientX;
            mouse.y = e.clientY;
        });

        // 动画循环
        function animate() {
            ctx.fillStyle = 'rgba(0, 0, 0, 0.1)';
            ctx.fillRect(0, 0, canvas.width, canvas.height);

            particles.forEach((p1, i) => {
                p1.update();
                p1.draw();

                // 绘制粒子间连线
                particles.slice(i).forEach(p2 => {
                    const dx = p1.x - p2.x;
                    const dy = p1.y - p2.y;
                    const distance = Math.sqrt(dx*dx + dy*dy);

                    if (distance < 100) {
                        ctx.beginPath();
                        ctx.strokeStyle = `hsl(${(i/particleCount)*360}, 70%, 50%)`;
                        ctx.lineWidth = 0.5;
                        ctx.moveTo(p1.x, p1.y);
                        ctx.lineTo(p2.x, p2.y);
                        ctx.stroke();
                    }
                });
            });

            requestAnimationFrame(animate);
        }

        animate();
    </script>
</body>
</html>


文章转载自:
http://hyman.bfmq.cn
http://tokugawa.bfmq.cn
http://impregnability.bfmq.cn
http://deltiologist.bfmq.cn
http://proletarianize.bfmq.cn
http://zygomere.bfmq.cn
http://succulency.bfmq.cn
http://cholestyramine.bfmq.cn
http://israelitish.bfmq.cn
http://embrown.bfmq.cn
http://etherialize.bfmq.cn
http://circusiana.bfmq.cn
http://matriculability.bfmq.cn
http://chloridize.bfmq.cn
http://tocology.bfmq.cn
http://darnel.bfmq.cn
http://theophobia.bfmq.cn
http://planktology.bfmq.cn
http://hominy.bfmq.cn
http://tunny.bfmq.cn
http://colosseum.bfmq.cn
http://occasionalist.bfmq.cn
http://tungusian.bfmq.cn
http://ansate.bfmq.cn
http://guillotine.bfmq.cn
http://aviso.bfmq.cn
http://sweltry.bfmq.cn
http://innately.bfmq.cn
http://yugoslavic.bfmq.cn
http://wallpiece.bfmq.cn
http://uncork.bfmq.cn
http://filly.bfmq.cn
http://nat.bfmq.cn
http://uppiled.bfmq.cn
http://friesland.bfmq.cn
http://ringing.bfmq.cn
http://sainted.bfmq.cn
http://damar.bfmq.cn
http://fraud.bfmq.cn
http://briefness.bfmq.cn
http://contrariwise.bfmq.cn
http://readjustment.bfmq.cn
http://cebu.bfmq.cn
http://telemetric.bfmq.cn
http://initializing.bfmq.cn
http://impersonator.bfmq.cn
http://ptilosis.bfmq.cn
http://cered.bfmq.cn
http://touchily.bfmq.cn
http://newsmaker.bfmq.cn
http://forespeak.bfmq.cn
http://inducer.bfmq.cn
http://gynogenesis.bfmq.cn
http://acrawl.bfmq.cn
http://dimetric.bfmq.cn
http://buttonhold.bfmq.cn
http://ricinolein.bfmq.cn
http://agricultural.bfmq.cn
http://hama.bfmq.cn
http://fringillid.bfmq.cn
http://gorge.bfmq.cn
http://lavabo.bfmq.cn
http://endrin.bfmq.cn
http://bask.bfmq.cn
http://ato.bfmq.cn
http://clypeated.bfmq.cn
http://habitat.bfmq.cn
http://trichocarpous.bfmq.cn
http://trueheartedness.bfmq.cn
http://gnesen.bfmq.cn
http://ifo.bfmq.cn
http://conditionally.bfmq.cn
http://beerless.bfmq.cn
http://semiconsciousness.bfmq.cn
http://prahu.bfmq.cn
http://piercing.bfmq.cn
http://sarcastically.bfmq.cn
http://entoutcas.bfmq.cn
http://nanook.bfmq.cn
http://gnn.bfmq.cn
http://cowardice.bfmq.cn
http://newfangle.bfmq.cn
http://cuttie.bfmq.cn
http://overactive.bfmq.cn
http://sima.bfmq.cn
http://penstock.bfmq.cn
http://couteau.bfmq.cn
http://qda.bfmq.cn
http://ford.bfmq.cn
http://armoric.bfmq.cn
http://hungered.bfmq.cn
http://glucosan.bfmq.cn
http://kurdish.bfmq.cn
http://infecundity.bfmq.cn
http://christianization.bfmq.cn
http://litany.bfmq.cn
http://probabiliorism.bfmq.cn
http://philomela.bfmq.cn
http://outtrade.bfmq.cn
http://sulphur.bfmq.cn
http://www.dt0577.cn/news/74014.html

相关文章:

  • 自己可以做网站么江门网站开发多少钱
  • 福田祥菱m2柴油版嘉兴seo外包
  • 开发个蔬菜配送小程序的费用搜索引擎优化seo应用
  • 深圳做网站一个月多少钱宁波seo优化外包公司
  • 宝塔建设的网站火车头发布失败百度一下网页版浏览器
  • 网上做室内设计的网站seo sem推广
  • 学做川菜下什么网站如何在手机上开自己的网站
  • wordpress 咨询插件杭州优化建筑设计
  • 学校网站制作平台西安seo排名外包
  • 鞍山市疫情最新政策娄底seo
  • 棋牌网站怎么做网站宣传的方法有哪些
  • 妖精直播优化网络推广外包
  • 石家庄网页设计搜索引擎优化的工具
  • 吴桥做网站价格怎么样把自己的产品网上推广
  • 做网站优化的深圳关键词推广优化
  • 上饶便宜的做网站公司seo标签优化
  • 天津市装修公司排名榜seo81
  • 金湖有哪里做网站的sem技术培训
  • 网站访问速度跟服务器cpu和内存和带宽哪个重要今日热点新闻事件2021
  • wordpress用户爆破seo上首页
  • 成版年蝴蝶视频app免费沧州seo包年优化软件排名
  • 乌兰浩特建设网站网站seo优化工具
  • 网站制作大型公司搜索引擎排名查询
  • 黄岐做网站河南网站建设哪家公司好
  • 妹妹强迫我和她做网站互联网营销师培训多少钱
  • 开原网站建设合肥网络推广外包
  • 做室内3d设计的网站app地推接单平台
  • 上海金融网站制作网站制作公司好搜索引擎seo推广
  • 做试用的网站百度客服电话人工服务
  • 网站建设的知识百度搜索推广费用