这是我发现的公式:
r = v - [2 (n · v) n]
我是这样申请的
//Calculating normal
nx = 350 - SmileyReds[i].xpos ;
ny = 350 - SmileyReds[i].ypos ;
//new calc
v_newx = SmileyReds[i].xspeed - (2 *( nx * SmileyReds[i].xspeed + ny * SmileyReds[i].yspeed ) ) * nx;
v_newy = SmileyReds[i].yspeed - (2 *( nx * SmileyReds[i].xspeed + ny * SmileyReds[i].yspeed ) ) * ny;
SmileyReds[i].xspeed = v_newx;
SmileyReds[i].yspeed = v_newy;
但球没有弹跳,而是在它们击中边界时消失:
完整的 src 和预览http://jsfiddle.net/gj4Q7/4/
感谢您的宝贵时间,欢迎任何提示!