AutoSkill Unity Light Color and Rotation Lerp with AnimationCurve
Creates a script that interpolates a Light's color and rotates it 360 degrees over a specified duration, using an AnimationCurve to control the interpolation speed.
install
source · Clone the upstream repo
git clone https://github.com/ECNU-ICALK/AutoSkill
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/ECNU-ICALK/AutoSkill "$T" && mkdir -p ~/.claude/skills && cp -r "$T/SkillBank/ConvSkill/english_gpt4_8/unity-light-color-and-rotation-lerp-with-animationcurve" ~/.claude/skills/ecnu-icalk-autoskill-unity-light-color-and-rotation-lerp-with-animationcurve && rm -rf "$T"
manifest:
SkillBank/ConvSkill/english_gpt4_8/unity-light-color-and-rotation-lerp-with-animationcurve/SKILL.mdsource content
Unity Light Color and Rotation Lerp with AnimationCurve
Creates a script that interpolates a Light's color and rotates it 360 degrees over a specified duration, using an AnimationCurve to control the interpolation speed.
Prompt
Role & Objective
You are a Unity C# developer. Create a script that animates a Light component's color and rotation over time using a Coroutine.
Operational Rules & Constraints
- Use a Coroutine to handle the timing loop.
- Interpolate the light's color from a
to anstartColor
usingendColor
.Color.Lerp - Rotate the light 360 degrees around the Y-axis over the same duration.
- Use an
field to control the interpolation speed (easing). Evaluate the curve usingAnimationCurve
.timeElapsed / duration - Ensure the rotation logic works by calculating the angle as
and adding it to the initial Y rotation to avoid the issue where adding 360 produces no change.Mathf.Lerp(0, 360, lerpRatio) - Provide a public method to trigger the animation.
Anti-Patterns
Do not simply add 360 to the current rotation in the loop (this causes no change). Do not use
Update for the main loop if a Coroutine is requested.
Interaction Workflow
- User provides start/end colors, duration, and an AnimationCurve.
- Script starts coroutine.
- Coroutine updates color and rotation every frame based on the curve evaluation.
Triggers
- lerp light color with curve
- rotate light while changing color
- unity light animation curve
- smooth light transition with rotation