0
<script src="/js/kinetic-v4.3.3.min.js"></script>
<script>
$(document).ready(function(){
var gravity = 0.5;
var stage = new Kinetic.Stage({
container: 'stage',
width: 625,
height: 366
});
var wallLayer = new Kinetic.Layer();
var walls = [];
var wallCount = 7;
for(var i = 0; i < wallCount; i++)
{
var y = i * 61;
walls.push(new Kinetic.Rect({
x: 0,
y: y,
width: 40,
height: 60,
fill: '#FF0000'
}));
wallLayer.add(walls[i]);
}
stage.add(wallLayer);
var anim = new Kinetic.Animation(function(frame) {
//wall.vy += gravity;
// wall.setY(wall.vy);
}, wallLayer);
anim.start();
})
</script>
<div id="stage">
</div>
這裏我只繪製了舞臺的左側有許多牆,將每個牆都推到了一個數組中,但是如何繪製一個循環中的頂部,右側和底部是否相同?或者我需要在4個循環中完成?如何在舞臺畫布(html5,kineticJS)中繪製一個環形牆壁
http://codereview.stackexchange.com/ - 由於尺寸不相等,如果您使用兩個循環 – Alexander 2013-02-24 10:20:01