うーん、この html5 キャンバス ジャイブ全体は、私にとってまったく新しいものです。
そのため、私がやろうとしているのは、「ピクセル」を画面上で移動させ、その後ろに追加の尾を付けて、特定のポイントまで移動させ、ピクセルがまだ「移動」しているが、尾の内容をスクロールさせることです。
まともな方法でそれを説明したことを本当に願っています。昨日の朝からこれを理解しようとしてきましたが、それは起こっていません........コードは次のとおりです。
rando=function(n){
return Math.round(Math.random()*n);
}
pencil=function(id){
this.neon=new Array();
this.neon[0]="#00FF00";
this.neon[1]="#00FF33";
this.neon[2]="#00FF66";
this.neon[3]="#33FF00";
this.id=id;
this.x=0;
var me=this;
this.paper=document.createElement("canvas");
this.paper.id=id+"_paper";
this.paper.width=100;
this.paper.height=300;
document.body.appendChild(this.paper);
this.dot=this.paper.getContext("2d");
this.dot.beginPath();
this.dot.lineWidth=1;
this.dot.strokeStyle = this.neon[rando(this.neon.length)];
//this.img=this.dot.getImageData(0,0,this.paper.width,this.paper.height);
this.drawr=function(){
if(this.x==0){
this.y=rando(300)+.5;
this.dot.moveTo(this.x,this.y);
this.count=0;
}
this.x+=1;
this.count+=1;
if(this.count==20){
this.count=0;
this.y+=rando(2)-1;
}
this.dot.lineTo(this.x,this.y);
if(this.x>49){
//this.paper.width=this.paper.width;
//this.paper.height=this.paper.height;
//this.dot.putImageData(this.img, (this.x-50)*-1, 0);
//this.dot.translate(-1,0);
}
this.dot.stroke();
setTimeout(function(){ me.drawr(); },rando(50)+10);
};
}
window.onload=function(){
var line=new Array();
for(var i=0;i<5+rando(15);i++){
line[i]=new pencil(i);
line[i].drawr();
}
}
翻訳、画像の描画、画像データの挿入、および他の多くのことを試みましたが、何も機能しませんでした..おそらく、これは完全に間違っているか、何かに近づいていますか?? これについての別の方法についての提案も、助けてくれてありがとう!!