Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
30
Task/Animation/Factor/animation.factor
Normal file
30
Task/Animation/Factor/animation.factor
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
USING: accessors timers calendar kernel models sequences ui
|
||||
ui.gadgets ui.gadgets.labels ui.gestures ;
|
||||
FROM: models => change-model ;
|
||||
IN: rosetta.animation
|
||||
|
||||
CONSTANT: sentence "Hello World! "
|
||||
|
||||
TUPLE: animated-label < label-control reversed alarm ;
|
||||
: <animated-label> ( model -- <animated-model> )
|
||||
sentence animated-label new-label swap >>model
|
||||
monospace-font >>font ;
|
||||
: update-string ( str reverse -- str )
|
||||
[ unclip-last prefix ] [ unclip suffix ] if ;
|
||||
: update-model ( model reversed? -- )
|
||||
[ update-string ] curry change-model ;
|
||||
|
||||
animated-label
|
||||
H{
|
||||
{ T{ button-down } [ [ not ] change-reversed drop ] }
|
||||
} set-gestures
|
||||
|
||||
M: animated-label graft*
|
||||
[ [ [ model>> ] [ reversed>> ] bi update-model ] curry 400 milliseconds every ] keep
|
||||
alarm<< ;
|
||||
M: animated-label ungraft*
|
||||
alarm>> stop-timer ;
|
||||
: main ( -- )
|
||||
[ sentence <model> <animated-label> "Rosetta" open-window ] with-ui ;
|
||||
|
||||
MAIN: main
|
||||
Loading…
Add table
Add a link
Reference in a new issue