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

Matrix4.scale()

Matrix4.scale() 方法用于在当前的三维矩阵中添加一个缩放变换。

语法

matrix4.scale(scale: Vector3): Matrix4

参数

  • scale:一个包含三个浮点类型值的向量(Vector3)。分别表示在x,y和z轴方向上的缩放因子。

返回值

  • 返回 Matrix4 类型的矩阵,该矩阵包含了添加缩放变换后的结果。

示例

const matrix = new THREE.Matrix4();

matrix.scale(new THREE.Vector3(2, 1, 1));

以上的代码会将当前矩阵进行以下变换:

| 2 0 0 0 |
| 0 1 0 0 |
| 0 0 1 0 |
| 0 0 0 1 |

注意

  • scale 参数必须是 Vector3 类型。
  • Matrix4.scale() 方法并不会重置现有矩阵,而是在其基础上增加一个缩放变换。如果需要重置矩阵,需使用 Matrix4.identity() 方法。