StepBlend
namespace Griff.Scenes;
public struct StepBlendHow far the frame being drawn is between the game’s last two steps, for drawing what changes once a step from a component’s own state rather than its transform (a particle’s place, a fade, a gauge’s needle), so it moves smoothly on a screen faster than the game steps. Ask a Drawing for its Blend (a system, Blend), and draw what something was as the last step began and what it is now Between; a value kept in a Smoothed remembers what it was by itself (see Of).
It follows the rules transforms are drawn by. Everything is drawn as it is (an Amount of 1) in the editor, while the game is paused, rewound or stepped by hand, on a scene’s first step, and for an entity that jumped in the last step (added, moved to another parent, teleported, or inside one that did). A point that moved further than a quarter of the view in one step, or a turn of more than 90 degrees, is drawn where it ends up.
Properties
Section titled “Properties”Amount
Section titled “Amount”public float Amount { get; }How far the frame is between the last step but one (0) and the last step (1). 1 when things are drawn as they are.
public static StepBlend AsIs { get; }Things drawn as they are now: in the editor, or a game held still.
IsBetween
Section titled “IsBetween”public bool IsBetween { get; }True when this frame is drawn between two steps, false when things are drawn as they are.
public long Step { get; }The game’s last step (its Frame as it ended), which this frame is drawn after: state a component keeps for itself counts as changed in it, as For says.
Methods
Section titled “Methods”Between
Section titled “Between”public float Between(float was, float now)A number between what it was as the last step began and what it is now.
Between
Section titled “Between”public Vector2 Between(Vector2 was, Vector2 now)A point between where it was as the last step began and where it is, or where it is if that’s a jump (see the remarks).
Between
Section titled “Between”public Vector3 Between(Vector3 was, Vector3 now)A point between where it was as the last step began and where it is, or where it is if that’s a jump (see the remarks).
Between
Section titled “Between”public Color Between(Color was, Color now)A color between what it was as the last step began and what it is now.
public StepBlend For(long step)This blend for state last stepped in step (a component that keeps what it was itself, the way particles do, notes the step it moved them in): as it is, unless that was the last step.
public static StepBlend For(Entity entity)The blend for what entity draws in the frame being drawn, for code that draws it without a Drawing (an IDrawEffect’s DrawTransform or Tint): AsIs while nothing is being drawn between steps.
public float Of(in Smoothed<float> value)The number value holds, drawn between what it was and is if it changed in the last step.
public Vector2 Of(in Smoothed<Vector2> value)The point value holds, drawn between where it was and is if it moved in the last step.
public Vector3 Of(in Smoothed<Vector3> value)The point value holds, drawn between where it was and is if it moved in the last step.
public Color Of(in Smoothed<Color> value)The color value holds, drawn between what it was and is if it changed in the last step.
public float Turn(float wasDegrees, float nowDegrees)An angle in degrees between what it was as the last step began and what it is now, turned the short way round (so one kept between -180 and 180 doesn’t spin back as it crosses over); a turn of more than 90 degrees is drawn where it ends up.
TurnOf
Section titled “TurnOf”public float TurnOf(in Smoothed<float> value)The angle in degrees value holds, turned as Turn does if it changed in the last step.