canvas仿windows屏保气泡背景动画

来源:https://www.sucaihuo.com/js/1669.html 2017-04-08 23:47浏览(2076) 收藏

这是一款屏保气泡背景动画,大家都很熟悉的一款WINDOW桌面背景特效,实用。
canvas仿windows屏保气泡背景动画
分类:html5 > canvas 难易:初级
查看演示 下载资源 下载积分: 20 积分
$.Math.impactDetection = (obj) => {
			let border_top = 0,
			border_left = 0,
			border_right = $.canvas.width,
			border_bottom = $.canvas.height;
			let reduce =  - $.config.lose

			for (let i = 0; i < $.asteroids.length; i++) {
				let tag = $.asteroids[i];
				if (tag.name == obj.name)
					continue;
				let dx = Math.pow(obj.x - tag.x, 2);
				let dy = Math.pow(obj.y - tag.y, 2);
				let d = Math.pow(obj.radius + tag.radius, 2);
				if ($.Math.distance(obj, tag) <= 0.1) {
					obj.vX = obj.vX * reduce;
					obj.vY = obj.vY * reduce;
					if (obj.x - tag.x > 0) {
						obj.x = Math.abs(Math.sqrt(d - dy) + tag.x) + 2;
					} else {
						obj.x = tag.x - Math.abs(Math.sqrt(d - dy)) - 2;
					}

					tag.vX = tag.vX * reduce;
					tag.vY = tag.vY * reduce;
				}
			}
标签: 动画屏保
评论0
头像

系统已开启自动识别垃圾评论机制,识别到的自动封号,下载出错或者资源有问题请联系全栈客服QQ 1915635791

1 2