Reference Easings
Declared in Codebot.Animation.pas on line 89
Provides access to
{ TEasing is the function prototype for change over time }
type
TEasing = function(Percent: Float): Float;
{ TEasingDefaults provides some default easing functions which conform to the }
TEasingDefaults = record
public
{ The default easing function with no interpolation }
class function Linear(Percent: Float): Float; static;
{ Slow, fast, then slow }
class function Easy(Percent: Float): Float; static;
{ Real slow, fast, then real slow }
class function EasySlow(Percent: Float): Float; static;
{ Wind up slow, fast, then overshoot and wind down slow }
class function Extend(Percent: Float): Float; static;
{ Slow then fast }
class function Drop(Percent: Float): Float; static;
{ Real slow then fast }
class function DropSlow(Percent: Float): Float; static;
{ Slow, then fast with a slight overshoot }
class function Snap(Percent: Float): Float; static;
{ Slow, fast, then bounce a few times }
class function Bounce(Percent: Float): Float; static;
{ Slow, fast, then bounce a few more times }
class function Bouncy(Percent: Float): Float; static;
{ Fast, then rebound slowly down }
class function Rubber(Percent: Float): Float; static;
{ Fast, then rebound fast }
class function Spring(Percent: Float): Float; static;
{ Fast, then rebound really fast }
class function Boing(Percent: Float): Float; static;
end;
{ TEasings is a dictionary which stores easings by name }
TEasings = class(TDictionary<string, TEasing>);
{ Calculates the percent change of an easing, optionally reversing the curve }
function Interpolate(Easing: TEasing; Percent: Float; Reverse: Boolean = False): Float; overload;
{ Calculates the effect of an easing on values, optionally reversing the curve }
function Interpolate(Easing: TEasing; Percent: Float; Start, Finish: Float; Reverse: Boolean = False): Float; overload;
{ Provides access to }
function Easings: TEasings;
{ IDependencyProperty allows vector properties to be detached from their
owning objects }
type
IDependencyProperty = interface
public
{ Get a component value }
function GetValue(Index: Integer): Float;
{ Set a component value }
procedure SetValue(Value: Float; Index: Integer);
{ Returns the number of component values }
property Count: Integer read GetCount;
end;
{ TDependencyChangeNotify allows objects which own dependency properties to be
notified when the property values are updated by other code }
TDependencyChangeNotify = procedure(Prop: IDependencyProperty; Index: Integer) of object;
{ TVec1Prop is a 1 component dependency property }
TVec1Prop = record
public
{ Link the property to its own storage optionally notifying OnChange when
its value is changed }
procedure Link(OnChange: TDependencyChangeNotify = nil); overload;
{ Link the property to a component of another dependency property }
procedure Link(Prop: IDependencyProperty; Index: LongInt); overload;
{ Detach the property from its storage }
procedure Unlink;
{ Returns true if the property is linked }
function Linked: Boolean;
{ Returns true if the values are equal }
function Equals(const A: TVec1Prop): Boolean;
{ Returns true if both properties refer to the same storage }
function Same(const A: TVec1Prop): Boolean;
{ The component as a property }
property X: TVec1Prop index 0 read GetVec write SetVec;
{ The current value }
property Value: TVec1 read GetValue write SetValue;
{ Components by index }
property Vec[Index: Integer]: TVec1Prop read GetVec write SetVec;
end;
{ TVec2Prop is a 2 component dependency property }
TVec2Prop = record
public
{ Link the property to its own storage optionally notifying OnChange when
its value is changed }
procedure Link(OnChange: TDependencyChangeNotify = nil); overload;
{ Link the property to a component of another dependency property }
procedure Link(Prop: IDependencyProperty; Index: LongInt); overload;
{ Detach the property from its storage }
procedure Unlink;
{ Returns true if the property is linked }
function Linked: Boolean;
{ Components as properties }
property X: TVec1Prop index 0 read GetVec write SetVec;
property Y: TVec1Prop index 1 read GetVec write SetVec;
{ The first component as a property }
property AsVec1: TVec1Prop index 0 read GetVec write SetVec;
{ The current value }
property Value: TVec2 read GetValue write SetValue;
{ Components by index }
property Vec[Index: Integer]: TVec1Prop read GetVec write SetVec;
end;
{ TVec3Prop is a 3 component dependency property }
TVec3Prop = record
public
{ Link the property to its own storage optionally notifying OnChange when
its value is changed }
procedure Link(OnChange: TDependencyChangeNotify = nil); overload;
{ Link the property to a component of another dependency property }
procedure Link(Prop: IDependencyProperty; Index: LongInt); overload;
{ Detach the property from its storage }
procedure Unlink;
{ Returns true if the property is linked }
function Linked: Boolean;
{ Components as properties }
property X: TVec1Prop index 0 read GetVec write SetVec;
property Y: TVec1Prop index 1 read GetVec write SetVec;
property Z: TVec1Prop index 2 read GetVec write SetVec;
{ Components as rotation properties }
property Pitch: TVec1Prop index 0 read GetVec write SetVec;
property Heading: TVec1Prop index 1 read GetVec write SetVec;
property Roll: TVec1Prop index 2 read GetVec write SetVec;
{ The first two components as a property }
property XY: TVec2Prop read GetAsVec2 write SetAsVec2;
{ The leading components as smaller properties }
property AsVec1: TVec1Prop index 0 read GetVec write SetVec;
property AsVec2: TVec2Prop read GetAsVec2 write SetAsVec2;
{ The current value }
property Value: TVec3 read GetValue write SetValue;
{ Components by index }
property Vec[Index: Integer]: TVec1Prop read GetVec write SetVec;
end;
{ TVec4Prop is a 4 component dependency property }
TVec4Prop = record
public
{ Link the property to its own storage optionally notifying OnChange when
its value is changed }
procedure Link(OnChange: TDependencyChangeNotify = nil); overload;
{ Link the property to a component of another dependency property }
procedure Link(Prop: IDependencyProperty; Index: LongInt); overload;
{ Detach the property from its storage }
procedure Unlink;
{ Returns true if the property is linked }
function Linked: Boolean;
{ Components as properties }
property X: TVec1Prop index 0 read GetVec write SetVec;
property Y: TVec1Prop index 1 read GetVec write SetVec;
property Z: TVec1Prop index 2 read GetVec write SetVec;
property W: TVec1Prop index 3 read GetVec write SetVec;
{ Components as color channel properties }
property Red: TVec1Prop index 0 read GetVec write SetVec;
property Green: TVec1Prop index 1 read GetVec write SetVec;
property Blue: TVec1Prop index 2 read GetVec write SetVec;
property Alpha: TVec1Prop index 3 read GetVec write SetVec;
{ Components as texture coordinate properties }
property S0: TVec1Prop index 0 read GetVec write SetVec;
property T0: TVec1Prop index 1 read GetVec write SetVec;
property S1: TVec1Prop index 2 read GetVec write SetVec;
property T1: TVec1Prop index 3 read GetVec write SetVec;
{ The leading components as smaller properties }
property XY: TVec2Prop read GetAsVec2 write SetAsVec2;
property XYZ: TVec3Prop read GetAsVec3 write SetAsVec3;
property RGB: TVec3Prop read GetAsVec3 write SetAsVec3;
property AsVec1: TVec1Prop index 0 read GetVec write SetVec;
property AsVec2: TVec2Prop read GetAsVec2 write SetAsVec2;
property AsVec3: TVec3Prop read GetAsVec3 write SetAsVec3;
{ The current value }
property Value: TVec4 read GetValue write SetValue;
{ Components by index }
property Vec[Index: Integer]: TVec1Prop read GetVec write SetVec;
end;
{ Link a dependency property }
procedure DependencyLink(var Prop: IDependencyProperty; Count: Integer; OnChange: TDependencyChangeNotify);
{ Unlink a dependency property }
procedure DependencyUnlink(var Prop: IDependencyProperty);
{ TAnimationTimer is a high performance timer fixed at 60 frames per second }
type
TAnimationTimer = class(TComponent)
public
{ Create a new animation timer }
constructor Create(AOwner: TComponent); override;
{ Stop and destroy the timer }
destructor Destroy; override;
published
{ Start or stop the timer using enabled }
property Enabled: Boolean read FEnabled write SetEnabled default False;
{ OnTimer is fired every 1/60 of a second when enabled }
property OnTimer: TNotifyEvent read FOnTimer write FOnTimer;
end;
{ Provides access to the shared }
function Animator: TAnimator;See also
Float in Codebot.System.pas
TDictionary<K,V> in Codebot.Collections.pas
TVec1 in Codebot.Geometry.pas
TVec2 in Codebot.Geometry.pas
TVec3 in Codebot.Geometry.pas
TVec4 in Codebot.Geometry.pas