PixiJS消耗大量GPU

问题描述 投票:0回答:1

所以我在Pixi有一个场景,其中包含约7-8个纹理。一对夫妇只是循环执行简单的转换(例如,像风扇一样旋转),有些是静态的。

[根本不与它进行交互(在单独的窗口中),它的存在使我的16BG i7 MacBook Pro像疯了似的发热,它占用了50%的CPU。

这是我如何设置旋转动画之一的示例。那里的东西看起来可疑吗?我不敢相信它会消耗多少功率,我将扔掉所有的Pixi代码并只使用CSS,因为它看起来效率更高。

rotorPositions.forEach((rotor, index) => {
    const sprite = new PIXI.Sprite(resources.rotor.texture)
    sprite.position.set(foregroundContainer.width/100 * rotor[0], foregroundContainer.height/100 * rotor[1])
    foregroundContainer.addChild(sprite)

    sprite.anchor.x = 0.5
    sprite.anchor.y = 0.616

    let speed = 0.03

    sprite.zIndex = 3

    if(index == 1){
        speed = 0.04
        sprite.rotation = 0.5
    }

    app.ticker.add(() => {
        sprite.rotation += speed
    })
})
javascript pixi.js
1个回答
0
投票
© www.soinside.com 2019 - 2024. All rights reserved.