課程
/前端開發(fā)
/Html5
/炫麗的倒計時效果Canvas繪圖與動畫基礎
看老師的視頻最后小球就不再跳動了,求思路
2015-01-06
源自:炫麗的倒計時效果Canvas繪圖與動畫基礎 5-8
正在回答
個人測試是這樣的 ?
if(ball.y ?> cxt.canvas.height- ball.r){
? ? ? ? ? ? ? ? ? ? ball.y = cxt.canvas.height - ball.r
? ? ? ? ? ? ? ? ? ?// ball.vy = -ball.vy * Math.random();
? ? ? ? ? ? ? ? ? ? ball.vy = -ball.vy * 0.5;
? ? ? ? ? ? ? ? ? ? //ball.g = 0;
? ? ? ? ? ? ? ? }else if(ball.y ?== cxt.canvas.height- ball.r){
? ? ? ? ? ? ? ? ? ? ball.y = cxt.canvas.height - ball.r;
? ? ? ? ? ? ? ? ? ? ball.vy = 0;
? ? ? ? ? ? ? ? }
遠丶揚
那時候只有x軸有速度,y軸的速度為零了。但是如何判斷當前小球已經到底部了,不再跳起來,我正在考慮
舉報
學習HTML5中最激動人心的技術Canvas,徹底釋放自己的創(chuàng)造力
1 回答小球在前面跳。。。。
3 回答小球跳動的問題
1 回答在給數(shù)字繪制小球時,小球的位置如何確定
5 回答關于小球無限彈跳
1 回答多個小球跳動的問題。
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網安備11010802030151號
購課補貼聯(lián)系客服咨詢優(yōu)惠詳情
慕課網APP您的移動學習伙伴
掃描二維碼關注慕課網微信公眾號
2015-03-18
個人測試是這樣的 ?
if(ball.y ?> cxt.canvas.height- ball.r){
? ? ? ? ? ? ? ? ? ? ball.y = cxt.canvas.height - ball.r
? ? ? ? ? ? ? ? ? ?// ball.vy = -ball.vy * Math.random();
? ? ? ? ? ? ? ? ? ? ball.vy = -ball.vy * 0.5;
? ? ? ? ? ? ? ? ? ? //ball.g = 0;
? ? ? ? ? ? ? ? }else if(ball.y ?== cxt.canvas.height- ball.r){
? ? ? ? ? ? ? ? ? ? ball.y = cxt.canvas.height - ball.r;
? ? ? ? ? ? ? ? ? ? ball.vy = 0;
? ? ? ? ? ? ? ? }
2015-03-18
那時候只有x軸有速度,y軸的速度為零了。但是如何判斷當前小球已經到底部了,不再跳起來,我正在考慮