-
Notifications
You must be signed in to change notification settings - Fork 11
Call With Code
Enes Kaplan edited this page Jul 9, 2024
·
1 revision
The Shaker class extends Node and provides methods for applying various shake effects to nodes in a 2D or 3D environment.
extends NodeApplies a shake effect to a node using a specified preset.
| Parameter | Type | Description |
|---|---|---|
| preset | ShakerPresetBase | The shake preset to apply |
| node | Node | The target node to shake |
| duration | float | Duration of the shake effect |
| speed | float | Speed of the shake (default: 1.0) |
| intensity | float | Intensity of the shake (default: 1.0) |
| fade_in | float | Fade-in duration (default: 0.25) |
| fade_out | float | Fade-out duration (default: 2.0) |
var _preset:ShakerPreset3D = load("res://addons/shaker/data/resources/strong_shake.tres")
Shaker.shake_by_preset(_preset, self, 1.0, 1.0)This method does not return a value.
Applies a shake effect to a specific property of a node.
| Parameter | Type | Description |
|---|---|---|
| property | ShakerProperty | The property to shake |
| node | Node | The target node |
| duration | float | Duration of the shake effect |
| speed | float | Speed of the shake (default: 1.0) |
| intensity | float | Intensity of the shake (default: 1.0) |
| fade_in | float | Fade-in duration (default: 0.25) |
| fade_out | float | Fade-out duration (default: 2.0) |
Shaker.shake_property(ShakerProperty.new("offset_y", ShakerTypeSineWave1D.new()), self, 1.0, 1.0)Returns a ShakerComponent instance.
Creates a 3D shake emitter at a specified position.
| Parameter | Type | Description |
|---|---|---|
| position | Vector3 | The global position of the emitter |
| preset | ShakerPreset3D | The shake preset to use |
| max_distance | float | Maximum distance of effect |
| duration | float | Duration of the shake effect |
| distance_attenuation | float | Attenuation over distance (default: 0.5) |
| speed | float | Speed of the shake (default: 1.0) |
| fade_in | float | Fade-in duration (default: 0.25) |
| fade_out | float | Fade-out duration (default: 2.0) |
var _preset:ShakerPreset3D = load("res://addons/shaker/data/resources/strong_shake.tres")
Shaker.shake_emit_3d(explosion.global_position, _preset, 6, 1.0)Returns a ShakerEmitter3D instance.
Creates a 2D shake emitter at a specified position.
| Parameter | Type | Description |
|---|---|---|
| position | Vector2 | The global position of the emitter |
| preset | ShakerPreset2D | The shake preset to use |
| max_distance | float | Maximum distance of effect |
| duration | float | Duration of the shake effect |
| distance_attenuation | float | Attenuation over distance (default: 0.5) |
| speed | float | Speed of the shake (default: 1.0) |
| fade_in | float | Fade-in duration (default: 0.25) |
| fade_out | float | Fade-out duration (default: 2.0) |
# Load or create a ShakerPreset2D
var preset_2d:ShakerPreset2D = load("res://path/to/your/2d_preset.tres")
Shaker.shake_emit_2d(explosion2d.global_position, preset_2d, 128, 1.0)Returns a ShakerEmitter2D instance.