cf3 0.0.4 → 1.2.0
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 +5 -5
- data/.gitignore +2 -0
- data/{CHANGELOG → CHANGELOG.md} +13 -0
- data/Gemfile +1 -1
- data/README.md +21 -21
- data/Rakefile +7 -3
- data/bin/cf3samples +4 -4
- data/cf3ruby.gemspec +12 -13
- data/docs/.sass-cache/cd612fe6616e7f514a2421dc73159618de35b85d/jekyll-theme-cayman.scssc +0 -0
- data/docs/.sass-cache/cd612fe6616e7f514a2421dc73159618de35b85d/normalize.scssc +0 -0
- data/docs/.sass-cache/cd612fe6616e7f514a2421dc73159618de35b85d/rouge-github.scssc +0 -0
- data/docs/.sass-cache/cd612fe6616e7f514a2421dc73159618de35b85d/variables.scssc +0 -0
- data/docs/README.md +1 -0
- data/docs/_config.yml +31 -0
- data/docs/_site/README.md +1 -0
- data/docs/_site/about/index.html +52 -0
- data/docs/_site/assets/css/style.css +809 -0
- data/docs/_site/assets/y.png +0 -0
- data/docs/_site/example/index.html +113 -0
- data/docs/_site/favicon.ico +0 -0
- data/docs/_site/feed.xml +10 -0
- data/docs/_site/index.html +51 -0
- data/docs/_site/robots.txt +1 -0
- data/docs/_site/sitemap.xml +12 -0
- data/docs/about.md +14 -0
- data/docs/assets/y.png +0 -0
- data/docs/example.md +73 -0
- data/docs/favicon.ico +0 -0
- data/docs/index.md +10 -0
- data/lib/cf3/version.rb +1 -1
- data/lib/cf3.rb +85 -100
- data/samples/Rakefile +30 -0
- data/samples/accident.rb +34 -30
- data/samples/alhambra.rb +32 -29
- data/samples/bar_code.rb +26 -22
- data/samples/city.rb +14 -11
- data/samples/creature.rb +10 -6
- data/samples/dark_star.rb +5 -3
- data/samples/data/java_args.txt +1 -2
- data/samples/dragon.rb +8 -4
- data/samples/escher.rb +115 -116
- data/samples/fern.rb +13 -9
- data/samples/hex_tube.rb +16 -13
- data/samples/isosceles.rb +16 -11
- data/samples/levy.rb +5 -2
- data/samples/pcr.rb +28 -24
- data/samples/rubystar.rb +23 -17
- data/samples/sierpinski.rb +15 -11
- data/samples/spiral.rb +14 -10
- data/samples/star.rb +10 -6
- data/samples/tree.rb +20 -17
- data/samples/tree4.rb +12 -8
- data/samples/vine.rb +11 -7
- data/samples/xcross.rb +10 -7
- data/samples/y.rb +13 -9
- data/test/test_cf3.rb +11 -7
- metadata +50 -42
data/samples/tree4.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
# tree4.rb by Martin Prout after tree4.cfdg
|
3
3
|
# A non deterministic sketch run it until you get a result you like
|
4
4
|
# uncomment "srand 5" to get a more deterministic result. It looked
|
5
|
-
# pretty good on my linux box (however I'm not sure how universal the
|
5
|
+
# pretty good on my linux box (however I'm not sure how universal the
|
6
6
|
# random seeding is in jruby)
|
7
7
|
#################################################################
|
8
8
|
|
@@ -12,14 +12,14 @@ def setup_the_tree
|
|
12
12
|
@tree = ContextFree.define do
|
13
13
|
shape :trunk, 20 do # rule has a probability weighting of 20
|
14
14
|
circle size: 0.25, brightness: 0.5 # giving an actual probability = 0.952381
|
15
|
-
scraggle y: -0.1 # the minus is require by the upside down coordinate system
|
15
|
+
scraggle y: -0.1 # the minus is require by the upside down coordinate system
|
16
16
|
end
|
17
17
|
|
18
18
|
shape :trunk, 1 do # rule has a probability weighting of 1
|
19
|
-
branch size: 0.7 # giving an actual probability = 0.047619
|
19
|
+
branch size: 0.7 # giving an actual probability = 0.047619
|
20
20
|
end
|
21
21
|
|
22
|
-
shape :trunk, 0.02 do # empty rule top stop early
|
22
|
+
shape :trunk, 0.02 do # empty rule top stop early
|
23
23
|
end
|
24
24
|
|
25
25
|
shape :branch do
|
@@ -30,8 +30,8 @@ def setup_the_tree
|
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
|
-
shape :scraggle do # without an explicit weighting
|
34
|
-
trunk rotation: 5 # probability of each scraggle rule
|
33
|
+
shape :scraggle do # without an explicit weighting
|
34
|
+
trunk rotation: 5 # probability of each scraggle rule
|
35
35
|
end # is 0.5
|
36
36
|
|
37
37
|
shape :scraggle do
|
@@ -40,8 +40,12 @@ def setup_the_tree
|
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
43
|
-
def
|
43
|
+
def settings
|
44
44
|
size 600, 600
|
45
|
+
end
|
46
|
+
|
47
|
+
def setup
|
48
|
+
sketch_title 'Tree 4'
|
45
49
|
srand 5 # comment this to get variable tree shape
|
46
50
|
setup_the_tree
|
47
51
|
end
|
@@ -54,7 +58,7 @@ end
|
|
54
58
|
# color: [0, 0, 0, 1] even in HSB this should be black, seems to work...
|
55
59
|
#####
|
56
60
|
def draw_it
|
57
|
-
@tree.render :trunk, start_x: width/2, start_y: height * 0.9, stop_size: height/150, size: height/15, color: [0, 0, 0, 1]
|
61
|
+
@tree.render :trunk, start_x: width/2, start_y: height * 0.9, stop_size: height/150, size: height/15, color: [0, 0, 0, 1]
|
58
62
|
end
|
59
63
|
|
60
64
|
def mouse_clicked
|
data/samples/vine.rb
CHANGED
@@ -3,11 +3,11 @@
|
|
3
3
|
require 'cf3'
|
4
4
|
|
5
5
|
def setup_the_vine
|
6
|
-
|
6
|
+
|
7
7
|
@vine = ContextFree.define do
|
8
|
-
|
8
|
+
|
9
9
|
shrink = 0.961
|
10
|
-
|
10
|
+
|
11
11
|
shape :root do
|
12
12
|
split do
|
13
13
|
shoot y: 1
|
@@ -15,12 +15,12 @@ def setup_the_vine
|
|
15
15
|
shoot rotation: 180
|
16
16
|
end
|
17
17
|
end
|
18
|
-
|
18
|
+
|
19
19
|
shape :shoot do
|
20
20
|
square
|
21
21
|
shoot y: 0.98, rotation: 5, size: shrink + rand * 0.05, brightness: 0.990
|
22
22
|
end
|
23
|
-
|
23
|
+
|
24
24
|
shape :shoot, 0.02 do
|
25
25
|
square
|
26
26
|
split do
|
@@ -29,12 +29,16 @@ def setup_the_vine
|
|
29
29
|
shoot rotation: -90
|
30
30
|
end
|
31
31
|
end
|
32
|
-
|
32
|
+
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
|
-
def
|
36
|
+
def settings
|
37
37
|
size 700, 700
|
38
|
+
end
|
39
|
+
|
40
|
+
def setup
|
41
|
+
sketch_title 'Vine'
|
38
42
|
setup_the_vine
|
39
43
|
no_stroke
|
40
44
|
end
|
data/samples/xcross.rb
CHANGED
@@ -5,10 +5,13 @@ require 'cf3'
|
|
5
5
|
# from primitive terminals (renders on mouse clicked)
|
6
6
|
###
|
7
7
|
|
8
|
+
def settings
|
9
|
+
size 400, 200
|
10
|
+
end
|
11
|
+
|
8
12
|
def setup
|
9
|
-
|
10
|
-
@stars = ContextFree.define do
|
11
|
-
|
13
|
+
sketch_title 'X-Cross'
|
14
|
+
@stars = ContextFree.define do
|
12
15
|
shape :stars do
|
13
16
|
split do
|
14
17
|
cross size: 0.5, x: -2
|
@@ -16,21 +19,21 @@ def setup
|
|
16
19
|
plus size: 0.5, x: 2
|
17
20
|
end
|
18
21
|
end
|
19
|
-
|
22
|
+
|
20
23
|
shape :cross do
|
21
24
|
square w: 1, h: 3, rotation: -45
|
22
25
|
square w: 1, h: 3, rotation: 45
|
23
26
|
end
|
24
|
-
|
27
|
+
|
25
28
|
shape :plus do
|
26
29
|
square w: 1, h: 3
|
27
30
|
square w: 1, h: 3, rotation: 90
|
28
31
|
end
|
29
|
-
end
|
32
|
+
end
|
30
33
|
end
|
31
34
|
|
32
35
|
def draw_it
|
33
|
-
background 0.2
|
36
|
+
background 0.2
|
34
37
|
@stars.render :stars, size: height/2, color: [220, 1, 1, 1]
|
35
38
|
end
|
36
39
|
|
data/samples/y.rb
CHANGED
@@ -1,21 +1,21 @@
|
|
1
1
|
# y.rb ruby-processing by Martin Prout
|
2
2
|
require 'cf3'
|
3
|
-
Y_TOP = -1 / Math.sqrt(3)
|
3
|
+
Y_TOP = -1 / Math.sqrt(3)
|
4
4
|
Y_BOT = Math.sqrt(3) / 6
|
5
5
|
|
6
6
|
def setup_the_triangle
|
7
7
|
@triangle = ContextFree.define do
|
8
|
-
########
|
8
|
+
########
|
9
9
|
shape :start do
|
10
10
|
unit brightness: 1.0
|
11
11
|
end
|
12
|
-
|
12
|
+
|
13
13
|
shape :unit do
|
14
14
|
triangle size: 1.0
|
15
15
|
split do
|
16
16
|
unit size: 0.5, x: 0, y: Y_TOP/2, brightness: 0.8
|
17
|
-
rewind
|
18
|
-
unit size: 0.5, x: -0.25, y: -Y_TOP/4, brightness: 0.8
|
17
|
+
rewind
|
18
|
+
unit size: 0.5, x: -0.25, y: -Y_TOP/4, brightness: 0.8
|
19
19
|
rewind
|
20
20
|
unit size: 0.5, x: 0.25, y: -Y_TOP/4, brightness: 0.8
|
21
21
|
end
|
@@ -23,15 +23,19 @@ def setup_the_triangle
|
|
23
23
|
########
|
24
24
|
end
|
25
25
|
end
|
26
|
-
|
27
|
-
def
|
26
|
+
|
27
|
+
def settings
|
28
28
|
size 1024, 1024
|
29
|
+
smooth 8
|
30
|
+
end
|
31
|
+
|
32
|
+
def setup
|
33
|
+
sketch_title 'Y'
|
29
34
|
setup_the_triangle
|
30
35
|
no_stroke
|
31
36
|
color_mode RGB, 1
|
32
|
-
smooth 8
|
33
37
|
draw_it
|
34
|
-
save_frame(
|
38
|
+
save_frame(data_path('y.png'))
|
35
39
|
end
|
36
40
|
|
37
41
|
|
data/test/test_cf3.rb
CHANGED
@@ -1,19 +1,23 @@
|
|
1
1
|
require_relative '../lib/cf3.rb'
|
2
2
|
|
3
|
+
def settings
|
4
|
+
size 200, 200
|
5
|
+
end
|
6
|
+
|
3
7
|
def setup
|
4
|
-
|
8
|
+
sketch_title 'Test'
|
5
9
|
@triangle = ContextFree.define do
|
6
10
|
shape :tri do
|
7
|
-
circle
|
8
|
-
triangle brightness: 0.8
|
9
|
-
|
11
|
+
circle brightness: 1.0, sat: 1.0, hue: 200
|
12
|
+
triangle brightness: 0.8, hue: 60
|
13
|
+
square brightness: 0.02, size: 0.05
|
10
14
|
end
|
11
|
-
end
|
15
|
+
end
|
12
16
|
end
|
13
17
|
|
14
18
|
def draw_it
|
15
|
-
background 0
|
16
|
-
@triangle.render :tri, size: height/2
|
19
|
+
background 255, 255, 0 # NB: default color_mode here
|
20
|
+
@triangle.render :tri, size: height / 2.0
|
17
21
|
end
|
18
22
|
|
19
23
|
def draw
|
metadata
CHANGED
@@ -1,73 +1,60 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cf3
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeremy Ashkenas
|
8
|
-
- Martin Prout
|
8
|
+
- Martin Prout, Funatsufumiya
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2021-09-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
|
-
name:
|
15
|
+
name: jruby_art
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
|
-
- -
|
18
|
+
- - "~>"
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version:
|
20
|
+
version: '2.5'
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
|
-
- -
|
25
|
+
- - "~>"
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version:
|
28
|
-
- !ruby/object:Gem::Dependency
|
29
|
-
name: bundler
|
30
|
-
requirement: !ruby/object:Gem::Requirement
|
31
|
-
requirements:
|
32
|
-
- - ~>
|
33
|
-
- !ruby/object:Gem::Version
|
34
|
-
version: '1.3'
|
35
|
-
type: :development
|
36
|
-
prerelease: false
|
37
|
-
version_requirements: !ruby/object:Gem::Requirement
|
38
|
-
requirements:
|
39
|
-
- - ~>
|
40
|
-
- !ruby/object:Gem::Version
|
41
|
-
version: '1.3'
|
27
|
+
version: '2.5'
|
42
28
|
- !ruby/object:Gem::Dependency
|
43
29
|
name: rake
|
44
30
|
requirement: !ruby/object:Gem::Requirement
|
45
31
|
requirements:
|
46
|
-
- -
|
32
|
+
- - "~>"
|
47
33
|
- !ruby/object:Gem::Version
|
48
|
-
version: '0'
|
34
|
+
version: '13.0'
|
49
35
|
type: :development
|
50
36
|
prerelease: false
|
51
37
|
version_requirements: !ruby/object:Gem::Requirement
|
52
38
|
requirements:
|
53
|
-
- -
|
39
|
+
- - "~>"
|
54
40
|
- !ruby/object:Gem::Version
|
55
|
-
version: '0'
|
56
|
-
description:
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
41
|
+
version: '13.0'
|
42
|
+
description: |2
|
43
|
+
A library for JRubyArt, that allows the writing of context free
|
44
|
+
sketches (like context free art) in a ruby DSL. It is a bit of a toy
|
45
|
+
compared to the c++ version. However you can get quite a bit of
|
46
|
+
satisfaction creating an interesting graphic, and you can't always
|
47
|
+
predict what you are going to get.
|
61
48
|
email:
|
62
|
-
-
|
49
|
+
- mamba2928@yahoo.co.uk
|
63
50
|
executables:
|
64
51
|
- cf3samples
|
65
52
|
extensions: []
|
66
53
|
extra_rdoc_files: []
|
67
54
|
files:
|
68
|
-
- .gitignore
|
69
|
-
- .yardopts
|
70
|
-
- CHANGELOG
|
55
|
+
- ".gitignore"
|
56
|
+
- ".yardopts"
|
57
|
+
- CHANGELOG.md
|
71
58
|
- CONTRIBUTING.md
|
72
59
|
- Gemfile
|
73
60
|
- LICENSE.md
|
@@ -75,8 +62,30 @@ files:
|
|
75
62
|
- Rakefile
|
76
63
|
- bin/cf3samples
|
77
64
|
- cf3ruby.gemspec
|
65
|
+
- docs/.sass-cache/cd612fe6616e7f514a2421dc73159618de35b85d/jekyll-theme-cayman.scssc
|
66
|
+
- docs/.sass-cache/cd612fe6616e7f514a2421dc73159618de35b85d/normalize.scssc
|
67
|
+
- docs/.sass-cache/cd612fe6616e7f514a2421dc73159618de35b85d/rouge-github.scssc
|
68
|
+
- docs/.sass-cache/cd612fe6616e7f514a2421dc73159618de35b85d/variables.scssc
|
69
|
+
- docs/README.md
|
70
|
+
- docs/_config.yml
|
71
|
+
- docs/_site/README.md
|
72
|
+
- docs/_site/about/index.html
|
73
|
+
- docs/_site/assets/css/style.css
|
74
|
+
- docs/_site/assets/y.png
|
75
|
+
- docs/_site/example/index.html
|
76
|
+
- docs/_site/favicon.ico
|
77
|
+
- docs/_site/feed.xml
|
78
|
+
- docs/_site/index.html
|
79
|
+
- docs/_site/robots.txt
|
80
|
+
- docs/_site/sitemap.xml
|
81
|
+
- docs/about.md
|
82
|
+
- docs/assets/y.png
|
83
|
+
- docs/example.md
|
84
|
+
- docs/favicon.ico
|
85
|
+
- docs/index.md
|
78
86
|
- lib/cf3.rb
|
79
87
|
- lib/cf3/version.rb
|
88
|
+
- samples/Rakefile
|
80
89
|
- samples/accident.rb
|
81
90
|
- samples/alhambra.rb
|
82
91
|
- samples/bar_code.rb
|
@@ -101,9 +110,10 @@ files:
|
|
101
110
|
- samples/xcross.rb
|
102
111
|
- samples/y.rb
|
103
112
|
- test/test_cf3.rb
|
104
|
-
homepage: http://
|
113
|
+
homepage: http://monkstone.github.io/cf3ruby/
|
105
114
|
licenses:
|
106
|
-
-
|
115
|
+
- GPL-3.0
|
116
|
+
- LGPL-2.0
|
107
117
|
metadata: {}
|
108
118
|
post_install_message:
|
109
119
|
rdoc_options: []
|
@@ -111,20 +121,18 @@ require_paths:
|
|
111
121
|
- lib
|
112
122
|
required_ruby_version: !ruby/object:Gem::Requirement
|
113
123
|
requirements:
|
114
|
-
- -
|
124
|
+
- - ">="
|
115
125
|
- !ruby/object:Gem::Version
|
116
126
|
version: '0'
|
117
127
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
118
128
|
requirements:
|
119
|
-
- -
|
129
|
+
- - ">="
|
120
130
|
- !ruby/object:Gem::Version
|
121
131
|
version: '0'
|
122
132
|
requirements: []
|
123
|
-
|
124
|
-
rubygems_version: 2.0.5
|
133
|
+
rubygems_version: 3.1.2
|
125
134
|
signing_key:
|
126
135
|
specification_version: 4
|
127
136
|
summary: A ruby-DSL library for CF3 sketches
|
128
137
|
test_files:
|
129
138
|
- test/test_cf3.rb
|
130
|
-
has_rdoc:
|