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
+4 -2
View File
@@ -43,13 +43,15 @@ export function minDistSqEffectToPoint(inst: EffectInstance, p: { x: number; y:
case 'lightning':
case 'sunbeam':
return distSqPointToSegment(p.x, p.y, inst.start.x, inst.start.y, inst.end.x, inst.end.y);
case 'freeze': {
case 'freeze':
case 'darkness': {
const dx = inst.at.x - p.x;
const dy = inst.at.y - p.y;
return dx * dx + dy * dy;
}
case 'scorch':
case 'ice':
case 'shadow':
case 'poisonCloud': {
const dx = inst.at.x - p.x;
const dy = inst.at.y - p.y;
@@ -61,7 +63,7 @@ export function minDistSqEffectToPoint(inst: EffectInstance, p: { x: number; y:
}
function eraseHitThresholdSq(inst: EffectInstance, toolRadiusN: number): number {
if (inst.type === 'scorch' || inst.type === 'ice' || inst.type === 'poisonCloud') {
if (inst.type === 'scorch' || inst.type === 'ice' || inst.type === 'shadow' || inst.type === 'poisonCloud') {
const r = toolRadiusN + inst.radiusN;
return r * r;
}