feat(effects): add Darkness action effect like freeze

Adds a fullscreen darkness vignette on click and a permanent shadow spot with a black radial gradient (40% edge, 100% center). Includes control panel UI, i18n, eraser support, and tests.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Ivan Fontosh
2026-07-02 16:37:06 +08:00
parent 97c77a025a
commit 657e3c862e
8 changed files with 286 additions and 10 deletions
+23 -2
View File
@@ -3,6 +3,7 @@ export type EffectToolType =
| 'fire'
| 'rain'
| 'water'
| 'darkness'
| 'lightning'
| 'sunbeam'
| 'poisonCloud'
@@ -14,12 +15,14 @@ export type EffectInstanceType =
| 'fire'
| 'rain'
| 'water'
| 'darkness'
| 'lightning'
| 'sunbeam'
| 'poisonCloud'
| 'freeze'
| 'scorch'
| 'ice';
| 'ice'
| 'shadow';
/** Нормализованные координаты (0..1) относительно области предпросмотра/презентации. */
export type NPoint = { x: number; y: number; tMs: number; pressure?: number };
@@ -65,6 +68,13 @@ export type WaterInstance = EffectInstanceBase & {
lifetimeMs: number | null;
};
export type DarknessInstance = EffectInstanceBase & {
type: 'darkness';
at: { x: number; y: number };
intensity: number;
lifetimeMs: number;
};
export type LightningInstance = EffectInstanceBase & {
type: 'lightning';
start: { x: number; y: number };
@@ -119,17 +129,28 @@ export type IceInstance = EffectInstanceBase & {
lifetimeMs: number | null;
};
export type ShadowInstance = EffectInstanceBase & {
/** Внутренний инстанс: тёмное пятно после эффекта «Тьма». */
type: 'shadow';
at: { x: number; y: number };
radiusN: number;
opacity: number;
lifetimeMs: number | null;
};
export type EffectInstance =
| FogInstance
| FireInstance
| RainInstance
| WaterInstance
| DarknessInstance
| LightningInstance
| SunbeamInstance
| PoisonCloudInstance
| FreezeInstance
| ScorchInstance
| IceInstance;
| IceInstance
| ShadowInstance;
export type EffectToolState = {
tool: EffectToolType;