test/AnimatedSquashComponent.cs
public sealed class AnimatedSquashComponent : Component
{
[Property] public float SquashAmount { get; set; } = 0.2f;
[Property] public float SquashRate { get; set; } = 2.0f;
[Property] public float SpinSpeed { get; set; } = 0.0f;
protected override void OnUpdate()
{
var t = MathF.Sin( Time.Now * SquashRate );
var scaleZ = 1.0f + t * SquashAmount;
var scaleXY = 1.0f - t * SquashAmount * 0.5f;
LocalScale = new Vector3( scaleXY, scaleXY, scaleZ );
LocalRotation *= Rotation.FromAxis( Vector3.Up, SpinSpeed * Time.Delta );
}
}