Codruts Animation Library https://www.codrutsoft.com/
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Codrut deb063484e Added new demo
Added a demo showcasing a few features of the animation library.
2024-12-28 21:12:04 +02:00
Demo Added new demo 2024-12-28 21:12:04 +02:00
Source Feature and ease of use updae 2024-12-28 20:07:14 +02:00
.gitignore Feature and ease of use updae 2024-12-28 20:07:14 +02:00
CodAnimationLib.dpk Minor fix 2024-07-22 15:17:23 +03:00
CodAnimationLib.dproj Minor fix 2024-07-22 15:17:23 +03:00
CodAnimationLib.dproj.local Feature and ease of use updae 2024-12-28 20:07:14 +02:00
CodAnimationLib.identcache New latency compensation 2024-07-31 12:38:04 +03:00
CodAnimationLib.res Async update 2024-07-22 15:10:54 +03:00
Icons.dcr First commit 2024-03-01 11:22:13 +02:00
LICENSE Initial commit 2024-03-01 11:17:58 +02:00
README.md Update README.md 2024-07-22 15:15:13 +03:00

Codrut-Animation-Lib

Codruts Animation Library is a simple component-based animation library for Delphi VCL. It's similar to the official FMX counterpart.

It can also support sub-classes!

If a property like top works, you can also use margin.top to change the sub-property of the class margin! You can also use as many sub-classes as you wish. Like Button1.Margin.Interior.Size.Left!

Component

Image Description
Example The animation control on the form
Inspector To make the animation work, first select a component to animate, the animation, the start and end value and the property to change

Start / stop animation

You can change the Running property, or use the Start or Stop procedures.

You may also pause the animation using the Paused property.

Properties

Property Type Description
Component TComponent The component of which the property will be changed (optional)
CurrentValue {AnimationType} The current animation value (Read-only)
Delay Single The time waited before the animation actually starts in seconds, also can be in-between loops
DelayLoop Toggle to wait the Delay amout inbetween loops
Duration Single The animation duration
EndValue {AnimationType} The end value
Inverse Boolean Execute from End to Start
Kind TAnimationKind The animation function used
Loop Boolean Restart the animation on end
LoopInverse Boolean Toggle the inverse property on loop
Percent Single The percentage of the animation being finalised (Read-only)
PropertyName String The property to change. Can also access properties of sub-classes with the . separator. (optional)
StartFromCurrent Boolean Defines if the start value is determined by the current Component Value (Requires component and PropertyName)
StartValue {AnimationType} The value from which the animation starts. Can be overriden by StartFromCurrent
Steps Integer Set a custom steps value for the animation, instead of auto-calculating them. The less steps the greater the drawing performance

Animation types

  • Linear
  • Exponential
  • Pulse
  • Random
  • ReverseExpo
  • Sinus
  • SinusAr
  • Wobblyc
  • Spring

Note: Pulse and Wobbly do not reach their end value, as they return back to their start value.

Async animation example

You can use Async animations with the TAsyncAnim class. These, unlike the standard TIntAnim and TFloatAnim, are not components so you can easily use them wherever you'd like In your code. They run in the thread that called them until they finalise.

with TAsyncIntAnim.Create do
    try
      StartValue := Screen.DesktopRect.Left;
      EndValue := Screen.DesktopRect.Right-Self.Width;

      Duration := 1.00; // seconds
      Kind := TAnimationKind.ReverseExpo;

      // Events
      OnValue := procedure(Value: integer) begin
        Left := Value;
      end;

      // Start
      Start;
    finally
      Free;
    end;

Use without component

  1. Assign the OnStep notify event from the Object Inspector.
  2. Get the CurrentValue property from the Sender
  3. Use the value as needed Example:
  procedure TForm1.NewAnimation1Step(Sender: TObject; Step, TotalSteps: Integer);
  var
    Value: integer;
  begin
    Value := TIntAnim(Sender).CurrentValue;
  
    // now use the value
  end;

Animation

Animation