# GDScript: Effects

Source: https://tweens.gd/gdscript/effects/

Some functions hit different...

Use `Tweens.FX` for pre-made motions that react, jitter, or breathe. Its factories create reusable functions; a tween supplies their duration and playback.

You can also write your own, see [Functions](https://tweens.gd/gdscript/functions).

## Pre-made effects

Punch

`Tweens.FX.punch()`

A damped oscillation for impacts and recoil. Starts and ends at rest with the default phase.

Shake

`Tweens.FX.shake()`

Seeded noise for rumble and jitter. Reuse a seed to reproduce the same shape.

Breathe

`Tweens.FX.breathe()`

A smooth rise and fall for a gentle pulse. One whole cycle returns to rest.

## Add a punch

```gdscript
var recoil := Tweens.position_2d_x()
recoil.by_value = 12.0
recoil.duration = 0.4
recoil.ease_function = Tweens.FX.punch(6.0)

Tweens.play(sprite, recoil)
```

The sprite oscillates along X and returns to its baseline. The offset supplies strength; the factory’s default amplitude is 1.

## Tune the feel

| Setting | Change it to… |
| --- | --- |
| Frequency | Fit more oscillations into the duration |
| Amplitude | Multiply the displacement |
| Decay | Make punch or shake fade faster |
| Attack | Ease into punch or shake before fading out |

Frequency belongs to the whole tween

A frequency of 6 means six cycles over the duration, not six per second. For a rate per second, multiply the rate by the duration.

For independent axes, use `shake_2d`, `punch_3d`, or `breathe_quaternion`. These return vector or rotation offsets: sample them in a callback or custom interpolator rather than the scalar ease slot.

Plan for interruption

Cancelling keeps the current sample. For an effect that must always return to rest, use a dedicated visual child and restore its baseline in a finally callback. Cancel an existing effect before starting another on that child.

The [effect reference](https://tweens.gd/gdscript/api/effects/) shows vector sampling, restoration, and all factory arguments. For a shape of your own, write an [ease function](https://tweens.gd/gdscript/functions/) or draw a [curve](https://tweens.gd/gdscript/curves/).
