Ich hoffe mal du, Ali, findest es nicht ;)
<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1"/>
</head>
<body>
<canvas onkeydown="key()" onkeyup="keyup()" width="500" height="500" id="x"></canvas>
<script>
var chat=0, chatmessage, shift=0;
document.onkeydown = function(e) {
e=e.keyCode;
}
document.onkeyup = function(e) {
}
var c = document.getElementById("x");
var canvOK = 1, players=new Array();
var mx=0,my=0,t=0,bgR=0,bgG=0,bgB=0,T=Math.PI*2;
try {c.getContext("2d");}
catch (er) {canvOK = 0;}
if (canvOK){
var ctx = c.getContext("2d");
ctx.textBaseline = "top"; // Makes left top point a start point for rendering text
ctx.canvas.width=mx = screen.availWidth*0.98;
ctx.canvas.height=my = screen.availHeight*0.95;
mx/=2;my/=2;
c.addEventListener("mousemove", mouseMoved);
c.addEventListener("click", on_click, false);
for(var x=0;x<5000;x++){
var player = new Object();
player.x=player.y=0;
while((player.x-mx)(player.x-mx)+(player.y-my)(player.y-my)>10000 || player.x==0){
player.x = c.width*Math.random();
player.y = c.height*Math.random();
}
player.ax = 0*Math.random();
player.ay = 0*Math.random();
players.push(player);
}
clock();
}
function clock(){
t++;
drawProgress();
setTimeout(function(){ clock(); }, 16);
}
function hexFromInt(i){
i=Math.round(i);
if(i<0)i=0;
if(i>255)i=255;
var j=Math.round(i/16-0.5),k=i%16,ret;
switch(j){
case 10:ret="a";break;
case 11:ret="b";break;
case 12:ret="c";break;
case 13:ret="d";break;
case 14:ret="e";break;
case 15:ret="f";break;
default:ret=""+j;
}
switch(i){
case 10:ret+="a";break;
case 11:ret+="b";break;
case 12:ret+="c";break;
case 13:ret+="d";break;
case 14:ret+="e";break;
case 15:ret+="f";break;
default:ret+=j;
}
return ret;
}
function bsin(i){
return Math.sin(i)/2+0.5;
}
function drawProgress(){
/*if(t%100==0){
var s=Math.round(Math.random()*3);
console.log(s);
switch(s){
case 0:bgR=255;bgG=0;bgB=0;break;
case 1:bgR=255;bgG=255;bgB=0;break;
case 2:bgR=255;bgG=201;bgB=0;break;
case 3:bgR=0;bgG=0;bgB=255;break;
}
} */
//document.bgColor="#"+hexFromInt(bsin(t*T*0.01)*bgR)+hexFromInt(bsin(t*T*0.01)*bgG)+hexFromInt(bsin(t*T*0.01)*bgB);
ctx.save();
ctx.setTransform(1, 0, 0, 1, 0, 0);
ctx.clearRect(0, 0, c.width, c.height);
//ctx.font="25px Georgia";
ctx.fillStyle = "rgba(50,185,185,1)";
//ctx.fillRect(10,10,100,100);
if(chat){
ctx.font="30px Georgia";
ctx.fillText(chatmessage,200,20);
}
//ctx.fillStyle = "rgba(185,50,50,1)";
for(var x=0;x<5000;x++){
var player=players[x];
var dx=mx-player.x,dy=my-player.y;
var l=Math.sqrt(dx*dx+dy*dy);
player.ax+=dx/l;
player.ay+=dy/l;
player.x+=player.ax;
player.y+=player.ay;
ctx.fillRect(player.x,player.y,5,5);
}
ctx.restore();
}
function mouseMoved(e){
if(e.offsetX) {
mx = e.offsetX;
my = e.offsetY;
}else if(e.layerX) {
mx = e.layerX;
my = e.layerY;
}
}
function on_click(e){
}
function sq(e){
return e*e;
}
function sendMessage(message){
}
</script>
</body>
</html>
307382020s ago, by Antonio