将图层添加到另一个图层
Add Layer to another Layer
我有以下代码,我试图将一些 Kineticjs 层添加到另一个层,但当我不做时什么都没有显示。我向画布添加了其他形状,这些形状显示正常,如果我单独添加所有图层,则它们会出现。这是一个错误还是我做错了什么?
this.canvas = new Kinetic.Stage({ "container": jQuery( "#testElement" ).get(0),
"width": ShooterGame.WIDTH, "height": ShooterGame.HEIGHT });
this.container = new Kinetic.Layer();
this.layer1 = new Kinetic.Layer();
this.layer2 = new Kinetic.Layer();
this.layer3 = new Kinetic.Layer();
this.layer1Bg = new Kinetic.Rect({ "width": 100, "height": 100, "fill": "#FF0000" });
this.layer2Bg = new Kinetic.Rect({ "width": 100, "height": 100, "fill": "#FF0000" });
this.layer3Bg = new Kinetic.Rect({ "width": 100, "height": 100, "fill": "#FF0000" });
this.layer1.add( this.layer1Bg );
this.layer2.add( this.layer2Bg );
this.layer3.add( this.layer3Bg );
this.container.add( this.layer1 );
this.container.add( this.layer2 );
this.container.add( this.layer3 );
this.canvas.add( this.container );
this.container.draw();
您可以将图层添加到组 (Kinetic.Group),然后将该组添加到舞台。
相关文章:
- 如果显示另一个折叠的图元,如何隐藏该图元
- 可以对一个图表进行高图深化,反映在另一个图表上
- 是否可以使用不同投影的另一个WMS层显示OSM数据
- 将图层添加到另一个图层
- 在 D3 中追加堆积条形图和另一个条形图
- 如何从javascript散点图中的另一个变量为x和y添加新值
- 把一个页面区域的截图放到另一个页面上
- 单击另一个用于显示/隐藏图层的按钮时,在Adobe PDF中隐藏/显示按钮的代码是什么
- 如何将一个传单标记添加到多个图层组
- Highstock.js:无法创建具有两个堆积柱形图的多窗格图表,一个是“正常”,另一个是“百分比”
- 传递数组列表<ImageItems>从一个活动到另一个活动.图像项包含位图和字符串
- Highcharts:如何创建饼图,其中一个切片有1层,其他切片有2层
- 在图层中找到一个特定的组并重新绘制它
- 高图表折线图,将鼠标悬停在该点上选择图表上的另一个点
- 对象如何存储在一个动能.Kineticjs中的图层
- 在Jquery中加载一个图层
- 如何设置一个geojson对象或图层的不透明度?
- 动态JS拖动一个图层会导致另一个图层上的形状对拖动停止响应
- 如何合并不同的图层到一个bmp文件
- 在mapbox中,如何在另一个图层下面添加一个图层