A few methods are shared by every little element in Shoes. Moving, showing, hiding. Removingan element. Basic and very general things. This list encompasses those common commands.One of the most general methods of all is the
method (which is also covered as thestyle method for slots.)
Shoes.app dostack do# Background, text and a button: both are elements!@back = background green@text = banner "A Message for You, Rudy"@press = button "Stop your messin about!"# And so, both can be styled.@text.style :size => 12, :stroke => red, :margin => email@example.com :width => firstname.lastname@example.org :height => 10endend
For specific commands, see the other links to the left in the Elements section. Like if you want to pause or play a video file, check the Videosection, since pausing and playing is peculiar to
videos. No sense pausing a button.displace(left: a number, top: a number) » self Displacing an element moves it. But without changing the layout around it. This is great for subtle animations, especially if you want to reserve a place for an element while it is stillanimating. Like maybe a quick button shake or a slot sliding into view.When you displace an element, it moves relative to the upper-left corner where it was placed. So,if an element is at the coordinates (20, 40) and you displace it 2 pixels left and 6 pixels on top,you end up with the coordinates (22, 46).
Shoes.app doflow :margin => 12 do# Set up three buttonsbutton "One"@two = button "Two"button "Three"# Bounce the second buttonanimate do |email@example.com(0, (Math.sin(i) * 6).to_i)endendend