mirror of
https://github.com/Facepunch/sbox-public.git
synced 2026-05-31 02:05:41 -04:00
This commit imports the C# engine code and game files, excluding C++ source code. [Source-Commit: ceb3d758046e50faa6258bc3b658a30c97743268]
35 lines
931 B
C#
35 lines
931 B
C#
using Sandbox.MovieMaker;
|
|
|
|
namespace Editor.MovieMaker;
|
|
|
|
#nullable enable
|
|
|
|
partial record PropertySignal<T>
|
|
{
|
|
public PropertySignal<T> Blend( PropertySignal<T> second, float alpha )
|
|
{
|
|
if ( alpha <= 0f ) return this;
|
|
if ( alpha >= 1f ) return second;
|
|
|
|
if ( Equals( second ) )
|
|
{
|
|
return this;
|
|
}
|
|
|
|
return Interpolator.GetDefault<T>() is not null
|
|
? new BlendOperation<T>( this, second, alpha )
|
|
: this;
|
|
}
|
|
}
|
|
|
|
[JsonDiscriminator( "Blend" )]
|
|
file sealed record BlendOperation<T>( PropertySignal<T> First, PropertySignal<T> Second, float Alpha ) : InterpolateOperation<T>( First, Second )
|
|
{
|
|
public override float GetAlpha( MovieTime time ) => Alpha;
|
|
|
|
protected override PropertySignal<T> OnSmooth( MovieTime size ) =>
|
|
this with { First = First.Smooth( size ), Second = Second.Smooth( size ) };
|
|
|
|
public override bool CanSmooth( MovieTimeRange range ) => First.CanSmooth( range ) || Second.CanSmooth( range );
|
|
}
|