2011-06-18 53 views

回答

2

使用canvas或WebGL将会更容易。

帆布例如,假设images是与字段imagex对象的阵列,并y

context.fillRect(0, 0, 100, 10); // Progressbar background. Alternatively, you could stroke it (draw a border). 
context.fillRect(0, 0, 10, 10); // Draw the current progress. I've hard coded it to 10% here. 
for (var i = 0; i < images.length; i++) 
{ 
    var a = images[i]; // I'm lazy 
    context.fillRect(a.x - 1, 0, 2, a.y); // less code than stroking 
    context.drawImage(a, a.x, a.y); 
}