plumo 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA256:
3
- metadata.gz: cf31bc4c5e223d8ec9d4c4fa7cc5758f5f7c72bece8dcbc12a406962e99997b9
4
- data.tar.gz: a32e6955be6556ba9f4a1452835d8221d7df0f5edfa383fa04cfd3fb21c78db9
2
+ SHA1:
3
+ metadata.gz: e5ab1ca1291bc4d644d5e85919de6ac67fe7bc63
4
+ data.tar.gz: 08cff4471c4a41a9d07437596db34869cb1a996f
5
5
  SHA512:
6
- metadata.gz: 55901cd274acd1d75b56343d875850ad33c12dfc705ad5d5d3c31c5b1782a7e65fdffc97f70b297f3b386b907583aec9ecfdc75bdd9aa70cc1f549563980169e
7
- data.tar.gz: 6e86a541180dc1e31d5703d9c754a5f687ca7b88fefb5939e23e92bfad8ffa7542d470e7afe4a250b2453ac1aa95b69856d5d0d11c89fc83a202d29565116c4f
6
+ metadata.gz: cc8ca673949e3a327bde6f53b8d7d840895abbb94e6e431cbbf0b87ecb61cf2f9f38319f184a9b177d9356ce5f1ba7c02646a57096c294284bb8c7c7c1621315
7
+ data.tar.gz: 0de8d7b5b43d4acae3ef4c60be2287f5459950c5c6c22b01538ed01e7b9ff813fc24581ad85f30f171e41d8510f1b7918eae711d82ad14394dd191d66052ae87
@@ -1,7 +1,9 @@
1
+ <!DOCTYPE html>
1
2
  <html>
2
3
 
3
4
  <head>
4
5
  <meta charset="utf-8" />
6
+ <title>Plumo</title>
5
7
 
6
8
  <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
7
9
  <script src="./plumo.js"></script>
data/lib/plumo/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Plumo
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
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.2
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-14 00:00:00.000000000 Z
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
- rubygems_version: 3.0.1
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