Enumerationmigueldeicaza.swiftgodot 0.46.0SwiftGodot
TweenProcessMode
Tween.swift:53enum TweenProcessMode
Cases
case physics
The
Tween
updates after each physics frame (see_physicsProcess(delta:)
).case idle
The
Tween
updates after each process frame (see_process(delta:)
).
Other members in extension
View members
Hide members
This section is hidden by default because it contains too many (33) members.
Types
enum EaseType
class Signal1
Signal support.
class Signal2
Signal support.
enum TransitionType
enum TweenPauseMode
Type members
static func interpolateValue(initialValue: Variant, deltaValue: Variant, elapsedTime: Double, duration: Double, transType: Tween.TransitionType, easeType: Tween.EaseType
) -> Variant This method can be used for manual interpolation of a value, when you don’t want
Tween
to do animating for you. It’s similar to@GlobalScope.lerp
, but with support for custom transition and easing.class var godotClassName: StringName
Instance members
var finished: SimpleSignal
Emitted when the
Tween
has finished all tweening. Never emitted when theTween
is set to infinite looping (seesetLoops(_:)
).var loopFinished: Signal2
Emitted when a full loop is complete (see
setLoops(_:)
), providing the loop index. This signal is not emitted after the final loop, use [signal finished] instead for this case.var stepFinished: Signal1
Emitted when one step of the
Tween
is complete, providing the step index. One step is either a singleTweener
or a group ofTweener
s running in parallel.func bindNode(Node?
) -> Tween? Binds this
Tween
with the givennode
.Tween
s are processed directly by theSceneTree
, so they run independently of the animated nodes. When you bind aNode
with theTween
, theTween
will halt the animation when the object is not inside tree and theTween
will be automatically killed when the bound object is freed. Also .tweenPauseBound will make the pausing behavior dependent on the bound node.func chain(
) -> Tween? Used to chain two
Tweener
s aftersetParallel(_:)
is called withtrue
.func customStep(delta: Double
) -> Bool Processes the
Tween
by the givendelta
value, in seconds. This is mostly useful for manual control when theTween
is paused. It can also be used to end theTween
animation immediately, by settingdelta
longer than the whole duration of theTween
animation.func getLoopsLeft(
) -> Int32 Returns the number of remaining loops for this
Tween
(seesetLoops(_:)
). A return value of-1
indicates an infinitely loopingTween
, and a return value of0
indicates that theTween
has already finished.func getTotalElapsedTime(
) -> Double Returns the total time in seconds the
Tween
has been animating (i.e. the time since it started, not counting pauses etc.). The time is affected bysetSpeedScale(speed:)
, andstop
will reset it to0
.func isRunning(
) -> Bool Returns whether the
Tween
is currently running, i.e. it wasn’t paused and it’s not finished.func isValid(
) -> Bool Returns whether the
Tween
is valid. A validTween
is aTween
contained by the scene tree (i.e. the array fromgetProcessedTweens
will contain thisTween
). ATween
might become invalid when it has finished tweening, is killed, or when created withTween.new()
. InvalidTween
s can’t haveTweener
s appended.func kill(
) Aborts all tweening operations and invalidates the
Tween
.func parallel(
) -> Tween? Makes the next
Tweener
run parallelly to the previous one.func pause(
) Pauses the tweening. The animation can be resumed by using
play
.func play(
) Resumes a paused or stopped
Tween
.func setEase(Tween.EaseType
) -> Tween? Sets the default ease type for
PropertyTweener
s andMethodTweener
s animated by thisTween
.func setLoops(Int32
) -> Tween? Sets the number of times the tweening sequence will be repeated, i.e.
set_loops(2)
will run the animation twice.func setParallel(Bool
) -> Tween? If
parallel
istrue
, theTweener
s appended after this method will by default run simultaneously, as opposed to sequentially.func setPauseMode(Tween.TweenPauseMode
) -> Tween? Determines the behavior of the
Tween
when theSceneTree
is paused. CheckTweenPauseMode
for options.func setProcessMode(Tween.TweenProcessMode
) -> Tween? Determines whether the
Tween
should run after process frames (see_process(delta:)
) or physics frames (see_physicsProcess(delta:)
).func setSpeedScale(speed: Double
) -> Tween? Scales the speed of tweening. This affects all
Tweener
s and their delays.func setTrans(Tween.TransitionType
) -> Tween? Sets the default transition type for
PropertyTweener
s andMethodTweener
s animated by thisTween
.func stop(
) Stops the tweening and resets the
Tween
to its initial state. This will not remove any appendedTweener
s.func tweenCallback(Callable
) -> CallbackTweener? Creates and appends a
CallbackTweener
. This method can be used to call an arbitrary method in any object. UseCallable/bind()
to bind additional arguments for the call.func tweenInterval(time: Double
) -> IntervalTweener? Creates and appends an
IntervalTweener
. This method can be used to create delays in the tween animation, as an alternative to using the delay in otherTweener
s, or when there’s no animation (in which case theTween
acts as a timer).time
is the length of the interval, in seconds.func tweenMethod(Callable, from: Variant, to: Variant, duration: Double
) -> MethodTweener? Creates and appends a
MethodTweener
. This method is similar to a combination oftweenCallback(_:)
andtweenProperty(object:property:finalVal:duration:)
. It calls a method over time with a tweened value provided as an argument. The value is tweened betweenfrom
andto
over the time specified byduration
, in seconds. UseCallable/bind()
to bind additional arguments for the call. You can usesetEase(_:)
andsetTrans(_:)
to tweak the easing and transition of the value orsetDelay(_:)
to delay the tweening.func tweenProperty(object: Object?, property: NodePath, finalVal: Variant, duration: Double
) -> PropertyTweener? Creates and appends a
PropertyTweener
. This method tweens aproperty
of anobject
between an initial value andfinalVal
in a span of time equal toduration
, in seconds. The initial value by default is the property’s value at the time the tweening of thePropertyTweener
starts.
Citizens in SwiftGodot
Conformances
protocol CaseIterable
A type that provides a collection of all of its values.
protocol CustomDebugStringConvertible
A type with a customized textual representation suitable for debugging purposes.
protocol Equatable
A type that can be compared for value equality.
protocol Hashable
A type that can be hashed into a
Hasher
to produce an integer hash value.protocol RawRepresentable<RawValue>
A type that can be converted to and from an associated raw value.
Type members
Instance members
var debugDescription: String
A textual representation of this instance, suitable for debugging
Type features
static func != (lhs: Self, rhs: Self
) -> Bool Returns a Boolean value indicating whether two values are not equal.