- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试删除 pixi 应用程序中 childen 的所有子项,但是一些 sprite 项目仍然存在并且在 tween 之后失败。以下位于名为 appEntry 的类中。
create(){
this.renderer = new Renderer({ resolution: window.devicePixelRatio });
this.renderer.backgroundColor = 0x260244;
this.app = new Container();
this.loader = new Loader();
console.log('PIXI APP INIT!');
document.getElementById('pixi-render').appendChild(this.renderer.view);
console.log('RENDERER APPENDED:', this.renderer);
console.log('PIXI APP APPENDED:', this.app);
AnimationStore.subscribe(() => {
this.renderer.render(this.app);
});
Store.subscribe(() => {
const { color, coloron } = Store.getState().App;
});
const main = new Main();
this.app.removeChild(this.loader);
this.app.addChild(main);
this.renderer.start();
}
destroy(){
this.app.destroy(true);
this.app = null;
this.renderer.view.destroy( true );
this.renderer.view = null;
while(this.app.children[0]) {
this.app.removeChild(this.app.children[0]); }
this.renderer.destroy( true );
this.renderer = null;
console.log('PIXI APP APPENDED:', this.app);
}
最佳答案
似乎 destroy 方法设计不正确,并且不清楚为什么在执行时浏览器中没有错误:this.app 变量在从中删除所有子项之前被取消 while(this.app.children[0])
一开始,我建议接下来改变方法:
destroy(){
while(this.app.children[0]) {
this.app.removeChild(this.app.children[0]);
}
this.app.destroy(true);
this.app = null;
this.renderer.view.destroy( true );
this.renderer.view = null;
this.renderer.destroy( true );
this.renderer = null;
console.log('PIXI APP APPENDED:', this.app);
}
此外,请确保您的错误与补间仍然处于事件状态这一事实无关,但它们的补间目标已经无效/删除/销毁。如果是这种情况,那么除了删除视觉对象之外,您还需要停止/销毁所有补间。
关于javascript - 删除 Pixi 应用程序中所有 child 的 child ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54993971/
我不熟悉PIXI.js进行游戏。 如何在不使用图像的情况下绘制半个圆形? 先感谢您! 最佳答案 在使用stackoverflow之前,请确保已阅读the official documentation。
我正在尝试从我的游戏中完全删除一个 Sprite (充当死亡角色)。我在网上能找到的只有: sprite.parent.removeChild(sprite); 当我这样做时, Sprite 停止渲染
[Chrome v32] 如何使用 PIXI.js 库绘制基本的红色矩形? 我试过这个(不工作) var stage = new PIXI.Stage(0xFFFFFF); var renderer
我使用的是 pixi.js v 3.0.0我的简单代码是 (function () { document.addEventListener('DOMContentLoaded', functi
我 npm 将 pixi.js 安装到了一个 typescript 项目中。此行(在许多示例中都可以找到)不起作用: import * as PIXI from 'pixi.js'; 我收到错误“找不
我有大约 10 个不同的图像文件需要动态加载到一个 PIXI.Texture 对象中。 pixi.js 有这种可能性吗?想想老虎机卷轴;我将每个单独的插槽符号作为图像,需要从这些图像构建卷轴条纹理。
我的问题是 chrome 浏览器在 ticker 开始大约 2 分钟后停止了。 const renderer = new PIXI.Renderer({ width: window.inner
我有一个通过 new PIXI.Sprite.fromImage(path) 创建的 Sprite ,如何实时增加它的亮度? 最佳答案 您可以使用 PIXI ColorMatrixFilter 执行此
我正在尝试使用 pixi.js 应用世界变换来获取 Graphics 实例的边界框 我对使用PIXI.Graphics documentation有点困惑。据我所知,它应该继承width,height
我画了直接图,所以我画了线的箭头,我是 pixi.js 和 javascript 的新手,我想学习它,你能帮助我如何画一个箭头吗是吗? 这是一个demo我想将箭头添加到链接。 这是绘制链接的代码,位于
我在使用 pixi.js 时遇到问题 我正在创建一个类似 http://www.wolverineunleashed.com/#muscles 的页面我创建了一个大舞台,用户可以使用他们的拖动方式,除
开始使用 PIXI 并快速了解文档并没有多大帮助。至少对我来说。 尝试使用冲击波过滤器... var shock = new PIXI.filters.ShockwaveFilter(); image
我有 pixy(CMUcam5)。是否可以从相机或类似的东西中获取矩阵,而无需从 charmed labs 重新编码预编码代码? 最佳答案 我认为你不能。在 pixy 论坛上有几个人要求提供视频源,开
有没有办法让 Canvas 对象滚动到内容之外。例子:用 1000*1000 创建的 Canvas 。并在 Canvas 上启用 PAN 和 Zoom。在 Canvas 上绘制一个矩形并用鼠标将矩形移
我构建了一个简单的 PIXI.js 应用程序来实现 PIXI.RenderTexture,但它不起作用。 它应该渲染两个方形 Sprite ,黑色和白色。黑色的添加了常规的stage.addChild
在我们的游戏中,我们使用 typescript、pixi.js、vscode、eslint。 我们有一个像这样的图像文件字典 export function getAllImages(): {name
有没有办法将图形转换为 Sprite ? 我有一个包含单个矩形的图形,并希望将其转换为 Sprite 以启用复杂的动画。 我试过做 let p= new Graphics(); p.beginFill
我有一个 JavaScript 图形对象。在这里面我有一个 pixi js 阶段作为私有(private)成员。在舞台上,我有一个 PIXI.Graphics() 对象,我将在其中保持两条垂直线。我在
我正在使用 Chrome 学习本教程 ( http://www.yeahbutisitflash.com/?p=5226 ),但不明白为什么这不起作用。这是我的控制台输出: init() succes
我有两个问题要揭露。 首先:我正在开发一个网站,我正在使用 Meteor 来构建其结构来处理前端后端和数据库,因为我没有太多使用各种界面的经验。我喜欢 Meteor,但我需要添加动画图形(主要是 2d
我是一名优秀的程序员,十分优秀!