Giter VIP home page Giter VIP logo

canvasparticles's Introduction

CanvasParticles

html5 canvas 实现网页背景粒子效果

##1.引入js文件

<script type="text/javascript" src="canvas-particle.js"></script>

##2.配置 配置,调用CanvasParticle函数,传入配置参数即可,如果不配置则用默认配置
在你的js文件中加上如下配置

window.onload = function(){
	//配置
	var config = {
		vx: 4,//点x轴速度,正为右,负为左
		vy:  4,//点y轴速度
		height: 2,//点高宽,其实为正方形,所以不宜太大
		width: 2,
		count: 100,//点个数
		color: "121, 162, 185",//点颜色
		stroke: "130,255,255",//线条颜色
		dist: 6000,//点吸附距离
		e_dist: 20000,//鼠标吸附加速距离
		max_conn: 10//点到点最大连接数
	}
	//调用
	CanvasParticle(config);
}

##效果图 可以将js文件放入Tampermonkey作为脚本执行,看百度首页的效果图如下
效果图

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.