Animation in Roassal

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Animation in Roassal

abergel
hi!

Just to share an example on how to do animations in Roassal. All the pieces are there, but abstractions are still missing. Sequencing animations is not intuitive so far.

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

"Source code: ROExample>>animationOn:"
"Preambule. It includes the initialization. "
| view rawView elements b helpLabel |
rawView := ROView new.
view := ROMondrianViewBuilder view: rawView.
"-------------"
"-------------"


"Define 10 blue rectangles, align them, and move them away from the corner"
elements := ROElement forCollection: (1 to: 10).
elements do: [ :el | el + ROBox blue; extent: 40 @ 80 ].
rawView addAll: elements.

ROHorizontalLineLayout new
        horizontalGap: 0;
        on: elements.
       
elements do: [ :el |
        el translateBy: 40 @ 40 ].

"We define the animation in a block to be repeatable"
b := [ elements do: [ :el |
        el model odd ifTrue: [
                ROLinearMove new
                        nbCycles: 30;
                        for: el by: 0 @ 40;
                        after: [ ROLinearMove new
                                                nbCycles: 30;
                                                for: el by: 0 @ -40 ] ] ] ].

"We first do the animation"
b value.

"Help message"
RONopAnimation new
        nbCycles: 70;
        after: [ rawView add: (helpLabel := (ROElement on: 'Click here!') + ROLabel).
                        helpLabel translateTo: 20 @ 150.];
        on: rawView.
RONopAnimation new
        nbCycles: 120;
        after: [ helpLabel remove ];
        on: rawView.
               
rawView on: ROMouseClick do: [ :event | b value ].

"-------------"
"-------------"
"Below is the initiation of the menu and opening the visualization"
ROEaselMorphic new populateMenuOn: view.
view noLayout.
view open

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.



_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev