U3DC.COM | 优三帝研究院

Menu

DoTween官方文档中文版(五)基本元素的快捷方式

Basic elements shortcuts(基本元素快捷方式)

AudioMixer (Unity 5)混音器

DOSetFloat(string floatName, float to, float duration)Tweens an AudioMixer's exposed float to the given value.
Note that you need to manually expose a float in an AudioMixerGroup in order to be able to tween it from an AudioMixer.

请注意需要手动设置一个公开的float在 AudioMixerGroup 中才能补间AudioMixer

AudioSource音源

DOFade(float to, float duration)

Tweens an AudioSource's volume to the given value..//音量飙到给定的值

DOPitch(float to, float duration)

Tweens an AudioSource's pitch to the given value..//音调飙到给定的值

Camera(相机)

DOColor(Color to, float duration)

Tweens a Camera's backgroundColor.//改变摄像机的背景色

DOShakePosition(float duration, float/Vector3 strength, int vibrato, float randomness)

No FROM version.
Shakes a Camera's localPosition along its relative X Y axes with the given values.

晃动摄像机的本地坐标沿着x、y轴,根据给定的值。
strength The shake strength. Using a Vector3 instead of a float lets you choose the strength for each axis.

强度震动强度使用 Vector3 而不一个浮点数允许选择每个强度
vibrato How much will the shake vibrate.

摇晃的强度。
randomness How much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware). Setting it to 0 will shake along a single direction.

 

随机性,摇晃的随机 (0 180-高于 90 所以要留意)。设置 0 沿方向摇晃
DOShakeRotation(float duration, float/Vector3 strength, int vibrato, float randomness)
No FROM version.
Shakes a Camera's localRotation. //摇晃摄像机的localrotation,以下基本同上
strength The shake strength. Using a Vector3 instead of a float lets you choose the strength for each axis.
vibrato How much will the shake vibrate.
randomness How much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware). Setting it to 0 will shake along a single direction.

Light(灯光)

DOColor(Color to, float duration)

Changes the light's color to the given one,

//改变灯光的颜色,color to(目标颜色),duration(渐变的时间)

DOIntensity(float to, float duration)

Changes the light's intensity to the given one

//灯光强度

DOShadowStrength(float to, float duration)

Changes the light's shadowStrength to the given one

Blendable tweens(混合补间

DOBlendableColor(Color to, float duration)

Tweens the target's color to the given value, in a way that allows other DOBlendableColor tweens to work together on the same target, instead than fight each other as multiple DOColor would do.

补间目标颜色给定允许其他 DOBlendableColor 补间共同致力相同目标互相争斗作为多个 DOColor方式

LineRenderer(渲染线)

DOColor(Color2 startValue, Color2 endValue, float duration)

Changes the target's color to the given one. Note that this method requires to also insert the start colors for the tween, since LineRenderers have no way to get them.

目标的颜色更改给定一个请注意方法要求插入补间起始颜色因为 LineRenderers 没有办法他们
Color2 is a special DOTween struct which allows to store two colors in a single variable.

Color2 一个特殊DOTween 结构允许单个变量存储两种颜色

示例code:

myLineRenderer.DOColor(new Color2(Color.white, Color.white), new Color2(Color.green, Color.black), 1);

 

Material(材质球)

DOColor(Color to, float duration)

Changes the target's color to the given one.

DOColor(Color to, string property, float duration)

Changes the target's named color property to the given one.

更改目标的命名颜色属性设置给定一个
property :The name of the property to tween.//补间的属性名称

示例code:

// Tween the specular value of a material
myMaterial.DOColor(Color.green, "_SpecColor", 1);

DOFade(float to, float duration)
Fades the target's alpha to the given value (works only with materials that support alpha).

使目标的阿尔法值按照给定的值变化,只对支持阿尔法通道的材质有效。

DOFade(float to, string property, float duration)

Fades the target's named alpha property to the given one.
property :The name of the property to tween.

DOFloat(float to, string property, float duration)

Changes the target's named float property to the given one.
property The name of the property to tween.

DOVector(Vector4 to, string property, float duration)

Changes the target's named Vector property to the given one.
property The name of the property to tween.

Blendable tweens(混合补间,同上)

DOBlendableColor(Color to, float duration)

Tweens a Material's color to the given value, in a way that allows other DOBlendableColor tweens to work together on the same target, instead than fight each other as multiple DOColor would do.

DOBlendableColor(Color to, string property, float duration)

Tweens a Material's named color property to the given value, in a way that allows other DOBlendableColor tweens to work together on the same target, instead than fight each other as multiple DOColor would do.
property The name of the property to tween.

示例code:
// Tween the specular value of a material
myMaterial.DOBlendableColor(Color.green, "_SpecColor", 1);

Rigidbody(刚体)

These shortcuts use rigidbody's MovePosition/MoveRotation methods in the background, to correctly animate things related to physics objects.

这些快捷方式背景下使用刚体的 MovePosition/MoveRotation 方法正确地进行动画处理物理对象有关事情

DOMove(Vector3 to, float duration, bool snapping)

Moves the target's position to the given value. //将目标移动到给定的值。
snapping: If TRUE the tween will smoothly snap all values to integers.

如果为 TRUE 补间将平滑的对齐所有整数

DOMoveX/DOMoveY/DOMoveZ(float to, float duration, bool snapping)

Moves the target's position to the given value, tweening only the chosen axis.

移动目标到给定的值,补间只针对指定的轴。
snapping :If TRUE the tween will smoothly snap all values to integers.

Rotate(旋转)

DORotate(Vector3 to, float duration, RotateMode mode)

Rotates the target to the given value. 旋转到给定的值。
Requires a Vector3 end value, not a Quaternion (if you really want to pass a Quaternion, just convert it using myQuaternion.eulerAngles).

(如果真的通过一个四元数只是转换使用myQuaternion.eulerAngles)需要 Vector3结束一个四元数

mode:
Fast (default): the rotation will take the shortest route and will not rotate more than 360°.

旋转采取路线并且旋转超过 360 °。
FastBeyond360: The rotation will go beyond 360°. //旋转超越 360 °
WorldAxisAdd: Adds the given rotation to the transform using world axis and an advanced precision mode (like when using transform.Rotate(Space.World)). In this mode the end value is always considered relative.

Adds the given rotation to the transform using world axis and an advanced precision mode (like when using transform.Rotate(Space.World)). In this mode the end value is always considered relative.

给定旋转添加变换使用世界先进精密模式 (如使用变换Rotate(Space.World))模式下结束始终相对
LocalAxisAdd: Adds the given rotation to the transform's local axis (like when rotating an object with the "local" switch enabled in Unity's editor or using transform.Rotate(Space.Self)). In this mode the end value is is always considered relative.

给定旋转添加变换的局部 (如 「 local开关启用统一的编辑器使用变换旋转对象Rotate(Space.Self))模式下最终始终相对

DOLookAt(Vector3 towards, float duration, AxisConstraint axisConstraint = AxisConstraint.None,Vector3 up = Vector3.up)

Rotates the target so that it will look towards the given position.

朝着给定的位置旋转目标。
axisConstraint: Eventual axis constraint for the rotation.
Default: AxisConstraint.None
up: The vector that defines in which direction up is.
Default: Vector3.up

PRO ONLY ➨ Spiral – no FROM(专业版特供)

DOSpiral(float duration, Vector3 axis = null, SpiralMode mode = SpiralMode.Expand, float speed = 1, float frequency = 10, float depth = 0, bool snapping = false)

Tweens a Rigidbody's position in a spiral shape.

补间一个刚体使用螺旋状态
duration :The duration of the tween.
axis :The axis around which the spiral will rotate.
mode :The type of spiral movement.
speed :Speed of the rotations.
frequency :Frequency of the rotation. Lower values lead to wider spirals.
depth :Indicates how much the tween should move along the spiral's axis.
snapping: If TRUE the tween will smoothly snap all values to integers.

示例code:

transform.DOSpiral(3, Vector3.forward, SpiralMode.ExpandThenContract, 1, 10);

Rigidbody2D(二维刚体)基本与刚体一致,少了一个z轴而已。

These shortcuts use rigidbody2D's MovePosition/MoveRotation methods in the background, to correctly animate things related to physics objects.

Expand all

Move
DOMove(Vector2 to, float duration, bool snapping)
DOMoveX/DOMoveY(float to, float duration, bool snapping)
Rotate
DORotate(float toAngle, float duration)

SpriteRenderer(2d图片渲染器)

DOColor(Color to, float duration)

Changes the target's color to the given one.

DOFade(float to, float duration)

Fades the target's alpha to the given value.

DOBlendableColor(Color to, float duration)

Tweens the target's color to the given value, in a way that allows other DOBlendableColor tweens to work together on the same target, instead than fight each other as multiple DOColor would do.

TrailRenderer(拖尾渲染器)

DOResize(float toStartWidth, float toEndWidth, float duration)

Changes the TrailRenderer's startWidth/endWidth to the given ones

DOTime(float to, float duration)

Changes the target's time value to the given one

Transform(变换:位置、缩放、旋转)基本同刚体

DOMove(Vector3 to, float duration, bool snapping)

Moves the target's position to the given value.
snapping If TRUE the tween will smoothly snap all values to integers.

DOMoveX/DOMoveY/DOMoveZ(float to, float duration, bool snapping)

Moves the target's position to the given value, tweening only the chosen axis.
snapping If TRUE the tween will smoothly snap all values to integers.

DOLocalMove(Vector3 to, float duration, bool snapping)

Moves the target's localPosition to the given value.
snapping If TRUE the tween will smoothly snap all values to integers.

DOLocalMoveX/DOLocalMoveY/DOLocalMoveZ(float to, float duration, bool snapping)

Moves the target's localPosition to the given value, tweening only the chosen axis.
snapping If TRUE the tween will smoothly snap all values to integers.

Rotate
DORotate(Vector3 to, float duration, RotateMode mode)
DOLocalRotate(Vector3 to, float duration, RotateMode mode)
DOLookAt(Vector3 towards, float duration, AxisConstraint axisConstraint = AxisConstraint.None,Vector3 up = Vector3.up)
Scale
DOScale(float/Vector3 to, float duration)
DOScaleX/DOScaleY/DOScaleZ(float to, float duration)
Punch – no FROM
DOPunchPosition(Vector3 punch, float duration, int vibrato, float elasticity, bool snapping)
DOPunchRotation(Vector3 punch, float duration, int vibrato, float elasticity)
DOPunchScale(Vector3 punch, float duration, int vibrato, float elasticity)
Shake – no FROM
DOShakePosition(float duration, float/Vector3 strength, int vibrato, float randomness, boolsnapping)
DOShakeRotation(float duration, float/Vector3 strength, int vibrato, float randomness)
DOShakeScale(float duration, float/Vector3 strength, int vibrato, float randomness)
Path – no FROM
DOPath(Vector3[] waypoints, float duration, PathType pathType = Linear, PathMode pathMode = Full3D, int resolution = 10, Color gizmoColor = null)
DOLocalPath(Vector3[] waypoints, float duration, PathType pathType = Linear, PathModepathMode = Full3D, int resolution = 10, Color gizmoColor = null)
Blendable tweens
DOBlendableMoveBy(Vector3 by, float duration, bool snapping)
DOBlendableLocalMoveBy(Vector3 by, float duration, bool snapping)
DOBlendableRotateBy(Vector3 by, float duration, RotateMode mode)
DOBlendableLocalRotateBy(Vector3 by, float duration, RotateMode mode)
DOBlendableScaleBy(Vector3 by, float duration)
PRO ONLY ➨ Spiral – no FROM
DOSpiral(float duration, Vector3 axis = null, SpiralMode mode = SpiralMode.Expand, float speed = 1, float frequency = 10, float depth = 0, bool snapping = false) 
打赏
— 于 共写了9752个字
— 文内使用到的标签:

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据