PropertyTweener

package
v0.0.0-...-535787f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 16, 2025 License: MIT Imports: 24 Imported by: 0

Documentation

Overview

graphics.gd/classdb/PropertyTweener is used to interpolate a property in an object. See graphics.gd/classdb/Tween.Instance.TweenProperty for more usage information.

The tweener will finish automatically if the target object is freed.

Note: graphics.gd/classdb/Tween.Instance.TweenProperty is the only correct way to create graphics.gd/classdb/PropertyTweener. Any graphics.gd/classdb/PropertyTweener created manually will not function correctly.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Advanced

type Advanced = class

Advanced exposes a 1:1 low-level instance of the class, undocumented, for those who know what they are doing.

type Any

type Any interface {
	gd.IsClass
	AsPropertyTweener() Instance
}

type Extension

type Extension[T gdclass.Interface] struct{ gdclass.Extension[T, Instance] }

Extension can be embedded in a new struct to create an extension of this class. T should be the type that is embedding this Extension

func (*Extension[T]) AsObject

func (self *Extension[T]) AsObject() [1]gd.Object

func (*Extension[T]) AsPropertyTweener

func (self *Extension[T]) AsPropertyTweener() Instance

func (*Extension[T]) AsRefCounted

func (self *Extension[T]) AsRefCounted() [1]gd.RefCounted

func (*Extension[T]) AsTweener

func (self *Extension[T]) AsTweener() Tweener.Instance

type ID

type ID Object.ID

ID is a typed object ID (reference) to an instance of this class, use it to store references to objects with unknown lifetimes, as an ID will not panic on use if the underlying object has been destroyed.

func (ID) Instance

func (id ID) Instance() (Instance, bool)

type Instance

type Instance [1]gdclass.PropertyTweener

Instance of the class with convieniently typed arguments and results.

var Nil Instance

Nil is a nil/null instance of the class. Equivalent to the zero value.

func Make

func Make(peer Tween.Instance, obj Object.Instance, property string, final_val any, duration Float.X) Instance

Creates and appends a [PropertyTweener]. This method tweens a [param property] of an [param object] between an initial value and [param final_val] in a span of time equal to [param duration], in seconds. The initial value by default is the property's value at the time the tweening of the [PropertyTweener] starts. [codeblocks] [gdscript] var tween = create_tween() tween.tween_property($Sprite, "position", Vector2(100, 200), 1.0) tween.tween_property($Sprite, "position", Vector2(200, 300), 1.0) [/gdscript] [csharp] Tween tween = CreateTween(); tween.TweenProperty(GetNode("Sprite"), "position", new Vector2(100.0f, 200.0f), 1.0f); tween.TweenProperty(GetNode("Sprite"), "position", new Vector2(200.0f, 300.0f), 1.0f); [/csharp] [/codeblocks] will move the sprite to position (100, 200) and then to (200, 300). If you use [method PropertyTweener.from] or [method PropertyTweener.from_current], the starting position will be overwritten by the given value instead. See other methods in [PropertyTweener] to see how the tweening can be tweaked further. [b]Note:[/b] You can find the correct property name by hovering over the property in the Inspector. You can also provide the components of a property directly by using [code]"property:component"[/code] (eg. [code]position:x[/code]), where it would only apply to that particular component. [b]Example:[/b] Moving an object twice from the same position, with different transition types: [codeblocks] [gdscript] var tween = create_tween() tween.tween_property($Sprite, "position", Vector2.RIGHT * 300, 1.0).as_relative().set_trans(Tween.TRANS_SINE) tween.tween_property($Sprite, "position", Vector2.RIGHT * 300, 1.0).as_relative().from_current().set_trans(Tween.TRANS_EXPO) [/gdscript] [csharp] Tween tween = CreateTween(); tween.TweenProperty(GetNode("Sprite"), "position", Vector2.Right * 300.0f, 1.0f).AsRelative().SetTrans(Tween.TransitionType.Sine); tween.TweenProperty(GetNode("Sprite"), "position", Vector2.Right * 300.0f, 1.0f).AsRelative().FromCurrent().SetTrans(Tween.TransitionType.Expo); [/csharp] [/codeblocks]

func New

func New() Instance

func (Instance) AsObject

func (self Instance) AsObject() [1]gd.Object

func (Instance) AsPropertyTweener

func (self Instance) AsPropertyTweener() Instance

func (Instance) AsRefCounted

func (self Instance) AsRefCounted() [1]gd.RefCounted

func (Instance) AsRelative

func (self Instance) AsRelative() Instance

When called, the final value will be used as a relative value instead.

Example: Move the node by 100 pixels to the right.

func (Instance) AsTweener

func (self Instance) AsTweener() Tweener.Instance

func (Instance) From

func (self Instance) From(value any) Instance

Sets a custom initial value to the graphics.gd/classdb/PropertyTweener.

Example: Move the node from position (100, 100) to (200, 100).

func (Instance) FromCurrent

func (self Instance) FromCurrent() Instance

Makes the graphics.gd/classdb/PropertyTweener use the current property value (i.e. at the time of creating this graphics.gd/classdb/PropertyTweener) as a starting point. This is equivalent of using Instance.From with the current value. These two calls will do the same:

func (Instance) ID

func (self Instance) ID() ID

func (Instance) SetCustomInterpolator

func (self Instance) SetCustomInterpolator(interpolator_method func(Float.X) Float.X) Instance

Allows interpolating the value with a custom easing function. The provided 'interpolator_method' will be called with a value ranging from 0.0 to 1.0 and is expected to return a value within the same range (values outside the range can be used for overshoot). The return value of the method is then used for interpolation between initial and final value. Note that the parameter passed to the method is still subject to the tweener's own easing.

func (Instance) SetDelay

func (self Instance) SetDelay(delay Float.X) Instance

Sets the time in seconds after which the graphics.gd/classdb/PropertyTweener will start interpolating. By default there's no delay.

func (Instance) SetEase

func (self Instance) SetEase(ease Tween.EaseType) Instance

Sets the type of used easing from [Tween.EaseType]. If not set, the default easing is used from the graphics.gd/classdb/Tween that contains this Tweener.

func (*Instance) SetObject

func (self *Instance) SetObject(obj [1]gd.Object) bool

func (Instance) SetTrans

func (self Instance) SetTrans(trans Tween.TransitionType) Instance

Sets the type of used transition from [Tween.TransitionType]. If not set, the default transition is used from the graphics.gd/classdb/Tween that contains this Tweener.

func (Instance) Virtual

func (self Instance) Virtual(name string) reflect.Value

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL