这是一款屏保气泡背景动画,大家都很熟悉的一款WINDOW桌面背景特效,实用。
$.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;
}
}
系统已开启自动识别垃圾评论机制,识别到的自动封号,下载出错或者资源有问题请联系全栈客服QQ 1915635791