简体   繁体   English

如何向场景添加动画gif?

[英]How can I add an animated gif to a scene?

In three.js, how can I add an animated gif? 在three.js中,如何添加动画gif?

var materialTextured = new THREE.MeshBasicMaterial( {
        map: THREE.ImageUtils.loadTexture('images/pin.gif'),
        transparent: true,
        side: THREE.DoubleSide
    });
    var plane = new THREE.Mesh(new THREE.PlaneGeometry(200, 150), materialTextured);
    plane.position.x=250;
    plane.scale.x = 1;
    scene.add(plane);

As I know Three.js not support GIF texture, but you can convert the GIF file to video, then use the VideoTexture . 据我所知Three.js不支持GIF纹理,但是您可以将GIF文件转换为视频,然后使用VideoTexture

Meanwhile, the video file has a better compression than the GIF file, which will improve the Web performance. 同时,视频文件比GIF文件具有更好的压缩效果,这将改善Web性能。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM