小编Kri*_*tof的帖子

在three.js中提高动画精灵的性能

现在我正在开发一款在线游戏,并且出于性能原因决定使用webgl而不是HTML5的画布.我正在使用three.js框架,我的目的是移动动画精灵.精灵本身放在spritesheets上,我使用UVOffset和UVScale来使用正确的艺术,并在经过时间内切换Sprite的艺术.我想知道是否有办法改善这段代码的性能,因为现在它同时开始在场上大约300名"玩家"减速.

问候

以下是我的代码中最重要的部分:

var image = THREE.ImageUtils.loadTexture( "img/idlew.png" );

  function addPlayer(){
    var mesh = new THREE.Sprite({map:image});//, affectedByDistance: false, useScreenCoordinates: false});
    images.push(mesh);
    mesh.position.set(Math.floor(Math.random() * 500), Math.floor(Math.random() * 500), 10);
    scene.add(mesh);
    mesh.uvScale.x = 96/1152;
    mesh.scale.x = 0.1;
    mesh.scale.y = 0.1;
  }


var imgBackground  = new THREE.MeshLambertMaterial({
      map:THREE.ImageUtils.loadTexture('img/grass.jpg')
  });


   var background = new THREE.Mesh(new THREE.PlaneGeometry(1000, 1000),imgBackground);


  scene.add(background);



  scene.add(camera);
camera.rotation.x = -(Math.PI/2);
scene.add(new THREE.AmbientLight(0xFFFFFF));

addPlayer();

  renderer.render(scene, camera);
  var moveUp = false;
  tick();
  var ticker = 0;
  var usedOne = 0;

  function tick(){
    ticker++;
    if(ticker%10==0){ …
Run Code Online (Sandbox Code Playgroud)

performance animation sprite three.js

6
推荐指数
2
解决办法
6526
查看次数

EaselJS中大量动画位图的速度

在使用EaselJS时,我似乎在使用大量动画位图(所有基于相同的spritesheet)时遇到了一些麻烦.当我在舞台上同时运行其中几个时,根本没有问题,但是当同时运行更多数量(从大约30到40开始)同时移动它们时我开始拥有它们"闪烁"相当多,即使是在10左右的fps.

我没有在这些线上使用任何阴影或其他任何东西.只需使用动画位图并移动它们.

有没有人有任何关于提高这种表现的好建议?

performance bitmap animated easeljs

5
推荐指数
2
解决办法
4191
查看次数

标签 统计

performance ×2

animated ×1

animation ×1

bitmap ×1

easeljs ×1

sprite ×1

three.js ×1