plumo 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/plumo/public/index.html +2 -0
- data/lib/plumo/version.rb +1 -1
- data/lib/plumo.rb +43 -0
- data/plumo.gemspec +1 -1
- metadata +4 -4
- data/sample_1.rb +0 -50
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: e5ab1ca1291bc4d644d5e85919de6ac67fe7bc63
|
4
|
+
data.tar.gz: 08cff4471c4a41a9d07437596db34869cb1a996f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cc8ca673949e3a327bde6f53b8d7d840895abbb94e6e431cbbf0b87ecb61cf2f9f38319f184a9b177d9356ce5f1ba7c02646a57096c294284bb8c7c7c1621315
|
7
|
+
data.tar.gz: 0de8d7b5b43d4acae3ef4c60be2287f5459950c5c6c22b01538ed01e7b9ff813fc24581ad85f30f171e41d8510f1b7918eae711d82ad14394dd191d66052ae87
|
data/lib/plumo/public/index.html
CHANGED
data/lib/plumo/version.rb
CHANGED
data/lib/plumo.rb
CHANGED
@@ -140,6 +140,15 @@ class Plumo
|
|
140
140
|
cmds: cmds
|
141
141
|
})
|
142
142
|
end
|
143
|
+
|
144
|
+
nil
|
145
|
+
end
|
146
|
+
|
147
|
+
def color(color)
|
148
|
+
draw(
|
149
|
+
[:strokeStyle, color],
|
150
|
+
[:fillStyle, color]
|
151
|
+
)
|
143
152
|
end
|
144
153
|
|
145
154
|
def line(x0, y0, x1, y1, style={})
|
@@ -159,6 +168,20 @@ class Plumo
|
|
159
168
|
draw(*cmds)
|
160
169
|
end
|
161
170
|
|
171
|
+
def stroke_rect(x, y, w, h, style={})
|
172
|
+
cmds = []
|
173
|
+
|
174
|
+
if style.key?(:color)
|
175
|
+
cmds << [:strokeStyle, style[:color]]
|
176
|
+
end
|
177
|
+
|
178
|
+
cmds += [
|
179
|
+
[:strokeRect, x, y, w, h]
|
180
|
+
]
|
181
|
+
|
182
|
+
draw(*cmds)
|
183
|
+
end
|
184
|
+
|
162
185
|
def fill_rect(x, y, w, h, style={})
|
163
186
|
cmds = []
|
164
187
|
|
@@ -174,6 +197,26 @@ class Plumo
|
|
174
197
|
draw(*cmds)
|
175
198
|
end
|
176
199
|
|
200
|
+
def stroke_circle(x, y, r, style={})
|
201
|
+
cmds = []
|
202
|
+
|
203
|
+
if style.key?(:color)
|
204
|
+
cmds << [:strokeStyle, style[:color]]
|
205
|
+
end
|
206
|
+
|
207
|
+
cmds += [
|
208
|
+
[:beginPath],
|
209
|
+
[:arc,
|
210
|
+
x, y,
|
211
|
+
r,
|
212
|
+
0, Math::PI * 2, false
|
213
|
+
],
|
214
|
+
[:stroke]
|
215
|
+
]
|
216
|
+
|
217
|
+
draw(*cmds)
|
218
|
+
end
|
219
|
+
|
177
220
|
def fill_circle(x, y, r, style={})
|
178
221
|
cmds = []
|
179
222
|
|
data/plumo.gemspec
CHANGED
@@ -15,7 +15,7 @@ Gem::Specification.new do |spec|
|
|
15
15
|
spec.license = 'BSD 2-Clause "Simplified"'
|
16
16
|
|
17
17
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
18
|
-
f.match(%r{^(test|spec|features)/})
|
18
|
+
f.match(%r{^(test|spec|features|examples)/})
|
19
19
|
end
|
20
20
|
spec.bindir = "exe"
|
21
21
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: plumo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- sonota88
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-04-
|
11
|
+
date: 2019-04-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -56,7 +56,6 @@ files:
|
|
56
56
|
- lib/plumo/public/plumo.js
|
57
57
|
- lib/plumo/version.rb
|
58
58
|
- plumo.gemspec
|
59
|
-
- sample_1.rb
|
60
59
|
homepage: https://github.com/sonota88/plumo
|
61
60
|
licenses:
|
62
61
|
- BSD 2-Clause "Simplified"
|
@@ -76,7 +75,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
76
75
|
- !ruby/object:Gem::Version
|
77
76
|
version: '0'
|
78
77
|
requirements: []
|
79
|
-
|
78
|
+
rubyforge_project:
|
79
|
+
rubygems_version: 2.6.8
|
80
80
|
signing_key:
|
81
81
|
specification_version: 4
|
82
82
|
summary: Easy 2d-graphincs using Ruby and Canvas
|
data/sample_1.rb
DELETED
@@ -1,50 +0,0 @@
|
|
1
|
-
$LOAD_PATH.unshift './lib'
|
2
|
-
|
3
|
-
require 'plumo'
|
4
|
-
|
5
|
-
def rand_color
|
6
|
-
"rgba(%f, %f, %f, %f)" % [
|
7
|
-
rand * 240,
|
8
|
-
rand * 200,
|
9
|
-
rand * 120,
|
10
|
-
0.5 + rand / 2
|
11
|
-
]
|
12
|
-
end
|
13
|
-
|
14
|
-
def rand_x
|
15
|
-
rand * $canvas_w
|
16
|
-
end
|
17
|
-
|
18
|
-
def rand_y
|
19
|
-
rand * $canvas_h
|
20
|
-
end
|
21
|
-
|
22
|
-
# --------------------------------
|
23
|
-
|
24
|
-
$canvas_w = 400
|
25
|
-
$canvas_h = 200
|
26
|
-
|
27
|
-
plumo = Plumo.new($canvas_w, $canvas_h)
|
28
|
-
plumo.start
|
29
|
-
|
30
|
-
loop do
|
31
|
-
plumo.line(
|
32
|
-
rand_x, rand_y,
|
33
|
-
rand_x, rand_y,
|
34
|
-
color: rand_color
|
35
|
-
)
|
36
|
-
|
37
|
-
plumo.fill_circle(
|
38
|
-
rand_x, rand_y, rand * 50,
|
39
|
-
color: rand_color
|
40
|
-
)
|
41
|
-
|
42
|
-
width = rand * 50
|
43
|
-
plumo.fill_rect(
|
44
|
-
rand_x, rand_y,
|
45
|
-
width, width,
|
46
|
-
color: rand_color
|
47
|
-
)
|
48
|
-
|
49
|
-
sleep 0.1
|
50
|
-
end
|