Demos/AnimationShowcase/Sections/FromCurveSection.cs
using Goo;
using Goo.Animation;
using Sandbox.UI;
using static Sandbox.DemoTokens;
namespace Sandbox.AnimationShowcase;
public class FromCurveSection
{
const float RowW = 480f + 16f + 240f;
const float RowH = 120f;
static readonly Tween FCLinear = Tween.FromCurve( Sandbox.Curve.Linear, duration: 1.0f ).PingPong().Loop();
static readonly Tween FCEase = Tween.FromCurve( Sandbox.Curve.Ease, duration: 1.0f ).PingPong().Loop();
static readonly Tween FCEaseIn = Tween.FromCurve( Sandbox.Curve.EaseIn, duration: 1.0f ).PingPong().Loop();
static readonly Tween FCEaseOut = Tween.FromCurve( Sandbox.Curve.EaseOut, duration: 1.0f ).PingPong().Loop();
public Container Build()
{
float t = Time.Now;
return Section.Build(
"tween from curve - continuous",
new Container
{
Width = RowW,
Height = RowH,
BackgroundColor = BgCard,
BorderRadius = Radius2,
FlexDirection = FlexDirection.Row,
Gap = Space4,
Padding = Space4,
Children =
{
PulseCell.Build( "Curve.Linear", FCLinear.Eval( t ), Accent ),
PulseCell.Build( "Curve.Ease", FCEase.Eval( t ), AccentGreen ),
PulseCell.Build( "Curve.EaseIn", FCEaseIn.Eval( t ), AccentOrange ),
PulseCell.Build( "Curve.EaseOut", FCEaseOut.Eval( t ), AccentYellow ),
},
} );
}
}