sadet48
  canvas velocity and gravity 2
 
App

JavaScript Kodu

var canvas = document.querySelector('canvas');
var ctx = canvas.getContext('2d');
var pX = 0,
	pY = 90;
        vx = 5,
	vy = -10;
// setInterval fonksiyon başlama
setInterval(function(){

	ctx.fillStyle= "#000";
	ctx.fillRect(0,0,545,400);
	ctx.fillStyle =  "white";
	gravity=0.34;	
	if(pY > 180){
		vy *= -0.5;
		vx *= -0.5;
		pY = 180;
	}
	if(pX>280){
		vy *= -0.5;
		vx *= -0.5;
		pX = 280;
	}
	ctx.beginPath();
	ctx.fillStyle="white";
	c.rect(pX,pY,20,20);
	ctx.fill();
	pX +=2;
	pY +=2; 
	vy +=gravity; 
}, 30);
 
  Toplam 109695 ziyaretçi
 
 
Bu web sitesi ücretsiz olarak Bedava-Sitem.com ile oluşturulmuştur. Siz de kendi web sitenizi kurmak ister misiniz?
Ücretsiz kaydol