BufferGeometry
Object3D
Raycaster
Camera
CubeCamera
PerspectiveCamera
OrthographicCamera
StereoCamera
Clock
Curve
CurvePath
Path
Shape
ShapePath
ArrowHelper
AxesHelper
BoxHelper
Box3Helper
CameraHelper
DirectionalLightHelper
GridHelper
PolarGridHelper
HemisphereLightHelper
PlaneHelper
PointLightHelper
SkeletonHelper
SpotLightHelper
Light
PointLight
RectAreaLight
SpotLight
DirectionalLight
HemisphereLight
LightShadow
PointLightShadow
AnimationLoader
AudioLoader
BufferGeometryLoader
CompressedTextureLoader
CubeTextureLoader
DataTextureLoader
FileLoader
ImageBitmapLoader
ImageLoader
Loader
LoaderUtils
MaterialLoader
ObjectLoader
TextureLoader
LoadingManager
Material
Box2
Box3
Color
Cylindrical
Euler
Frustum
Interpolant
Line3
MathUtils
Matrix3
Matrix4
Plane
Quaternion
AnimationAction
AnimationClip
AnimationMixer
AnimationObjectGroup
AnimationUtils
keyframeTrack
PropertyBinding
PropertyMixer
BooleanKeyframeTrack
QuaternionKeyframeTrack
StringKeyframeTrack
Audio
AudioAnalyser
AudioContext
AudioListener
PositionalAudio

AnimationUtils.isTypedArray()

概述

AnimationUtils.isTypedArray() 方法用于检测指定对象是否为类型化数组。

语法

AnimationUtils.isTypedArray( object )

参数

  • object:必需,要检测的对象。

返回值

一个布尔值。

  • 返回 true:若该对象为类型化数组。
  • 返回 false:若该对象不为类型化数组。

示例

import { AnimationUtils } from 'three';

const arr1 = [1, 2, 3];
const arr2 = new Float32Array(3);

AnimationUtils.isTypedArray(arr1); // false
AnimationUtils.isTypedArray(arr2); // true

注意事项

  • AnimationUtils.isTypedArray() 只能检测类型化数组,普通数组将一律返回 false
  • 该方法使用的是 Object.prototype.toString() 方法进行判断,因此只能检测诸如 Float32ArrayInt8ArrayUint8Array 等构造器创建的类型化数组,不能检测 ArrayBuffer 及其它 JavaScript 对象。

参考链接