提交 940fe933 编写于 作者: M Mr.doob

LottieLoader: Added setQuality()

上级 48c73d11
......@@ -10,4 +10,6 @@ export class LottieLoader extends Loader {
load( url: string, onLoad: ( texture: CanvasTexture ) => void, onProgress?: ( event: ProgressEvent ) => void, onError?: ( event: ErrorEvent ) => void ) : void;
setQuality( value: Number ) : void;
}
......@@ -14,8 +14,16 @@ LottieLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
constructor: LottieLoader,
setQuality: function ( value ) {
this._quality = value;
},
load: function ( url, onLoad, onProgress, onError ) {
const quality = this._quality || 1;
const texture = new CanvasTexture();
const loader = new FileLoader( this.manager );
......@@ -40,7 +48,7 @@ LottieLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
loop: true,
autoplay: true,
animationData: data,
rendererSettings: { dpr: 1 }
rendererSettings: { dpr: quality }
} );
texture.animation = animation;
......
......@@ -35,6 +35,7 @@
scene.background = new THREE.Color( 0x222222 );
const loader = new LottieLoader();
loader.setQuality( 2 );
loader.load( 'textures/lottie/24017-lottie-logo-animation.json', function ( texture ) {
setupControls( texture.animation );
......@@ -96,6 +97,7 @@
function onWindowResize() {
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
renderer.setSize( window.innerWidth, window.innerHeight );
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册