asobi 0.1.0 → 0.1.1
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 +4 -4
- data/CHANGELOG.md +10 -0
- data/README.ja.md +21 -23
- data/README.md +19 -25
- data/lib/asobi/version.rb +1 -1
- metadata +12 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f1fb01e7675bac384cc8aa89e138dc39dea2e7b675cf5b4272c241759538dd3f
|
|
4
|
+
data.tar.gz: 45cb54572b6f5246281d6c8662c96c1f9607ca707ca276e1f913e33d4147efe8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 142b1c6278e5c195c44f52a4d3f1dc31c480bf0df20066b3dbc73f6ab1135bd09fd5f54b9474d5fe5c422d6d4fc723dfe1c2b783e73fd80b328c717d42b00557
|
|
7
|
+
data.tar.gz: 6c6a6a3a3c23c2adebf84c714c372fcc4c0c7a86e92c8ccbb71d7c0f626b8ddf5eef08d1c831dd159dcc369f62349862a159f3646995d11ccf35aac6f3ed1169
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.1.1
|
|
4
|
+
|
|
5
|
+
- RubyGems links to the [official website](https://asobi.myura.me/), the [method reference](https://asobi.myura.me/reference), and the changelog for this version.
|
|
6
|
+
- The English and Japanese READMEs now start with `gem install asobi` and link to the browser playground and the short film [Your Objects](https://asobi.myura.me/#film).
|
|
7
|
+
|
|
8
|
+
## 0.1.0
|
|
9
|
+
|
|
10
|
+
- Initial release. Create pictures and looping animations with Ruby objects, preview sketches live with `asobi`, and export them as SVG or standalone HTML.
|
data/README.ja.md
CHANGED
|
@@ -1,38 +1,32 @@
|
|
|
1
1
|
# asobi
|
|
2
2
|
|
|
3
|
-
[English](README.md)
|
|
3
|
+
[公式サイト](https://asobi.myura.me/ja/) · [紹介映像を見る(32秒)](https://asobi.myura.me/ja/#film) · [RubyGems](https://rubygems.org/gems/asobi) · [English](README.md)
|
|
4
4
|
|
|
5
5
|
asobi(遊び)は、Ruby で図形を組み合わせて、SVG の静止画やループアニメーションを作るライブラリです。たとえば花びらを8枚並べると、ひとつの花ができます。花も Ruby のオブジェクトなので、`spin` を呼ぶと花ごと回ります。
|
|
6
6
|
|
|
7
|
-
```ruby
|
|
8
|
-
require "asobi"
|
|
9
|
-
|
|
10
|
-
flower = petal.repeat(8).in_fan.colored(:crimson, :navy)
|
|
11
|
-
show flower.spin(every: 8)
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
<img src="docs/first-sketch.svg" width="240" alt="深紅と紺の花びらが交互に8枚並んだ花。">
|
|
15
|
-
|
|
16
7
|
## 最初のスケッチを動かす
|
|
17
8
|
|
|
18
|
-
用意するのは Ruby 3.2
|
|
9
|
+
用意するのは Ruby 3.2 以上とブラウザです。スケッチを置きたいフォルダで次の2行を実行します。
|
|
19
10
|
|
|
20
11
|
```sh
|
|
21
|
-
|
|
12
|
+
gem install asobi
|
|
13
|
+
asobi
|
|
22
14
|
```
|
|
23
15
|
|
|
24
|
-
|
|
16
|
+
初回は次のコードが入った `play.rb` が作られ、ブラウザで花が回り始めます。すでに同名のファイルがある場合は、そのスケッチが開きます。
|
|
17
|
+
|
|
18
|
+
```ruby
|
|
19
|
+
require "asobi"
|
|
25
20
|
|
|
26
|
-
|
|
21
|
+
flower = petal.repeat(8).in_fan.colored(:crimson, :navy)
|
|
22
|
+
show flower.spin(every: 8)
|
|
23
|
+
```
|
|
27
24
|
|
|
28
|
-
|
|
25
|
+
<img src="docs/first-sketch.svg" width="240" alt="深紅と紺の花びらが交互に8枚並んだ花。">
|
|
29
26
|
|
|
30
|
-
|
|
27
|
+
`play.rb` の `repeat(8)` を `repeat(12)` に変えて保存すると、花びらが12枚に増えます。`spin(every: 8)` の `8` を `2` に変えると、今度は2秒で1回転します。ファイルを保存するたびに表示が更新されます。終了するには、コマンドを実行したターミナルで Ctrl+C を押します。
|
|
31
28
|
|
|
32
|
-
|
|
33
|
-
gem build asobi.gemspec --output asobi.gem
|
|
34
|
-
gem install --local ./asobi.gem
|
|
35
|
-
```
|
|
29
|
+
ほかの作品を開くには、`asobi sketch.rb` のようにファイルを指定します。`require "asobi"` と `show` を書いたスケッチは `ruby sketch.rb` でも開けます。ブラウザを自分で開く場合は `asobi` コマンドに `--no-open` を付けて、ターミナルに表示された URL にアクセスしてください。`--port 5000` を付けると、5000 番から空いているポートを探します(既定は 4567 番)。
|
|
36
30
|
|
|
37
31
|
## スケッチの書き方
|
|
38
32
|
|
|
@@ -116,7 +110,7 @@ show motion
|
|
|
116
110
|
|
|
117
111
|
## 既存の Ruby プログラムに組み込む
|
|
118
112
|
|
|
119
|
-
`require "asobi"` を使うと、`circle` などをトップレベルで呼べるようになり、数値や配列に `to_art` が加わります。既存のプログラムで Ruby の標準クラスを拡張せずに使うには、`asobi/pure`
|
|
113
|
+
`require "asobi"` を使うと、`circle` などをトップレベルで呼べるようになり、数値や配列に `to_art` が加わります。既存のプログラムで Ruby の標準クラスを拡張せずに使うには、`asobi/pure` を読み込みます。次のコードを `export.rb` として保存し、同じフォルダで `ruby export.rb` を実行すると、紺色の星を3つ並べた `stars.svg` ができます。
|
|
120
114
|
|
|
121
115
|
```ruby
|
|
122
116
|
require "asobi/pure"
|
|
@@ -127,7 +121,9 @@ stars.colored(:navy).save("stars.svg")
|
|
|
127
121
|
|
|
128
122
|
## 作例とドキュメント
|
|
129
123
|
|
|
130
|
-
|
|
124
|
+
ブラウザでスケッチを試すには[遊び場](https://asobi.myura.me/ja/playground.html)を開いてください。[入門ガイド](https://asobi.myura.me/ja/guide.html)と[リファレンス](https://asobi.myura.me/ja/reference.html)もオンラインで読めます。
|
|
125
|
+
|
|
126
|
+
リポジトリには、1ファイルで動くスケッチが入っています。クローンしたリポジトリのルートで `asobi examples/flower.rb` を実行すると、花の作例を開けます。
|
|
131
127
|
|
|
132
128
|
- 数列を形にする仕組みを試すなら [数列の星](examples/sequence.rb)
|
|
133
129
|
- 発光、色の合成、残像を重ねるなら [ネオンの花](examples/neon_flower.rb)
|
|
@@ -143,7 +139,9 @@ bundle exec rake site
|
|
|
143
139
|
|
|
144
140
|
生成された `_site/ja/index.html` をブラウザで開くと、日本語版を読めます。「遊び場」でコードを編集して実行するには、CDN から ruby.wasm を読み込むためのインターネット接続が必要です。
|
|
145
141
|
|
|
146
|
-
|
|
142
|
+
## 開発
|
|
143
|
+
|
|
144
|
+
ライブラリ本体に加えた変更は、リポジトリのルートで `ruby exe/asobi examples/flower.rb` を実行して試せます。依存関係を `bundle install` でインストールしたら、`bundle exec rake test` でテストを実行できます。ライブラリ本体に加え、ドキュメントや作例のスケッチも検証します。ライブラリの設計については[設計書](DESIGN.md)を参照してください。
|
|
147
145
|
|
|
148
146
|
## 不具合報告・機能提案
|
|
149
147
|
|
data/README.md
CHANGED
|
@@ -1,40 +1,32 @@
|
|
|
1
1
|
# asobi
|
|
2
2
|
|
|
3
|
-
[日本語版](README.ja.md)
|
|
3
|
+
[Official website](https://asobi.myura.me/) · [Watch the 32-second film](https://asobi.myura.me/#film) · [RubyGems](https://rubygems.org/gems/asobi) · [日本語版](README.ja.md)
|
|
4
4
|
|
|
5
|
-
asobi (Japanese for “play”) is a Ruby library for making SVG pictures and looping animations. A picture is a Ruby value.
|
|
6
|
-
|
|
7
|
-
```ruby
|
|
8
|
-
require "asobi"
|
|
9
|
-
|
|
10
|
-
flower = petal.repeat(8).in_fan.colored(:crimson, :navy)
|
|
11
|
-
show flower.spin(every: 8)
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
<img src="docs/first-sketch.svg" width="240" alt="Eight petals, alternating crimson and navy, arranged around a common centre.">
|
|
5
|
+
asobi (Japanese for “play”) is a Ruby library for making SVG pictures and looping animations. A picture is a Ruby value. You can copy a petal eight times, arrange the petals into a flower and spin the whole flower.
|
|
15
6
|
|
|
16
7
|
## Run your first sketch
|
|
17
8
|
|
|
18
|
-
You'll need Ruby **3.2 or newer** and a browser.
|
|
9
|
+
You'll need Ruby **3.2 or newer** and a browser. Run these commands in the folder where you'd like to keep your sketch.
|
|
19
10
|
|
|
20
11
|
```sh
|
|
21
|
-
|
|
12
|
+
gem install asobi
|
|
13
|
+
asobi
|
|
22
14
|
```
|
|
23
15
|
|
|
24
|
-
asobi creates `play.rb` with the
|
|
16
|
+
asobi creates `play.rb` with the sketch below and opens the spinning flower in your browser. If `play.rb` already exists, it opens that sketch.
|
|
25
17
|
|
|
26
|
-
|
|
18
|
+
```ruby
|
|
19
|
+
require "asobi"
|
|
27
20
|
|
|
28
|
-
|
|
21
|
+
flower = petal.repeat(8).in_fan.colored(:crimson, :navy)
|
|
22
|
+
show flower.spin(every: 8)
|
|
23
|
+
```
|
|
29
24
|
|
|
30
|
-
|
|
25
|
+
<img src="docs/first-sketch.svg" width="240" alt="Eight petals, alternating crimson and navy, arranged around a common centre.">
|
|
31
26
|
|
|
32
|
-
|
|
33
|
-
gem build asobi.gemspec --output asobi.gem
|
|
34
|
-
gem install --local ./asobi.gem
|
|
35
|
-
```
|
|
27
|
+
Change `repeat(8)` to `repeat(12)` in `play.rb` and save to add four petals. Change `every: 8` to `every: 2` to make the flower turn once every two seconds. Press Ctrl-C in the terminal to stop the preview.
|
|
36
28
|
|
|
37
|
-
|
|
29
|
+
To open another sketch, pass its path to `asobi`, for example `asobi sketch.rb`. A file that contains `require "asobi"` and calls `show` also runs with `ruby sketch.rb`. Add `--no-open` to the `asobi` command to open the URL printed in the terminal yourself. The server looks for a free port starting at 4567. Use `--port 5000` to start the search at 5000.
|
|
38
30
|
|
|
39
31
|
## Build pictures in Ruby
|
|
40
32
|
|
|
@@ -118,7 +110,7 @@ To save a particular frame, use `motion.at(1).save("frame.svg")` for the picture
|
|
|
118
110
|
|
|
119
111
|
## Use asobi from an existing Ruby program
|
|
120
112
|
|
|
121
|
-
Load `asobi/pure` to keep shape names under `Asobi` and leave Ruby's built-in classes untouched. Save the following as `export.rb`
|
|
113
|
+
Load `asobi/pure` to keep shape names under `Asobi` and leave Ruby's built-in classes untouched. Save the following as `export.rb` and run `ruby export.rb` from the same folder. It writes three navy stars to `stars.svg`.
|
|
122
114
|
|
|
123
115
|
```ruby
|
|
124
116
|
require "asobi/pure"
|
|
@@ -129,7 +121,9 @@ stars.colored(:navy).save("stars.svg")
|
|
|
129
121
|
|
|
130
122
|
## Examples and reference
|
|
131
123
|
|
|
132
|
-
|
|
124
|
+
Try a sketch in your browser or look up a method in the [online guide](https://asobi.myura.me/guide.html), [playground](https://asobi.myura.me/playground.html) or [reference](https://asobi.myura.me/reference.html).
|
|
125
|
+
|
|
126
|
+
Each file is a complete sketch. From a checkout of the repository, try `asobi examples/flower.rb`. [Browse all examples](examples/README.md)
|
|
133
127
|
|
|
134
128
|
- Turn a number sequence into a row of stars. [Number sequence](examples/sequence.rb)
|
|
135
129
|
- Layer glow, screen blending and trails. [Neon flower](examples/neon_flower.rb)
|
|
@@ -146,7 +140,7 @@ Open `_site/index.html` in a browser for English or `_site/ja/index.html` for Ja
|
|
|
146
140
|
|
|
147
141
|
## Development
|
|
148
142
|
|
|
149
|
-
After `bundle install`, run `bundle exec rake test`. The suite checks the library and CLI, builds the site with test data, and runs the sketch examples from the gallery and both READMEs. For the design of pictures, motion and the `to_art` protocol, see the [design notes (Japanese)](DESIGN.md).
|
|
143
|
+
From the repository root, use `ruby exe/asobi examples/flower.rb` to try changes to the library. After `bundle install`, run `bundle exec rake test`. The suite checks the library and CLI, builds the site with test data, and runs the sketch examples from the gallery and both READMEs. For the design of pictures, motion and the `to_art` protocol, see the [design notes (Japanese)](DESIGN.md).
|
|
150
144
|
|
|
151
145
|
## Bugs and feature ideas
|
|
152
146
|
|
data/lib/asobi/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: asobi
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Hayato1031
|
|
@@ -10,15 +10,19 @@ bindir: exe
|
|
|
10
10
|
cert_chain: []
|
|
11
11
|
date: 2026-11-11 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
|
-
description: asobi (play)
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
description: 'asobi (Japanese for ''play'') is a Ruby library for making pictures
|
|
14
|
+
and looping animations. A picture is a Ruby object: repeat a petal eight times,
|
|
15
|
+
arrange the petals into a flower, and spin the whole flower. Give your own objects
|
|
16
|
+
a visual form by defining to_art. Run the asobi command to see your sketch update
|
|
17
|
+
in the browser as you edit. Export a still as SVG or an animation as a standalone
|
|
18
|
+
HTML file.'
|
|
16
19
|
email:
|
|
17
20
|
executables:
|
|
18
21
|
- asobi
|
|
19
22
|
extensions: []
|
|
20
23
|
extra_rdoc_files: []
|
|
21
24
|
files:
|
|
25
|
+
- CHANGELOG.md
|
|
22
26
|
- DESIGN.md
|
|
23
27
|
- LICENSE
|
|
24
28
|
- README.ja.md
|
|
@@ -45,12 +49,14 @@ files:
|
|
|
45
49
|
- lib/asobi/version.rb
|
|
46
50
|
- lib/asobi/web/live.html
|
|
47
51
|
- lib/asobi/web/player.js
|
|
48
|
-
homepage: https://
|
|
52
|
+
homepage: https://asobi.myura.me/
|
|
49
53
|
licenses:
|
|
50
54
|
- MIT
|
|
51
55
|
metadata:
|
|
56
|
+
documentation_uri: https://asobi.myura.me/reference
|
|
52
57
|
source_code_uri: https://github.com/Hayato1031/asobi
|
|
53
58
|
bug_tracker_uri: https://github.com/Hayato1031/asobi/issues
|
|
59
|
+
changelog_uri: https://github.com/Hayato1031/asobi/blob/v0.1.1/CHANGELOG.md
|
|
54
60
|
post_install_message:
|
|
55
61
|
rdoc_options: []
|
|
56
62
|
require_paths:
|
|
@@ -69,5 +75,5 @@ requirements: []
|
|
|
69
75
|
rubygems_version: 3.5.11
|
|
70
76
|
signing_key:
|
|
71
77
|
specification_version: 4
|
|
72
|
-
summary:
|
|
78
|
+
summary: Make SVG pictures and looping animations with Ruby objects.
|
|
73
79
|
test_files: []
|