-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
AnyiQuack works now also with FMX, at least FMX on Windows. New Slidi…
…ngButtonFMX example to demonstrate the ability.
- Loading branch information
Showing
7 changed files
with
816 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
object MainForm: TMainForm | ||
Left = 0 | ||
Top = 0 | ||
ActiveControl = Button1 | ||
Caption = 'Click to slide the button' | ||
ClientHeight = 480 | ||
ClientWidth = 640 | ||
Position = ScreenCenter | ||
FormFactor.Width = 320 | ||
FormFactor.Height = 480 | ||
FormFactor.Devices = [Desktop] | ||
DesignerMasterStyle = 0 | ||
object Label1: TLabel | ||
Anchors = [akRight, akBottom] | ||
Position.X = 232.000000000000000000 | ||
Position.Y = 416.000000000000000000 | ||
Size.Width = 401.000000000000000000 | ||
Size.Height = 65.000000000000000000 | ||
Size.PlatformDefault = False | ||
TextSettings.HorzAlign = Trailing | ||
Text = | ||
'The X and Y properties of the Position are animated independentl' + | ||
'y. '#13#10'Try to hit the space key rapidly.' | ||
TabOrder = 2 | ||
end | ||
object XTrackBar: TTrackBar | ||
Anchors = [akRight, akBottom] | ||
CanParentFocus = True | ||
Max = 2000.000000000000000000 | ||
Min = 100.000000000000000000 | ||
Orientation = Horizontal | ||
Position.X = 352.000000000000000000 | ||
Position.Y = 368.000000000000000000 | ||
Size.Width = 281.000000000000000000 | ||
Size.Height = 19.000000000000000000 | ||
Size.PlatformDefault = False | ||
TabOrder = 5 | ||
Value = 500.000000000000000000 | ||
end | ||
object YTrackBar: TTrackBar | ||
Anchors = [akRight, akBottom] | ||
CanParentFocus = True | ||
Max = 2000.000000000000000000 | ||
Min = 100.000000000000000000 | ||
Orientation = Horizontal | ||
Position.X = 351.000000000000000000 | ||
Position.Y = 400.000000000000000000 | ||
Size.Width = 281.000000000000000000 | ||
Size.Height = 19.000000000000000000 | ||
Size.PlatformDefault = False | ||
TabOrder = 4 | ||
Value = 750.000000000000000000 | ||
end | ||
object Label2: TLabel | ||
Anchors = [akRight, akBottom] | ||
Position.X = 224.000000000000000000 | ||
Position.Y = 368.000000000000000000 | ||
TextSettings.HorzAlign = Trailing | ||
Text = 'X duration' | ||
TabOrder = 7 | ||
end | ||
object Label3: TLabel | ||
Anchors = [akRight, akBottom] | ||
Position.X = 224.000000000000000000 | ||
Position.Y = 400.000000000000000000 | ||
TextSettings.HorzAlign = Trailing | ||
Text = 'Y duration' | ||
TabOrder = 6 | ||
end | ||
object Button1: TButton | ||
Position.X = 240.000000000000000000 | ||
Position.Y = 200.000000000000000000 | ||
Size.Width = 137.000000000000000000 | ||
Size.Height = 73.000000000000000000 | ||
Size.PlatformDefault = False | ||
TabOrder = 0 | ||
Text = 'Slide' | ||
OnClick = Button1Click | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
unit Main; | ||
|
||
interface | ||
|
||
uses | ||
System.SysUtils, | ||
System.Types, | ||
System.UITypes, | ||
System.Classes, | ||
System.Variants, | ||
FMX.Types, | ||
FMX.Controls, | ||
FMX.Forms, | ||
FMX.Graphics, | ||
FMX.Dialogs, | ||
FMX.Controls.Presentation, | ||
FMX.StdCtrls, | ||
|
||
AnyiQuack, | ||
AQPSystemTypesAnimations; | ||
|
||
type | ||
TMainForm = class(TForm) | ||
Button1: TButton; | ||
Label1: TLabel; | ||
XTrackBar: TTrackBar; | ||
YTrackBar: TTrackBar; | ||
Label2: TLabel; | ||
Label3: TLabel; | ||
procedure Button1Click(Sender: TObject); | ||
end; | ||
|
||
var | ||
MainForm: TMainForm; | ||
|
||
implementation | ||
|
||
{$R *.fmx} | ||
|
||
procedure TMainForm.Button1Click(Sender: TObject); | ||
var | ||
TypesAniPlugin: TAQPSystemTypesAnimations; | ||
NewLeft, NewTop: Single; | ||
ButtonSender: TButton absolute Sender; | ||
begin | ||
TypesAniPlugin := Take(Sender) | ||
.CancelAnimations | ||
.Plugin<TAQPSystemTypesAnimations>; | ||
|
||
NewLeft := Random(Trunc(ClientWidth - ButtonSender.Width)); | ||
NewTop := Random(Trunc(ClientHeight - ButtonSender.Height)); | ||
|
||
TypesAniPlugin.SingleAnimation(NewLeft, | ||
function(RefObject: TObject): Single | ||
begin | ||
Result := TButton(RefObject).Position.X; | ||
end, | ||
procedure(RefObject: TObject; const NewLeft: Single) | ||
begin | ||
TButton(RefObject).Position.X := NewLeft; | ||
end, Trunc(XTrackBar.Value), 0, TAQ.Ease(etBack)); | ||
|
||
TypesAniPlugin.SingleAnimation(NewTop, | ||
function(RefObject: TObject): Single | ||
begin | ||
Result := TButton(RefObject).Position.Y; | ||
end, | ||
procedure(RefObject: TObject; const NewLeft: Single) | ||
begin | ||
TButton(RefObject).Position.Y := NewLeft; | ||
end, Trunc(YTrackBar.Value), 0, TAQ.Ease(etElastic)); | ||
end; | ||
|
||
end. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
program SlidingButton; | ||
|
||
uses | ||
System.StartUpCopy, | ||
FMX.Forms, | ||
Main in 'Main.pas' {MainForm}, | ||
AnyiQuack in '..\..\AnyiQuack.pas', | ||
AQPSystemTypesAnimations in '..\..\AQPSystemTypesAnimations.pas'; | ||
|
||
{$R *.res} | ||
|
||
begin | ||
Application.Initialize; | ||
Application.CreateForm(TMainForm, MainForm); | ||
Application.Run; | ||
end. |
Oops, something went wrong.