green_shoes 0.131.0 → 0.138.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +3 -2
- data/lib/shoes/app.rb +6 -3
- data/lib/shoes/help.rb +21 -0
- data/lib/shoes/helper_methods.rb +2 -2
- data/lib/shoes/main.rb +1 -0
- data/lib/shoes/widget.rb +1 -1
- data/samples/akatsukiface.png +0 -0
- data/samples/class-book.yaml +387 -0
- data/samples/cy.png +0 -0
- data/samples/loogink.png +0 -0
- data/samples/potato_chopping/1258_s001.gif +0 -0
- data/samples/potato_chopping/1258_s002.gif +0 -0
- data/samples/potato_chopping/1258_s003.gif +0 -0
- data/samples/potato_chopping/1258_s004.gif +0 -0
- data/samples/potato_chopping/1258_s005.gif +0 -0
- data/samples/potato_chopping/1258_s006.gif +0 -0
- data/samples/potato_chopping/1258_s007.gif +0 -0
- data/samples/potato_chopping/1258_s008.gif +0 -0
- data/samples/potato_chopping/1258_s009.gif +0 -0
- data/samples/potato_chopping/1258_s010.gif +0 -0
- data/samples/potato_chopping/1258_s011.gif +0 -0
- data/samples/potato_chopping/1258_s012.gif +0 -0
- data/samples/potato_chopping/1258_s013.gif +0 -0
- data/samples/potato_chopping/1258_s014.gif +0 -0
- data/samples/potato_chopping/1258_s015.gif +0 -0
- data/samples/potato_chopping/1258_s016.gif +0 -0
- data/samples/potato_chopping/1258_s017.gif +0 -0
- data/samples/potato_chopping/1258_s018.gif +0 -0
- data/samples/potato_chopping/1258_s019.gif +0 -0
- data/samples/potato_chopping/1258_s020.gif +0 -0
- data/samples/potato_chopping/1258_s021.gif +0 -0
- data/samples/potato_chopping/1258_s022.gif +0 -0
- data/samples/potato_chopping/1258_s023.gif +0 -0
- data/samples/potato_chopping/1258_s024.gif +0 -0
- data/samples/potato_chopping/1258_s025.gif +0 -0
- data/samples/potato_chopping/1258_s026.gif +0 -0
- data/samples/potato_chopping/1258_s027.gif +0 -0
- data/samples/potato_chopping/1258_s028.gif +0 -0
- data/samples/potato_chopping/1258_s029.gif +0 -0
- data/samples/potato_chopping/1258_s030.gif +0 -0
- data/samples/potato_chopping/1258_s031.gif +0 -0
- data/samples/potato_chopping/1258_s032.gif +0 -0
- data/samples/potato_chopping/1258_s033.gif +0 -0
- data/samples/potato_chopping/1258_s034.gif +0 -0
- data/samples/potato_chopping/1258_s035.gif +0 -0
- data/samples/potato_chopping/1258_s036.gif +0 -0
- data/samples/potato_chopping/1258_s037.gif +0 -0
- data/samples/potato_chopping/1258_s038.gif +0 -0
- data/samples/potato_chopping/1258_s039.gif +0 -0
- data/samples/potato_chopping/1258_s040.gif +0 -0
- data/samples/potato_chopping/1258_s041.gif +0 -0
- data/samples/potato_chopping/1258_s042.gif +0 -0
- data/samples/potato_chopping/1258_s043.gif +0 -0
- data/samples/potato_chopping/1258_s044.gif +0 -0
- data/samples/potato_chopping/1258_s045.gif +0 -0
- data/samples/potato_chopping/1258_s046.gif +0 -0
- data/samples/potato_chopping/1258_s047.gif +0 -0
- data/samples/potato_chopping/1258_s048.gif +0 -0
- data/samples/potato_chopping/1258_s049.gif +0 -0
- data/samples/potato_chopping/1258_s050.gif +0 -0
- data/samples/potato_chopping/1258_s051.gif +0 -0
- data/samples/potato_chopping/1258_s052.gif +0 -0
- data/samples/potato_chopping/1258_s053.gif +0 -0
- data/samples/potato_chopping/1258_s054.gif +0 -0
- data/samples/potato_chopping/1258_s055.gif +0 -0
- data/samples/potato_chopping/1258_s056.gif +0 -0
- data/samples/potato_chopping/1258_s057.gif +0 -0
- data/samples/potato_chopping/1258_s058.gif +0 -0
- data/samples/potato_chopping/1258_s059.gif +0 -0
- data/samples/potato_chopping/1258_s060.gif +0 -0
- data/samples/sample1.rb +32 -0
- data/samples/sample10.rb +10 -0
- data/samples/sample11.rb +12 -0
- data/samples/sample12.rb +21 -0
- data/samples/sample13.rb +17 -0
- data/samples/sample14-1.rb +38 -0
- data/samples/sample14.rb +64 -0
- data/samples/sample15.rb +17 -0
- data/samples/sample16.rb +12 -0
- data/samples/sample17.rb +12 -0
- data/samples/sample18.rb +23 -0
- data/samples/sample19.rb +39 -0
- data/samples/sample2.rb +13 -0
- data/samples/sample20.rb +26 -0
- data/samples/sample21.rb +7 -0
- data/samples/sample22.rb +13 -0
- data/samples/sample23.rb +10 -0
- data/samples/sample24.rb +21 -0
- data/samples/sample25.rb +22 -0
- data/samples/sample26.rb +21 -0
- data/samples/sample27.rb +19 -0
- data/samples/sample28.rb +64 -0
- data/samples/sample29.rb +13 -0
- data/samples/sample3.rb +10 -0
- data/samples/sample30.rb +30 -0
- data/samples/sample31.rb +24 -0
- data/samples/sample32.rb +25 -0
- data/samples/sample33.rb +19 -0
- data/samples/sample34.rb +29 -0
- data/samples/sample35.rb +31 -0
- data/samples/sample36.rb +46 -0
- data/samples/sample37.rb +10 -0
- data/samples/sample38.rb +13 -0
- data/samples/sample39.rb +18 -0
- data/samples/sample4.rb +9 -0
- data/samples/sample40.rb +19 -0
- data/samples/sample41.rb +8 -0
- data/samples/sample42.rb +15 -0
- data/samples/sample43.rb +26 -0
- data/samples/sample44.rb +63 -0
- data/samples/sample45.rb +13 -0
- data/samples/sample5.rb +8 -0
- data/samples/sample6.rb +11 -0
- data/samples/sample7.rb +5 -0
- data/samples/sample8.rb +9 -0
- data/samples/sample9.rb +12 -0
- data/samples/sample99.rb +4 -0
- data/samples/splash-hand.png +0 -0
- data/snapshots/helloworld.png +0 -0
- data/snapshots/mini-hh.png +0 -0
- data/snapshots/sample1.png +0 -0
- data/snapshots/sample10.png +0 -0
- data/snapshots/sample11.png +0 -0
- data/snapshots/sample12.png +0 -0
- data/snapshots/sample13.png +0 -0
- data/snapshots/sample14-1.png +0 -0
- data/snapshots/sample14.png +0 -0
- data/snapshots/sample15.png +0 -0
- data/snapshots/sample16.png +0 -0
- data/snapshots/sample17.png +0 -0
- data/snapshots/sample18.png +0 -0
- data/snapshots/sample19.png +0 -0
- data/snapshots/sample2.png +0 -0
- data/snapshots/sample20.png +0 -0
- data/snapshots/sample21.png +0 -0
- data/snapshots/sample22.png +0 -0
- data/snapshots/sample23.png +0 -0
- data/snapshots/sample24.png +0 -0
- data/snapshots/sample25.png +0 -0
- data/snapshots/sample26.png +0 -0
- data/snapshots/sample27.png +0 -0
- data/snapshots/sample28.png +0 -0
- data/snapshots/sample29.png +0 -0
- data/snapshots/sample3-osx.png +0 -0
- data/snapshots/sample3.png +0 -0
- data/snapshots/sample30.png +0 -0
- data/snapshots/sample31.png +0 -0
- data/snapshots/sample32.png +0 -0
- data/snapshots/sample33.png +0 -0
- data/snapshots/sample34.png +0 -0
- data/snapshots/sample35.png +0 -0
- data/snapshots/sample36.png +0 -0
- data/snapshots/sample37.png +0 -0
- data/snapshots/sample38.png +0 -0
- data/snapshots/sample39.png +0 -0
- data/snapshots/sample4.png +0 -0
- data/snapshots/sample40.png +0 -0
- data/snapshots/sample41.png +0 -0
- data/snapshots/sample42.png +0 -0
- data/snapshots/sample43.png +0 -0
- data/snapshots/sample44-linux.png +0 -0
- data/snapshots/sample44.png +0 -0
- data/snapshots/sample45.png +0 -0
- data/snapshots/sample5.png +0 -0
- data/snapshots/sample6.png +0 -0
- data/snapshots/sample7.png +0 -0
- data/snapshots/sample8.png +0 -0
- data/snapshots/sample9.png +0 -0
- data/snapshots/sample99.png +0 -0
- metadata +166 -3
data/samples/sample31.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
require '../lib/green_shoes'
|
2
|
+
|
3
|
+
Shoes.app do
|
4
|
+
strokewidth 3
|
5
|
+
eles = []
|
6
|
+
eles << oval(0, 0, 300, angle: 90)
|
7
|
+
eles << rect(50, 50, 350, 350, curve: 10)
|
8
|
+
eles << star(100, 100, 30, 200, 180)
|
9
|
+
eles << shape(left: 200, top: 200){
|
10
|
+
move_to 200, 150
|
11
|
+
line_to 200, 100
|
12
|
+
curve_to 100, 100, 20, 200, 100, 50
|
13
|
+
line_to 20, 100
|
14
|
+
}
|
15
|
+
eles << line(100, 100, 480, 480)
|
16
|
+
|
17
|
+
button 'change colors' do
|
18
|
+
eles.each do |ele|
|
19
|
+
colors = []
|
20
|
+
4.times{colors << send(COLORS.keys[rand(COLORS.keys.size)])}
|
21
|
+
ele.style fill: colors[0]..colors[1], stroke: colors[2]..colors[3]
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
data/samples/sample32.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
require '../lib/green_shoes'
|
2
|
+
|
3
|
+
Shoes.app title: 'A Tiny Chipmunk Physics Demo' do
|
4
|
+
extend ChipMunk
|
5
|
+
space = cp_space
|
6
|
+
balls = []
|
7
|
+
|
8
|
+
nofill
|
9
|
+
cp_line 0, 180, 200, 280, stroke: gold
|
10
|
+
cp_line 200, 280, 300, 270, stroke: gold
|
11
|
+
cp_line 250, 350, 350, 330
|
12
|
+
cp_line 170, 370, 220, 380
|
13
|
+
cp_line 100, 450, 300, 430, stroke: lightslategray
|
14
|
+
cp_line 300, 430, 500, 450, stroke: lightslategray
|
15
|
+
|
16
|
+
nostroke
|
17
|
+
oval(10, 30, 40, 40, fill: blue).click{balls << cp_oval(30, 50, 20, stroke: blue, strokewidth: 2)}
|
18
|
+
oval(70, 40, 20, 20, fill: green).click{balls << cp_oval(80, 50, 10, fill: green)}
|
19
|
+
oval(105, 45, 10, 10, fill: red).click{balls << cp_oval(110, 50, 5, fill: red)}
|
20
|
+
|
21
|
+
animate do
|
22
|
+
6.times{space.step 1.0/60}
|
23
|
+
balls.each{|ball| ball.cp_move}
|
24
|
+
end
|
25
|
+
end
|
data/samples/sample33.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
require '../lib/green_shoes'
|
2
|
+
|
3
|
+
Shoes.app width: 500, height: 100, title: 'Bloopsaphone Play Lists'do
|
4
|
+
background mediumspringgreen..hotpink, angle: 90
|
5
|
+
nostroke
|
6
|
+
|
7
|
+
plists = Dir.glob File.join(DIR, "ext/bloops/songs/*_by_*.rb")
|
8
|
+
|
9
|
+
i = 0
|
10
|
+
plists.each do |list|
|
11
|
+
y = 10 + 24 * i
|
12
|
+
song, auther = list.split('_by_').collect{|e| File.basename(e, '.rb').gsub('_', ' ')}
|
13
|
+
|
14
|
+
rect width: 480, height: 20, left: 10, top: y, fill: rgb(75, 0, 130, 0.2), curve: 5
|
15
|
+
pos = i.zero? ? {margin_left: 20, margin_top: 10} : {margin_left: 20}
|
16
|
+
para link(song){load list}, ' ', fg(strong(auther), white), pos
|
17
|
+
i += 1
|
18
|
+
end
|
19
|
+
end
|
data/samples/sample34.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# Refer to NKS (Nobody Knows Shoes) page 21.
|
2
|
+
|
3
|
+
require '../lib/green_shoes'
|
4
|
+
|
5
|
+
Shoes.app width: 280, height: 440 do
|
6
|
+
flow width: 1.0, margin: 10 do
|
7
|
+
flow do
|
8
|
+
background gold, curve: 10
|
9
|
+
stack width: 1.0 do
|
10
|
+
banner "A POEM"
|
11
|
+
end
|
12
|
+
stack width: 80 do
|
13
|
+
para "Goes like:"
|
14
|
+
end
|
15
|
+
stack width: 180 do
|
16
|
+
para "the sun.\n",
|
17
|
+
"a lemon.\n",
|
18
|
+
"the goalie.\n",
|
19
|
+
"a fireplace.\n\n",
|
20
|
+
"i want to write\n",
|
21
|
+
"a poem for the\n",
|
22
|
+
"kids who haven't\n",
|
23
|
+
"even heard one yet.\n\n",
|
24
|
+
"and the goalie guards\n",
|
25
|
+
"the fireplace."
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
data/samples/sample35.rb
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# original code is http://shoes-tutorial-note.heroku.com/html/00409_No.9_Shoes.url.html
|
2
|
+
|
3
|
+
require '../lib/green_shoes'
|
4
|
+
|
5
|
+
class PhotoFrame < Shoes
|
6
|
+
url '/', :index
|
7
|
+
url '/loogink', :loogink
|
8
|
+
url '/cy', :cy
|
9
|
+
|
10
|
+
def index
|
11
|
+
eval(['loogink', 'cy'][rand 2])
|
12
|
+
end
|
13
|
+
|
14
|
+
def loogink
|
15
|
+
background tomato
|
16
|
+
image './loogink.png', margin: [70, 10, 0, 0]
|
17
|
+
para fg(strong('She is Loogink.'), white),
|
18
|
+
'->', link(strong('Cy')){visit '/cy'},
|
19
|
+
margin: 10
|
20
|
+
end
|
21
|
+
|
22
|
+
def cy
|
23
|
+
background paleturquoise
|
24
|
+
image './cy.png', margin: [70, 10, 0, 0]
|
25
|
+
para fg(strong('He is Cy.'), gray), ' ->',
|
26
|
+
link(strong('loogink')){visit '/loogink'},
|
27
|
+
margin: 10
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
Shoes.app width: 200, height: 120, title: 'Photo Frame'
|
data/samples/sample36.rb
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
# original code is Red Shoes class-book.rb by _why
|
2
|
+
require '../lib/green_shoes'
|
3
|
+
require 'yaml'
|
4
|
+
|
5
|
+
class Book < Shoes
|
6
|
+
url '/', :index
|
7
|
+
url '/incidents/(\d+)', :incident
|
8
|
+
|
9
|
+
def index
|
10
|
+
incident 0
|
11
|
+
end
|
12
|
+
|
13
|
+
INCIDENTS = YAML.load_file('./class-book.yaml')
|
14
|
+
|
15
|
+
def table_of_contents
|
16
|
+
toc = []
|
17
|
+
INCIDENTS.each_with_index do |(title, story), i|
|
18
|
+
toc.push "(#{i + 1}) ",
|
19
|
+
link(title){visit "/incidents/#{i}"},
|
20
|
+
" / "
|
21
|
+
end
|
22
|
+
toc[0...-1] << "\n"*3
|
23
|
+
end
|
24
|
+
|
25
|
+
def incident num
|
26
|
+
num = num.to_i
|
27
|
+
stack margin_left: 190 do
|
28
|
+
banner "Incident"
|
29
|
+
para strong("No. #{num + 1}: #{INCIDENTS[num][0]}")
|
30
|
+
end
|
31
|
+
|
32
|
+
flow do
|
33
|
+
flow width: 180, margin_left: 10 do
|
34
|
+
para *table_of_contents, size: 8
|
35
|
+
end
|
36
|
+
|
37
|
+
stack width: 460, margin_left: 10 do
|
38
|
+
INCIDENTS[num][1].split(/\n\n+/).each do |p|
|
39
|
+
para p
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
Shoes.app width: 640, height: 700, title: "Incidents, a Book"
|
data/samples/sample37.rb
ADDED
data/samples/sample38.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
require '../lib/green_shoes'
|
2
|
+
|
3
|
+
Shoes.app width: 250, height: 250 do
|
4
|
+
nofill
|
5
|
+
animate do |i|
|
6
|
+
clear do
|
7
|
+
rotate 10*i
|
8
|
+
rect 50, 50, 50, 20, stroke: green
|
9
|
+
oval 150, 100, 50, 20, stroke: red
|
10
|
+
star 50, 150, 5, 30, 10, stroke: blue
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
data/samples/sample39.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
# An imitation of Hackety Hack opening demo.
|
2
|
+
|
3
|
+
require '../lib/green_shoes'
|
4
|
+
|
5
|
+
Shoes.app width: 420, height: 420 do
|
6
|
+
nostroke
|
7
|
+
background black
|
8
|
+
title fg(strong('Hackety Hack'), white), margin: 20
|
9
|
+
|
10
|
+
stack do
|
11
|
+
@m = mask{star -284, -174, 130, 500, 90}
|
12
|
+
image "./splash-hand.png" , top: 204, left: 84
|
13
|
+
end
|
14
|
+
|
15
|
+
animate 2 do |i|
|
16
|
+
@m.clear{rotate i; star -284, -174, 130, 500, 90}
|
17
|
+
end
|
18
|
+
end
|
data/samples/sample4.rb
ADDED
data/samples/sample40.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# For Christmas
|
2
|
+
require '../lib/green_shoes'
|
3
|
+
|
4
|
+
Shoes.app width: 330, height: 300 do
|
5
|
+
nostroke
|
6
|
+
background black
|
7
|
+
data = []
|
8
|
+
5.times{data << [30+rand(10), 20+rand(200), 20+rand(200)]}
|
9
|
+
|
10
|
+
a = animate do |i|
|
11
|
+
rotate i*5
|
12
|
+
clear do
|
13
|
+
background black
|
14
|
+
5.times{|j| star data[j][1], data[j][2], 5, data[j][0], data[j][0]/2.0, fill: gold..white, angle: 45}
|
15
|
+
para fg(strong('Merry Christmas'), white), size: 48 if i > 30
|
16
|
+
end
|
17
|
+
a.stop if i > 50
|
18
|
+
end
|
19
|
+
end
|
data/samples/sample41.rb
ADDED
data/samples/sample42.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
require '../lib/green_shoes'
|
2
|
+
|
3
|
+
Shoes.app height: 200 do
|
4
|
+
stack margin_left: 10 do
|
5
|
+
title 'Progress Example'
|
6
|
+
@p = para '0%'
|
7
|
+
end
|
8
|
+
|
9
|
+
pg = progress left: 10, top: 100, width: width - 20
|
10
|
+
animate do |i|
|
11
|
+
j = i % 100 + 1
|
12
|
+
pg.fraction = j / 100.0
|
13
|
+
@p.text = "%2d%" % (pg.fraction * 100)
|
14
|
+
end
|
15
|
+
end
|
data/samples/sample43.rb
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
require '../lib/green_shoes'
|
2
|
+
|
3
|
+
Shoes.app do
|
4
|
+
stack margin_left: 10 do
|
5
|
+
title "Downloading Astronomy Picture of the Day", size: 16
|
6
|
+
status = para "One moment..."
|
7
|
+
msg = para '0%'
|
8
|
+
dl = download "http://antwrp.gsfc.nasa.gov/apod/image/1009/venusmoon_pascual_big.jpg",
|
9
|
+
save: "venusmoon_pascual_big.jpg" do
|
10
|
+
status.text = strong(fg("Okay, is downloaded.", orangered))
|
11
|
+
image("venusmoon_pascual_big.jpg", width: 580, height: 380).move 10, 100
|
12
|
+
end
|
13
|
+
|
14
|
+
pg = progress left: 10, top: 100, width: width - 20
|
15
|
+
a = animate do
|
16
|
+
if dl.started?
|
17
|
+
pg.fraction = dl.progress.to_f / dl.content_length
|
18
|
+
msg.text = "%2d%" % (pg.fraction * 100)
|
19
|
+
end
|
20
|
+
if dl.finished?
|
21
|
+
pg.hide
|
22
|
+
a.stop
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
data/samples/sample44.rb
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
#
|
2
|
+
# Shoes Clock by Thomas Bell
|
3
|
+
# posted to the Shoes mailing list on 04 Dec 2007
|
4
|
+
# Original code for Red Shoes is: https://github.com/shoes/shoes/blob/master/samples/good-clock.rb
|
5
|
+
# The following is a little bit modified snippet for Green Shoes, using show and hide instead of clear.
|
6
|
+
#
|
7
|
+
require '../lib/green_shoes'
|
8
|
+
|
9
|
+
Shoes.app height: 260, width: 250 do
|
10
|
+
def draw_background
|
11
|
+
background rgb(230, 240, 200)
|
12
|
+
|
13
|
+
fill white
|
14
|
+
stroke black
|
15
|
+
strokewidth 4
|
16
|
+
oval @centerx - 102, @centery - 102, 204, 204
|
17
|
+
|
18
|
+
fill black
|
19
|
+
nostroke
|
20
|
+
oval @centerx - 5, @centery - 5, 10, 10
|
21
|
+
|
22
|
+
stroke black
|
23
|
+
strokewidth 1
|
24
|
+
line(@centerx, @centery - 102, @centerx, @centery - 95)
|
25
|
+
line(@centerx - 102, @centery, @centerx - 95, @centery)
|
26
|
+
line(@centerx + 95, @centery, @centerx + 102, @centery)
|
27
|
+
line(@centerx, @centery + 95, @centerx, @centery + 102)
|
28
|
+
end
|
29
|
+
|
30
|
+
def clock_hand(time, sw, unit=30, color=black)
|
31
|
+
radius_local = unit == 30 ? @radius : @radius - 15
|
32
|
+
_x = radius_local * Math.sin( time * Math::PI / unit )
|
33
|
+
_y = radius_local * Math.cos( time * Math::PI / unit )
|
34
|
+
stroke color
|
35
|
+
strokewidth sw
|
36
|
+
line(@centerx, @centery, @centerx + _x, @centery - _y)
|
37
|
+
end
|
38
|
+
|
39
|
+
@radius, @centerx, @centery = 90, 126, 140
|
40
|
+
draw_background
|
41
|
+
stack do
|
42
|
+
background black
|
43
|
+
@msg = para '', margin: 4, align: 'center'
|
44
|
+
end
|
45
|
+
hour, min, sec = [], [], []
|
46
|
+
12.times{|i| 5.times{|j| hour << clock_hand(i+(j/5.0), 8, 6).hide}}
|
47
|
+
60.times{|i| 4.times{|j| min << clock_hand(i+(j/4.0), 5).hide}}
|
48
|
+
60.times{|i| 8.times{|j| sec << clock_hand(i+(j/8.0), 2, 30, red).hide}}
|
49
|
+
|
50
|
+
animate 8 do |i|
|
51
|
+
t = Time.new
|
52
|
+
h, m, s, u = t.hour, t.min, t.sec, t.usec
|
53
|
+
if i % 8 == 0
|
54
|
+
@msg.text = fg(t.strftime("%a"), tr_color("#666")) +
|
55
|
+
fg(t.strftime(" %b %d, %Y "), tr_color("#ccc")) +
|
56
|
+
strong(fg(t.strftime("%I:%M"), white)) +
|
57
|
+
fg(t.strftime(".%S"), tr_color("#666"))
|
58
|
+
end
|
59
|
+
t = h*5+m/12; hour[(t-1)%60].hide; hour[t%60].show
|
60
|
+
t = m*4+s/15; min[(t-1)%240].hide; min[t%240].show
|
61
|
+
t = s*8+u/125000; sec.each(&:hide); sec[t%480].show
|
62
|
+
end
|
63
|
+
end
|
data/samples/sample45.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
require '../lib/green_shoes'
|
2
|
+
|
3
|
+
Shoes.app height: 200 do
|
4
|
+
title 'Hello Green Shoes'
|
5
|
+
font 'Coolvetica'
|
6
|
+
title 'Hello Green Shoes'
|
7
|
+
title 'Hello Green Shoes', font: 'Lucida console'
|
8
|
+
nolayout
|
9
|
+
font nil
|
10
|
+
para 'sans (default)', left: 400, top: 30
|
11
|
+
para 'Coolvetica', left: 400, top: 92
|
12
|
+
para 'Lucida Console', left: 470, top: 155
|
13
|
+
end
|
data/samples/sample5.rb
ADDED
data/samples/sample6.rb
ADDED
data/samples/sample7.rb
ADDED
data/samples/sample8.rb
ADDED
data/samples/sample9.rb
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
require '../lib/green_shoes'
|
2
|
+
|
3
|
+
Shoes.app do
|
4
|
+
flow(width: 300){3.times{|i| button "hello#{i}"}}
|
5
|
+
stack(width: 100){3.times{|i| button "hello#{i}"}}
|
6
|
+
button 'bye bye1'
|
7
|
+
flow(width: 0.5){2.times{|i| flow(width: 0.5){2.times{|j| button "Yayyyy#{j}"}}}}
|
8
|
+
flow(width: 0.3){button 'go go go go go'}
|
9
|
+
stack(width: 0.3){edit_line; 3.times{para 'hello'}}
|
10
|
+
flow(width: 0.3){image '../static/gshoes-icon.png'}
|
11
|
+
button 'bye bye2'
|
12
|
+
end
|
data/samples/sample99.rb
ADDED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|