MethodTweener

package
v0.0.0-...-357ca8a Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2025 License: MIT Imports: 25 Imported by: 0

Documentation

Overview

MethodTweener is similar to a combination of CallbackTweener and PropertyTweener. It calls a method providing an interpolated value as a parameter. See Tween.TweenMethod for more usage information.

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

Note: Tween.TweenMethod is the only correct way to create MethodTweener. Any MethodTweener 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
	AsMethodTweener() 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]) AsMethodTweener

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

func (*Extension[T]) AsObject

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

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.MethodTweener

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, method Callable.Function, from any, to any, duration Float.X) Instance

Creates and appends a [MethodTweener]. This method is similar to a combination of [method tween_callback] and [method tween_property]. It calls a method over time with a tweened value provided as an argument. The value is tweened between [param from] and [param to] over the time specified by [param duration], in seconds. Use [method Callable.bind] to bind additional arguments for the call. You can use [method MethodTweener.set_ease] and [method MethodTweener.set_trans] to tweak the easing and transition of the value or [method MethodTweener.set_delay] to delay the tweening. [b]Example:[/b] Making a 3D object look from one point to another point: [codeblocks] [gdscript] var tween = create_tween() tween.tween_method(look_at.bind(Vector3.UP), Vector3(-1, 0, -1), Vector3(1, 0, -1), 1.0) # The look_at() method takes up vector as second argument. [/gdscript] [csharp] Tween tween = CreateTween(); tween.TweenMethod(Callable.From((Vector3 target) => LookAt(target, Vector3.Up)), new Vector3(-1.0f, 0.0f, -1.0f), new Vector3(1.0f, 0.0f, -1.0f), 1.0f); // Use lambdas to bind additional arguments for the call. [/csharp] [/codeblocks] [b]Example:[/b] Setting the text of a [Label], using an intermediate method and after a delay: [codeblocks] [gdscript] func _ready():

var tween = create_tween()
tween.tween_method(set_label_text, 0, 10, 1.0).set_delay(1.0)

func set_label_text(value: int):

$Label.text = "Counting " + str(value)

[/gdscript] [csharp] public override void _Ready()

{
	base._Ready();

	Tween tween = CreateTween();
	tween.TweenMethod(Callable.From<int>(SetLabelText), 0.0f, 10.0f, 1.0f).SetDelay(1.0f);
}

private void SetLabelText(int value)

{
	GetNode<Label>("Label").Text = $"Counting {value}";
}

[/csharp] [/codeblocks]

func New

func New() Instance

func (Instance) AsMethodTweener

func (self Instance) AsMethodTweener() Instance

func (Instance) AsObject

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

func (Instance) AsRefCounted

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

func (Instance) AsTweener

func (self Instance) AsTweener() Tweener.Instance

func (Instance) ID

func (self Instance) ID() ID

func (Instance) SetDelay

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

Sets the time in seconds after which the MethodTweener 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 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 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