Skip to content

Instantly share code, notes, and snippets.

@codenameone
Created January 31, 2016 12:23
Show Gist options
  • Save codenameone/38c076760e309c066126 to your computer and use it in GitHub Desktop.
Save codenameone/38c076760e309c066126 to your computer and use it in GitHub Desktop.
Animates a "falling" effect using animate layout from Codename One
Form hi = new Form("Layout Animations", new BoxLayout(BoxLayout.Y_AXIS));
Button fall = new Button("Fall");
fall.addActionListener((e) -> {
for(int iter = 0 ; iter < 10 ; iter++) {
Label b = new Label ("Label " + iter);
b.setWidth(fall.getWidth());
b.setHeight(fall.getHeight());
b.setY(-fall.getHeight());
hi.add(b);
}
hi.getContentPane().animateLayout(20000);
});
hi.add(fall);
@codenameone
Copy link
Author

Sample usage code for animateLayout

From the Codename One project

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment