Another update from ingydotnet^djgoku
This commit is contained in:
parent
91df62d461
commit
948b86eafa
7604 changed files with 108452 additions and 22726 deletions
26
Task/Animation/BASIC256/animation.basic256
Normal file
26
Task/Animation/BASIC256/animation.basic256
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
str$="Hello, World! "
|
||||
direction=0 #value of 0: to the right, 1: to the left.
|
||||
tlx=10 #Top left x
|
||||
tly=10 #Top left y
|
||||
fastgraphics
|
||||
font "Arial",20,100 #The Font configuration (Font face, size, weight)
|
||||
|
||||
main:
|
||||
while clickb=0
|
||||
if direction=0 then
|
||||
str$=RIGHT(str$,1) + LEFT(str$,length(str$)-1)
|
||||
else
|
||||
str$=MID(str$,2,length(str$)-1)+LEFT(str$,1)
|
||||
end if
|
||||
refresh
|
||||
clg
|
||||
color red
|
||||
text tlx,tly,str$
|
||||
pause .1
|
||||
end while
|
||||
#Note: textheight() and textwidth() depends on the latest configuration of the FONT command.
|
||||
if clickb=1 and clickx>=tlx and clickx<=tlx+textwidth(str$) and clicky>=tly and clicky<=tly+textheight() then
|
||||
direction=NOT direction
|
||||
end if
|
||||
clickclear
|
||||
goto main
|
||||
26
Task/Animation/Dart/animation.dart
Normal file
26
Task/Animation/Dart/animation.dart
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
import 'dart:html';
|
||||
import 'dart:async';
|
||||
|
||||
const frameTime = const Duration(milliseconds: 100);
|
||||
|
||||
void main() {
|
||||
String text = "Hello World! ";
|
||||
bool rotateRight = true;
|
||||
|
||||
Element writeHere =
|
||||
querySelector('#output'); // assumes you have a pre with that ID
|
||||
writeHere.onClick.listen((event) => rotateRight = !rotateRight);
|
||||
|
||||
new Timer.periodic(frameTime, (_) {
|
||||
text = changeText(text, rotateRight);
|
||||
writeHere.text = text;
|
||||
});
|
||||
}
|
||||
|
||||
String changeText(extt, rotateRight) {
|
||||
if (rotateRight) {
|
||||
return extt.substring(extt.length - 1) + extt.substring(0, extt.length - 1);
|
||||
} else {
|
||||
return extt.substring(1) + extt.substring(0, 1);
|
||||
}
|
||||
}
|
||||
77
Task/Animation/Pascal/animation.pascal
Normal file
77
Task/Animation/Pascal/animation.pascal
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
program HelloWorldAnimatedGUI;
|
||||
|
||||
uses {$IFDEF UNIX} {$IFDEF UseCThreads}
|
||||
cthreads, {$ENDIF} {$ENDIF}
|
||||
Interfaces, // this includes the LCL widgetset
|
||||
Forms,
|
||||
Classes,
|
||||
Controls,
|
||||
StdCtrls,
|
||||
ExtCtrls;
|
||||
|
||||
type
|
||||
{ TFrmHelloWorldAnim }
|
||||
TFrmHelloWorldAnim = class(TForm)
|
||||
constructor CreateNew(AOwner: TComponent; Num: integer = 0); override;
|
||||
procedure lblTextAnimateClick(Sender: TObject);
|
||||
procedure tmrAnimateTimer(Sender: TObject);
|
||||
private
|
||||
{ private declarations }
|
||||
lblTextAnimate: TLabel;
|
||||
tmrAnimate: TTimer;
|
||||
FDirection: boolean;
|
||||
public
|
||||
{ public declarations }
|
||||
end;
|
||||
|
||||
var
|
||||
FrmHelloWorldAnim: TFrmHelloWorldAnim;
|
||||
|
||||
{ TFrmHelloWorldAnim }
|
||||
|
||||
constructor TFrmHelloWorldAnim.CreateNew(AOwner: TComponent; Num: integer);
|
||||
begin
|
||||
inherited CreateNew(AOwner, Num);
|
||||
Height := 50;
|
||||
lblTextAnimate := TLabel.Create(self);
|
||||
with lblTextAnimate do
|
||||
begin
|
||||
Caption := 'Hello World! ';
|
||||
Align := alClient;
|
||||
Alignment := taCenter;
|
||||
font.Name := 'Courier New';
|
||||
font.size := 20;
|
||||
OnClick := @lblTextAnimateClick;
|
||||
Parent := self;
|
||||
end;
|
||||
tmrAnimate := TTimer.Create(self);
|
||||
with tmrAnimate do
|
||||
begin
|
||||
Interval := 100;
|
||||
OnTimer := @tmrAnimateTimer;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TFrmHelloWorldAnim.lblTextAnimateClick(Sender: TObject);
|
||||
begin
|
||||
FDirection := not FDirection;
|
||||
end;
|
||||
|
||||
procedure TFrmHelloWorldAnim.tmrAnimateTimer(Sender: TObject);
|
||||
begin
|
||||
if FDirection then
|
||||
lblTextAnimate.Caption :=
|
||||
copy(lblTextAnimate.Caption, length(lblTextAnimate.Caption), 1) +
|
||||
copy(lblTextAnimate.Caption, 1, length(lblTextAnimate.Caption) - 1)
|
||||
else
|
||||
lblTextAnimate.Caption :=
|
||||
copy(lblTextAnimate.Caption, 2, length(lblTextAnimate.Caption) - 1) +
|
||||
copy(lblTextAnimate.Caption, 1, 1);
|
||||
end;
|
||||
|
||||
begin
|
||||
RequireDerivedFormResource := False;
|
||||
Application.Initialize;
|
||||
Application.CreateForm(TFrmHelloWorldAnim, FrmHelloWorldAnim);
|
||||
Application.Run;
|
||||
end.
|
||||
Loading…
Add table
Add a link
Reference in a new issue