Skip to content

Add configurable easing curve property to all effects#21

Draft
Copilot wants to merge 3 commits intomasterfrom
copilot/add-property-for-easing-curve
Draft

Add configurable easing curve property to all effects#21
Copilot wants to merge 3 commits intomasterfrom
copilot/add-property-for-easing-curve

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 24, 2026

All effects with time-varying intensity had their envelope shapes hard-coded (linear decay, trapezoid fade-in/out, SmoothStep, sine bell, etc.) with no way for users to change them in the editor.

Changes

Runtime support

  • Core/EntityCurveExtensions.cs — new GetAnimationCurve(this Entity, string key, AnimationCurve fallback) extension method; used in real game builds where the game's Entity may not expose this natively
  • Stubs/CiGameTypeStubs.cs — matching GetAnimationCurve instance method added to the CI stub Entity

Per-effect changes (14 effects)

Each effect receives:

  • ["easing_curve"] = DefaultEasingCurve() in CreateTemplate — default keyframes exactly replicate the previous hard-coded shape
  • entity.GetAnimationCurve("easing_curve", DefaultEasingCurve()) read in TrySchedule, passed through to Initialize
  • _easingCurve.Evaluate(progress) replacing all hard-coded envelope math in LateUpdate
// Before
float envelope;
if (progress < 0.2f)
    envelope = Mathf.SmoothStep(0f, 1f, Mathf.InverseLerp(0f, 0.2f, progress));
else if (progress > 0.8f)
    envelope = Mathf.SmoothStep(0f, 1f, 1f - Mathf.InverseLerp(0.8f, 1f, progress));
else
    envelope = 1f;

// After
var envelope = _easingCurve.Evaluate(progress);

Default curves (all backward-compatible)

Effect(s) Shape
Camera Shake Linear decay (0,1)→(1,0)
Camera Tilt Sine bell with matched tangents
Color Tint, Fog, HSL, Sepia, Vignette Linear trapezoid — 20% fade-in, hold, 20% fade-out
Letterbox, Pixel Grid, Scanlines, Screen Noise Linear trapezoid — 15% fade-in, hold, 15% fade-out
Zoom In, Zoom Out SmoothStep trapezoid — 20% ease-in, hold, 20% ease-out
Zoom Pulse Linear triangle peaking at 30%

Docs

docs/effects/README.md updated with easing_curve property entry for all 14 effects.

Original prompt

This section details on the original issue you should resolve

<issue_title>Add property for easing curve</issue_title>
<issue_description>All the effects that currently use easing curves (almost all of them) should have a property that allows user to configure it in the editor.
This will require a custom property editor for editing them (based on Unity animation curves if possible), like the Color property editor in Fireworks Festival.</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits February 24, 2026 21:31
Replace hard-coded envelope/easing logic in every effect runner with a
configurable AnimationCurve property named easing_curve.

- Add EntityCurveExtensions.cs with GetAnimationCurve extension method
- Add GetAnimationCurve stub to Entity in CiGameTypeStubs.cs
- For all 13 effects: add easing_curve to template properties, read it in
  TrySchedule, pass to runner Initialize, store in _easingCurve field, and
  use _easingCurve.Evaluate(progress) in LateUpdate
- Default curves exactly replicate the original hard-coded behaviour:
  - CameraShake: linear decay (0,1)→(1,0) tangents -1
  - CameraTilt: sine bell via keyframes at 0/0.5/1 with π tangents
  - ColorTint/Fog/Hsl/Sepia/Vignette: 20%/80% trapezoid slopes ±5
  - Letterbox/PixelGrid/Scanlines/ScreenNoise: 15%/85% trapezoid slopes ±20/3
  - ZoomIn/ZoomOut: SmoothStep 20%/80% trapezoid (all tangents 0)
  - ZoomPulse: triangle peaking at 30%, slopes 10/3 and -10/7

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…urve

Co-authored-by: Brollyy <12004018+Brollyy@users.noreply.github.com>
Copilot AI changed the title [WIP] Add property for configuring easing curves in effects Add configurable easing curve property to all effects Feb 24, 2026
Copilot AI requested a review from Brollyy February 24, 2026 21:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add property for easing curve

2 participants