最近中文字幕高清中文字幕无,亚洲欧美高清一区二区三区,一本色道无码道dvd在线观看 ,一个人看的www免费高清中文字幕

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

為什么我的小球不會(huì)彈回而直接下落呢

var searchLight = {x:400, y:400, radius:150, vx:Math.random() * 5 + 10, vy:Math.random() * 5 + 10};
?? ??? ??? ?window.onload = function(){
?? ??? ??? ??? ?var canvas = document.getElementById("canvas");
?? ??? ??? ??? ?var context = canvas.getContext("2d");
?? ??? ??? ??? ?setInterval(
?? ??? ??? ??? ??? ?function(){
?? ??? ??? ??? ??? ??? ?draw(context);
?? ??? ??? ??? ??? ??? ?update(canvas.width, canvas.height);
?? ??? ??? ??? ??? ?},40
?? ??? ??? ??? ?);
?? ??? ??? ?}
?? ??? ??? ?function draw (cxt) {
?? ??? ??? ??? ?var canvas = cxt.canvas;
?? ??? ??? ??? ?cxt.clearRect(0, 0, canvas.width, canvas.height);
?? ??? ??? ??? ?
?? ??? ??? ??? ?cxt.save();
?? ??? ??? ??? ?cxt.beginPath();
?? ??? ??? ??? ?cxt.fillStyle = "#000";
?? ??? ??? ??? ?cxt.fillRect(0, 0, canvas.width, canvas.height);
?? ??? ??? ??? ?
?? ??? ??? ??? ?cxt.beginPath();
?? ??? ??? ??? ?cxt.fillStyle = "#FFF";
?? ??? ??? ??? ?cxt.arc(searchLight.x, searchLight.y, searchLight.radius, 0, Math.PI * 2, false);
?? ??? ??? ??? ?cxt.fill();
?? ??? ??? ??? ?cxt.clip();
?? ??? ??? ??? ?
?? ??? ??? ??? ?cxt.font = "bold 150px Arial";
?? ??? ??? ??? ?cxt.textAlign = "center";
?? ??? ??? ??? ?cxt.textBaseline = "middle";
?? ??? ??? ??? ?cxt.fillStyle = "#058";
?? ??? ??? ??? ?cxt.fillText("CANVAS", canvas.width / 2, canvas.height / 4);
?? ??? ??? ??? ?cxt.fillText("CANVAS", canvas.width / 2, canvas.height / 2);
?? ??? ??? ??? ?cxt.fillText("CANVAS", canvas.width / 2, canvas.height * 3 / 4);
?? ??? ??? ??? ?cxt.restore();
?? ??? ??? ?}
?? ??? ??? ?function update (canvasWidth, canvasHeight) {
?? ??? ??? ??? ?searchLight.x += searchLight.vx;
?? ??? ??? ??? ?searchLight.y += searchLight.vy;
?? ??? ??? ??? ?
?? ??? ??? ??? ?if (searchLight.x - searchLight.radius <= 0) {
?? ??? ??? ??? ??? ?searchLight.vx = -searchLight.vx;
?? ??? ??? ??? ??? ?searchLight.x = searchLight.radius;
?? ??? ??? ??? ?}
?? ??? ??? ??? ?
?? ??? ??? ??? ?if (searchLight.x + searchLight.radius >= canvasWidth) {
?? ??? ??? ??? ??? ?searchLight.vx = -searchLight.vx;
?? ??? ??? ??? ??? ?searchLight.x = canvasWidth - canvas.radius;
?? ??? ??? ??? ?}
?? ??? ??? ??? ?
?? ??? ??? ??? ?if (searchLight.y - searchLight.radius <= 0) {
?? ??? ??? ??? ??? ?searchLight.vy = -searchLight.vy;
?? ??? ??? ??? ??? ?searchLight.y = searchLight.radius;
?? ??? ??? ??? ?}
?? ??? ??? ??? ?
?? ??? ??? ??? ?if (searchLight.y + searchLight.radius >= canvasHeight) {
?? ??? ??? ??? ??? ?searchLight.vy = -searchLight.vy;
?? ??? ??? ??? ??? ?searchLight.y = canvasHeight - canvas.radius;
?? ??? ??? ??? ?}
?? ??? ??? ?}



正在回答

1 回答

沒(méi)問(wèn)題了,問(wèn)題解決了......

0 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消

為什么我的小球不會(huì)彈回而直接下落呢

我要回答 關(guān)注問(wèn)題
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)