Skip to content

A basic tweening/animation library for Free Pascal.

License

Notifications You must be signed in to change notification settings

glhrmfrts/wetween

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

wetween

A basic tweening/animation library for Free Pascal.

Example usage

var
  Tweens: TWeManager;
  RotationTween: TWeTween;
  RotationEndedEvent: TWeEvent;
  ReverseRotationTween: TWeTween;
  SecondsPassed: Single;

  MyRotationAngle: Single;

  procedure SetTweenRotation(constref Values: array of Single);
  begin
    MyRotationAngle := Values[0];
  end;

begin
  Tweens := TWeManager.Create(Self);

  RotationTween := Tweens.RootTimeline.NewTweenAtEnd;
  RotationTween.Start[0] := 0.0;
  RotationTween.Stop[0] := -PI/2.0;
  RotationTween.Duration := 0.5;
  RotationTween.Easing := weEaseInQuart;
  RotationTween.ValueCallback := @SetTweenRotation;

  RotationEndedEvent := Tweens.RootTimeline.NewEventAtEnd;
  RotationEndedEvent.ObjectCallback := @DoAttack;

  ReverseRotationTween := AttackRotationTween.Reverse;
  ReverseRotationTween.ValueCallback := @SetTweenRotation;
  Tweens.RootTimeline.InsertAtEnd(ReverseRotationTween);

  Tweens.RootTimeline.Playing := true;

  { Some main loop (i.e. in a game engine) }

  while true do
  begin
    SecondsPassed := GetSecondsPassed();
    Tweens.Update(SecondsPassed);
  end;
end.

LICENSE

MIT

About

A basic tweening/animation library for Free Pascal.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages