camera shake ease
This commit is contained in:
parent
17b89dfff1
commit
f79dc4544f
|
|
@ -175,7 +175,7 @@ namespace HeavenStudio
|
||||||
|
|
||||||
UpdateCameraTranslate();
|
UpdateCameraTranslate();
|
||||||
UpdateCameraRotate();
|
UpdateCameraRotate();
|
||||||
SetShakeIntensity();
|
UpdateShakeIntensity();
|
||||||
UpdateCameraColor();
|
UpdateCameraColor();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -183,7 +183,7 @@ namespace HeavenStudio
|
||||||
{
|
{
|
||||||
UpdateCameraTranslate();
|
UpdateCameraTranslate();
|
||||||
UpdateCameraRotate();
|
UpdateCameraRotate();
|
||||||
SetShakeIntensity();
|
UpdateShakeIntensity();
|
||||||
UpdateCameraColor();
|
UpdateCameraColor();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -323,19 +323,20 @@ namespace HeavenStudio
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetShakeIntensity()
|
private void UpdateShakeIntensity()
|
||||||
{
|
{
|
||||||
foreach (var e in shakeEvents)
|
foreach (var e in shakeEvents)
|
||||||
{
|
{
|
||||||
float prog = Conductor.instance.GetPositionFromBeat(e.beat, e.length);
|
float prog = Conductor.instance.GetPositionFromBeat(e.beat, e.length);
|
||||||
|
float fac = Mathf.Cos(Time.time * 80f) * 0.5f;
|
||||||
if (prog >= 0f)
|
if (prog >= 0f)
|
||||||
{
|
{
|
||||||
float fac = Mathf.Cos(Time.time * 80f) * 0.5f;
|
Util.EasingFunction.Function func = Util.EasingFunction.GetEasingFunction((Util.EasingFunction.Ease) e["ease"]);
|
||||||
ShakeResult = new Vector3(fac * e["valA"], fac * e["valB"]);
|
ShakeResult = new Vector3(fac * func(e["easedA"], e["valA"], Mathf.Min(prog, 1f)), fac * func(e["easedB"], e["valB"], Mathf.Min(prog, 1f)));
|
||||||
}
|
}
|
||||||
if (prog > 1f)
|
if (prog > 1f)
|
||||||
{
|
{
|
||||||
ShakeResult = new Vector3(0, 0);
|
ShakeResult = new Vector3(fac * e["valA"], fac * e["valB"]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -962,8 +962,14 @@ namespace HeavenStudio
|
||||||
new GameAction("screen shake", "Screen Shake", 1f, true,
|
new GameAction("screen shake", "Screen Shake", 1f, true,
|
||||||
new List<Param>()
|
new List<Param>()
|
||||||
{
|
{
|
||||||
new Param("valA", new EntityTypes.Float(0, 10, 0), "Horizontal Intensity", "Set the horizontal intensity of the screen shake."),
|
new Param("easedA", new EntityTypes.Float(0, 10, 0), "Start Horizontal Intensity", "Set the horizontal intensity of the screen shake at the start of the event."),
|
||||||
new Param("valB", new EntityTypes.Float(0, 10, 1), "Vertical Intensity", "Set the vertical intensity of the screen shake.")
|
new Param("easedB", new EntityTypes.Float(0, 10, 0.5f), "Start Vertical Intensity", "Set the vertical intensity of the screen shake at the start of the event."),
|
||||||
|
new Param("valA", new EntityTypes.Float(0, 10, 0), "End Horizontal Intensity", "Set the horizontal intensity of the screen shake at the end of the event."),
|
||||||
|
new Param("valB", new EntityTypes.Float(0, 10, 0.5f), "End Vertical Intensity", "Set the vertical intensity of the screen shake at the end of the event."),
|
||||||
|
new("ease", Util.EasingFunction.Ease.Linear, "Ease", "Set the easing of the action.", new()
|
||||||
|
{
|
||||||
|
new((x, y) => (Util.EasingFunction.Ease)x != Util.EasingFunction.Ease.Instant, new string[] { "easedA", "easedB" })
|
||||||
|
}),
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
new GameAction("display textbox", "Display Textbox", 1f, true, new List<Param>()
|
new GameAction("display textbox", "Display Textbox", 1f, true, new List<Param>()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue