# C#: Core API

Source: https://tweens.gd/csharp/api/

A definition describes a motion, starting it returns a handle, and the handle controls that one playback. These pages list every member of each, with the exact rules the guides leave out. [Anatomy of a Tween](https://tweens.gd/csharp/anatomy/) draws every field.

Examples use `using Godot;` and `using tweens.gd;`, which also covers definitions such as `Tweens.Position2D`.

## Find a page

Describe

-   [Definitions](https://tweens.gd/csharp/api/definitions/): `Tweens.*` and `TweenOptions`
-   [Endpoints & variations](https://tweens.gd/csharp/api/endpoints/): `From`, `To`, `By`, factors
-   [Timing](https://tweens.gd/csharp/api/timing/): `Duration`, `Repeats`, `FillMode`
-   [Callbacks](https://tweens.gd/csharp/api/callbacks/): `OnAdd` through `OnFinally`

Shape

-   [Easing](https://tweens.gd/csharp/api/easing/): `EaseType`, `BlendType`, curves
-   [Effects](https://tweens.gd/csharp/api/effects/): punch, shake, and breathe

Play

-   [Starting playback](https://tweens.gd/csharp/api/start/): `Tween()`, `PlaybackOptions`
-   [Handles](https://tweens.gd/csharp/api/handles/): `TweenInstance`, `Reason`
-   [Groups](https://tweens.gd/csharp/api/groups/): parallel steps
-   [Chains](https://tweens.gd/csharp/api/chains/): linked timelines

Extend

-   [Custom definitions](https://tweens.gd/csharp/api/custom/): `TweenDefinition`
-   [Scheduler](https://tweens.gd/csharp/api/scheduler/): `TweenScheduler`
-   [Catalog](https://tweens.gd/csharp/nodes/): every built-in definition

## Coming from Godot’s Tween

Both blink a sprite out three times:

Godot's Tween

```csharp
var tween = sprite.CreateTween().SetLoops(3);
tween.TweenProperty(sprite, "modulate:a", 0f, 0.2).From(1f);
```

tweens.gd

```csharp
var blink = new Tweens.ModulateAlpha(0, 0.2) { From = 1, Repeats = 2 };

sprite.Tween(blink);
```

| Godot’s `Tween` | tweens.gd |
| --- | --- |
| `TweenProperty(...)` | A [definition](https://tweens.gd/csharp/api/definitions/), started with `node.Tween(definition)` |
| `From(value)`, `AsRelative()` | [`From`](https://tweens.gd/csharp/api/endpoints/#from), [`By`](https://tweens.gd/csharp/api/endpoints/#by) |
| `SetTrans(...)`, `SetEase(...)` | One [`Ease`](https://tweens.gd/csharp/api/easing/#ease), such as `Out.Cubic` |
| `SetDelay(seconds)` | [`Delay`](https://tweens.gd/csharp/api/timing/#delay) |
| `SetLoops(count)` | [`Repeats`](https://tweens.gd/csharp/api/timing/#repeats), which counts cycles after the first: `SetLoops(3)` is `Repeats = 2`, and `SetLoops()` is `TweenOptions.Infinite` |
| A second tween back to the start | [`PingPong`](https://tweens.gd/csharp/api/timing/#pingpong) |
| `SetParallel()`, `Parallel()` | `node.Tween(first, second)`, or [`Group.Of`](https://tweens.gd/csharp/api/groups/) |
| Tweeners in sequence, `TweenInterval(seconds)` | [`node.Chain([...])`](https://tweens.gd/csharp/api/chains/), with a `Delay` on the next entry |
| `TweenCallback(...)` | A [callback](https://tweens.gd/csharp/api/callbacks/), such as `OnEnd` |
| `TweenMethod(...)` | `Tweens.Float` and the other [callback values](https://tweens.gd/csharp/nodes/values/) |
| `Finished` signal | `await handle.End`, which also resumes when playback stops early |
| `Pause()`, `Play()`, `Kill()` | `Pause()`, `Resume()`, `Cancel()` |
| `SetProcessMode`, `SetPauseMode`, `SetIgnoreTimeScale` | [`PlaybackOptions`](https://tweens.gd/csharp/api/start/#playback-options) |
| `BindNode(node)` | The node you start on, or a resource tween’s [owner](https://tweens.gd/csharp/api/start/#on-a-resource) |

## Differences from GDScript

Both implementations share their timing, easing, grouping, and lifetime rules, and shared fixtures test both. The differences come from the languages:

| Area | C# | GDScript |
| --- | --- | --- |
| Names | PascalCase: `From`, `To`, `By` | snake\_case: `from_value`, `to_value`, `by_value` |
| Starts | `node.Tween(definition)`, `node.Tween(a, b)` | `Tweens.play(node, definition)`, `Tweens.play_all(node, [a, b])` |
| Definitions | Immutable values, varied with `with` | Mutable objects, varied with `with_*()` copies |
| Type checks | Generic `TweenInstance<TTarget, TValue>`, checked by the compiler | Target class and value type checked when playback starts |
| Failures | Awaiting faults with an exception; `Error` holds it | Awaiting `end` returns `FAILED`; `error` holds a message |
| Script errors | Exceptions from callbacks and setters fault the tween | Detected problems become `FAILED`; other errors stay Godot script errors |
| Integer values | Saturate at 32-bit limits | Saturate at signed 64-bit limits; shader integers stay 32-bit |
| Callbacks | Synchronous | Synchronous; await `end` from a separate coroutine instead of inside one |

See the [GDScript core API](https://tweens.gd/gdscript/api/) for its entry points.
