September Morn Update
This commit is contained in:
parent
4e2d22a71d
commit
aac6731f2c
6856 changed files with 141342 additions and 21127 deletions
19
Task/Animation/Perl-6/animation.pl6
Normal file
19
Task/Animation/Perl-6/animation.pl6
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
use v6;
|
||||
|
||||
use GTK::Simple;
|
||||
use GTK::Simple::App;
|
||||
|
||||
my $app = GTK::Simple::App.new(:title<Animation>);
|
||||
my $button = GTK::Simple::Button.new(label => 'Hello World! ');
|
||||
my $vbox = GTK::Simple::VBox.new($button);
|
||||
|
||||
my $repeat = $app.g-timeout(100); # milliseconds
|
||||
|
||||
my $dir = 1;
|
||||
$button.clicked.tap({ $dir *= -1 });
|
||||
|
||||
$repeat.tap( &{$button.label = $button.label.comb.List.rotate($dir).join} );
|
||||
|
||||
$app.set-content($vbox);
|
||||
|
||||
$app.run;
|
||||
|
|
@ -1,11 +1,27 @@
|
|||
use XUL::Gui;
|
||||
use Tk;
|
||||
use Time::HiRes qw(sleep);
|
||||
|
||||
my $dir = '(.+)(.)';
|
||||
interval {
|
||||
ID(lbl)->value =~ s/$dir/$2$1/;
|
||||
} 75;
|
||||
my $msg = 'Hello World! ';
|
||||
my $first = '.+';
|
||||
my $second = '.';
|
||||
|
||||
display Label
|
||||
id => 'lbl',
|
||||
value => "Hello World! ",
|
||||
onclick => sub {toggle $dir => '(.+)(.)', '(.)(.+)'};
|
||||
my $mw = Tk::MainWindow->new(-title => 'Animated side-scroller',-bg=>"white");
|
||||
$mw->geometry ("400x150+0+0");
|
||||
|
||||
$mw->optionAdd('*Label.font', 'Courier 24 bold' );
|
||||
|
||||
my $scroller = $mw->Label(-text => "$msg")->grid(-row=>0,-column=>0);
|
||||
$mw->bind('all'=> '<Key-Escape>' => sub {exit;});
|
||||
$mw->bind("<Button>" => sub { ($second,$first) = ($first,$second) });
|
||||
|
||||
$scroller->after(1, \&display );
|
||||
MainLoop;
|
||||
|
||||
sub display {
|
||||
while () {
|
||||
sleep 0.25;
|
||||
$msg =~ s/($first)($second)/$2$1/;
|
||||
$scroller->configure(-text=>"$msg");
|
||||
$mw->update();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
26
Task/Animation/Processing/animation
Normal file
26
Task/Animation/Processing/animation
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
String txt = "Hello, world! ";
|
||||
boolean dir = true;
|
||||
|
||||
void draw(){
|
||||
background(128);
|
||||
text(txt, 10, height/2);
|
||||
if(frameCount%10==0){
|
||||
if(dir) {
|
||||
txt = rotate(txt, 1);
|
||||
} else {
|
||||
txt = rotate(txt, txt.length()-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void mouseReleased(){
|
||||
dir = !dir;
|
||||
}
|
||||
|
||||
String rotate(String text, int startIdx) {
|
||||
char[] rotated = new char[text.length()];
|
||||
for (int i = 0; i < text.length(); i++) {
|
||||
rotated[i] = text.charAt((i + startIdx) % text.length());
|
||||
}
|
||||
return String.valueOf(rotated);
|
||||
}
|
||||
22
Task/Animation/REXX/animation.rexx
Normal file
22
Task/Animation/REXX/animation.rexx
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
/*REXX prg displays a text string (in one direction), and reverses when a key is pressed*/
|
||||
parse upper version !ver !vernum .; !pcRexx= 'REXX/PERSONAL'==!ver | 'REXX/PC'==!ver
|
||||
if \!pcRexx then do
|
||||
say
|
||||
say '***error*** This REXX program requires REXX/PERSONAL or REXX/PC.'
|
||||
say
|
||||
exit 1
|
||||
end
|
||||
parse arg $ /*obtain optional text message from CL.*/
|
||||
if $='' then $= 'Hello World!' /*Not specified? Then use the default.*/
|
||||
if right($, 1)\==' ' then $= $' ' /*ensure msg text has a trailing blank.*/
|
||||
signal on halt /*handle a HALT if user quits this way.*/
|
||||
way = 0 /*default direction for marquee display*/
|
||||
y =
|
||||
do until y=='Q'; 'CLS' /*if user presses Q or q, then quit.*/
|
||||
call lineout ,$; call delay .2 /*display output; delay 1/5 of a second*/
|
||||
y= inKey('Nowait'); upper y /*maybe get a pressed key; uppercase it*/
|
||||
if y\=='' then way= \way /*change the direction of the marquee. */
|
||||
if way then $= substr($, 2)left($, 1) /*display marquee in a direction or ···*/
|
||||
else $= right($, 1)substr($, 1, length($) - 1) /* ··· the other·*/
|
||||
end /*until*/
|
||||
halt: /*stick a fork in it, we're all done. */
|
||||
Loading…
Add table
Add a link
Reference in a new issue