// instantiate a loader
var loader = new THREE.TextureLoader();
// load a resource
loader.load(
// resource URL
'textures/land_ocean_ice_cloud_2048.jpg',
// onLoad callback
function ( texture ) {
// in this example we create the material when the texture is loaded
var material = new THREE.MeshBasicMaterial( {
map: texture
} );
},
// onProgress callback currently not supported
undefined,
// onError callback
function ( err ) {
console.error( 'An error happened.' );
}
);
top
нужно менять свойство translate
. В этом случае при анимации будет задействована видеокарта и она будет сильно плавнее. var randomWithPrecision = function (min, max, precision) {
var x = Math.random() * (max - min) + min;
var p = Math.pow(10, precision);
return Math.round(x * p) / p;
};
for (var i = 0; i < 10; i++) {
console.log( randomWithPrecision(20, 24, 1) );
}