atome 0.5.1.9 → 0.5.2.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (91) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +22 -5
  3. data/lib/atome/atome.rb +46 -21
  4. data/lib/atome/extensions/atome.rb +5 -26
  5. data/lib/atome/extensions/geolocation.rb +0 -1
  6. data/lib/atome/extensions/matrix.rb +171 -0
  7. data/lib/atome/extensions/ping.rb +9 -11
  8. data/lib/atome/genesis/generators/atome.rb +14 -2
  9. data/lib/atome/genesis/generators/communication.rb +1 -1
  10. data/lib/atome/genesis/generators/event.rb +32 -3
  11. data/lib/atome/genesis/generators/identity.rb +32 -0
  12. data/lib/atome/genesis/generators/material.rb +21 -0
  13. data/lib/atome/genesis/generators/spatial.rb +1 -0
  14. data/lib/atome/genesis/generators/time.rb +5 -0
  15. data/lib/atome/genesis/generators/utility.rb +20 -2
  16. data/lib/atome/genesis/genesis.rb +4 -4
  17. data/lib/atome/genesis/sparkle.rb +1 -1
  18. data/lib/atome/helpers/callbacks.rb +36 -29
  19. data/lib/atome/helpers/essentials.rb +5 -2
  20. data/lib/atome/helpers/utilities.rb +59 -10
  21. data/lib/atome/kernel/universe.rb +3 -7
  22. data/lib/atome/presets/atome.rb +11 -7
  23. data/lib/atome/renderers/browser/atome.rb +7 -7
  24. data/lib/atome/renderers/browser/browser.rb +6 -2
  25. data/lib/atome/renderers/browser/effect.rb +2 -2
  26. data/lib/atome/renderers/browser/event.rb +25 -19
  27. data/lib/atome/renderers/browser/geometry.rb +2 -2
  28. data/lib/atome/renderers/browser/helpers/animation_helper.rb +69 -0
  29. data/lib/atome/renderers/browser/helpers/browser_helper.rb +0 -1
  30. data/lib/atome/renderers/browser/helpers/color_helper.rb +0 -2
  31. data/lib/atome/renderers/browser/helpers/drag_helper.rb +6 -6
  32. data/lib/atome/renderers/browser/helpers/effect_helper.rb +1 -0
  33. data/lib/atome/renderers/browser/helpers/event_helper.rb +59 -0
  34. data/lib/atome/renderers/browser/helpers/video_helper.rb +10 -3
  35. data/lib/atome/renderers/browser/identity.rb +10 -3
  36. data/lib/atome/renderers/browser/material.rb +28 -5
  37. data/lib/atome/renderers/browser/spatial.rb +36 -5
  38. data/lib/atome/renderers/browser/time.rb +3 -0
  39. data/lib/atome/renderers/browser/utility.rb +20 -11
  40. data/lib/atome/renderers/headless/utility.rb +2 -2
  41. data/lib/atome/renderers/html/atome.rb +5 -5
  42. data/lib/atome/renderers/html/effect.rb +1 -1
  43. data/lib/atome/renderers/html/event.rb +1 -1
  44. data/lib/atome/renderers/html/geometry.rb +2 -2
  45. data/lib/atome/renderers/html/html.rb +1 -1
  46. data/lib/atome/renderers/html/identity.rb +2 -2
  47. data/lib/atome/renderers/html/spatial.rb +5 -5
  48. data/lib/atome/renderers/html/utility.rb +7 -7
  49. data/lib/atome/renderers/server/utility.rb +2 -2
  50. data/lib/atome/version.rb +1 -1
  51. data/lib/atome.rb +7 -3
  52. data/sig/atome.rbs +6 -0
  53. data/sig/atome_js.rbs +1 -0
  54. data/vendor/assets/build/css/style.css +23 -16
  55. data/vendor/assets/build/index.html +4 -2
  56. data/vendor/assets/build/js/third_parties/wad.min.js +9 -0
  57. data/vendor/assets/build/medias/audios/Binrpilot.mp3 +0 -0
  58. data/vendor/assets/build/medias/rubies/examples/_2_solve.rb +24 -2
  59. data/vendor/assets/build/medias/rubies/examples/_audio.rb +178 -0
  60. data/vendor/assets/build/medias/rubies/examples/_dataset.rb +80 -0
  61. data/vendor/assets/build/medias/rubies/examples/_os.rb +29 -0
  62. data/vendor/assets/build/medias/rubies/examples/_test.rb +1 -0
  63. data/vendor/assets/build/medias/rubies/examples/_vie.rb +211 -0
  64. data/vendor/assets/build/medias/rubies/examples/add.rb +25 -0
  65. data/vendor/assets/build/medias/rubies/examples/animation.rb +81 -0
  66. data/vendor/assets/build/medias/rubies/examples/{atome.new.rb → atome_new.rb} +5 -5
  67. data/vendor/assets/build/medias/rubies/examples/bottom.rb +1 -1
  68. data/vendor/assets/build/medias/rubies/examples/center.rb +21 -0
  69. data/vendor/assets/build/medias/rubies/examples/clone.rb +35 -0
  70. data/vendor/assets/build/medias/rubies/examples/color.rb +20 -15
  71. data/vendor/assets/build/medias/rubies/examples/cursor.rb +7 -0
  72. data/vendor/assets/build/medias/rubies/examples/delete.rb +25 -3
  73. data/vendor/assets/build/medias/rubies/examples/drag.rb +3 -2
  74. data/vendor/assets/build/medias/rubies/examples/edit.rb +12 -0
  75. data/vendor/assets/build/medias/rubies/examples/empty_atome.rb +12 -0
  76. data/vendor/assets/build/medias/rubies/examples/hide.rb +7 -0
  77. data/vendor/assets/build/medias/rubies/examples/markers.rb +48 -0
  78. data/vendor/assets/build/medias/rubies/examples/matrix.rb +58 -0
  79. data/vendor/assets/build/medias/rubies/examples/monitoring.rb +22 -11
  80. data/vendor/assets/build/medias/rubies/examples/play.rb +1 -1
  81. data/vendor/assets/build/medias/rubies/examples/read.rb +7 -4
  82. data/vendor/assets/build/medias/rubies/examples/remove.rb +16 -0
  83. data/vendor/assets/build/medias/rubies/examples/right.rb +1 -1
  84. data/vendor/assets/build/medias/rubies/examples/shadow.rb +8 -1
  85. data/vendor/assets/build/medias/rubies/examples/sort.rb +7 -4
  86. data/vendor/assets/build/medias/rubies/examples/style.rb +4 -0
  87. data/vendor/assets/build/medias/rubies/examples/touch.rb +50 -7
  88. data/vendor/assets/build/medias/texts/lorem.txt +1 -0
  89. metadata +28 -5
  90. data/vendor/assets/build/medias/rubies/examples/_animation.rb +0 -46
  91. data/vendor/assets/build/medias/rubies/examples/at.rb +0 -17
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 108def7ca1abaccd885638fdea127766d1f97c4ac2559faee3eec445b52bdbac
4
- data.tar.gz: bf00b2ccb9e339a08c16221964b11cd6c2440cc415f6886bef2e4c18ac1967f1
3
+ metadata.gz: f484bac3226108b4f85b673ca7351becb12af457707ef7cca080058c15b13ef5
4
+ data.tar.gz: a7c42ee2a67b75ed1d0099bf082888ab50bbe2a56e2c68e93436f839ab363c89
5
5
  SHA512:
6
- metadata.gz: 3ecf2a30c425a8b46f88f08cd5b436d6298dd36b8db8984a50190a15a360639c6ac161725c3c5a7b327c740927032315a46a988fbdf5790fe830e31a5d22d4a4
7
- data.tar.gz: 5585b8e500d715c86799172790bcc7be0bbc67cfbc438a6fedf03be8aecfea287df999588d4771d4c50f6a62dbad35fa2002f387b425fc602de776c9ff310ca0
6
+ metadata.gz: b9f6e623de170446b7396d38240cd02d92e0943e1f45d6f51161c4c2dc4057ab13c32e4273e04730708f8da42d429c3865175339e102a82f797bb476b4a4dfb1
7
+ data.tar.gz: 4319997d39d49fa04541cf888e69d23db768455969a55944531ce70f55f889d0ffb05aa3db8de5db0cdaa0117cb6640ea401a73e6b6f80a46788fa8b8dcd7450
data/Rakefile CHANGED
@@ -14,21 +14,38 @@ task default: :test
14
14
  task :test_browser do
15
15
  FileUtils.copy_entry('vendor/assets/build/js/', 'test/test_app/build/js/')
16
16
  FileUtils.copy_entry('vendor/assets/build/css/', 'test/test_app/build/css/')
17
- FileUtils.copy_entry('vendor/assets/build/css/', 'test/test_app/build/medias/')
17
+ FileUtils.copy_entry('vendor/assets/build/medias/', 'test/test_app/build/medias/')
18
18
  `gem cleanup atome;yes | gem uninstall atome ;gem build atome.gemspec;gem install atome`
19
19
  `cd test/test_app;atome update;atome run guard`
20
20
  end
21
21
 
22
- task :run_browser do
23
- `cd test/test_app;atome run guard`
24
- end
22
+
25
23
 
26
24
  task :test_server do
27
25
  FileUtils.copy_entry('vendor/assets/build/js/', 'test/test_app/build/js/')
28
26
  FileUtils.copy_entry('vendor/assets/build/css/', 'test/test_app/build/css/')
29
- FileUtils.copy_entry('vendor/assets/build/css/', 'test/test_app/build/medias/')
27
+ FileUtils.copy_entry('vendor/assets/build/medias/', 'test/test_app/build/medias/')
30
28
  `gem cleanup atome;yes | gem uninstall atome ;gem build atome.gemspec;gem install atome`
31
29
  `cd test/test_app;atome update;atome run server`
32
30
  end
33
31
 
32
+ task :run_browser do
33
+ `cd test/test_app;atome run guard`
34
+ end
35
+
36
+ task :run_server do
37
+ `cd test/test_app;atome run server guard`
38
+ end
39
+
40
+ task :run_example do
41
+ FileUtils.copy_entry('vendor/assets/build/medias/rubies/examples/', 'test/test_app/build/medias/rubies/examples/')
42
+ `cd test/test_app;atome run `
43
+ end
44
+
45
+ task :run_example_server do
46
+ FileUtils.copy_entry('vendor/assets/build/medias/rubies/examples/', 'test/test_app/build/medias/rubies/examples/')
47
+ `cd test/test_app;atome run server `
48
+ end
49
+
50
+
34
51
  task default: :test
data/lib/atome/atome.rb CHANGED
@@ -15,23 +15,25 @@ class Atome
15
15
  atomes.each_value do |elements|
16
16
  # the instance variable below contain the id all any atomes that need to be informed when changes occurs
17
17
  @broadcast = {}
18
- @at_time = {}
18
+ # @at_time = {}
19
19
  # now we store the proc in a an atome's property called :bloc
20
20
  elements[:code] = atomes_proc if atomes_proc
21
21
  @atome = elements
22
22
  # we initiate the rendering, eg for for browser we will call :browser_type generate method in identity.rb file
23
- create_particle(:type, @atome[:type])
23
+ create_particle(:type)
24
+ set_type(@atome[:type])
24
25
  collapse
25
26
  end
26
27
  end
27
28
 
28
29
  def new_particle(element, &method_proc)
29
30
  Atome.define_method element do |params = nil, &user_proc|
30
- if params
31
+ if params || params == false
31
32
  # the line below execute the proc created when using the build_particle method
32
33
  instance_exec(params, user_proc, &method_proc) if method_proc.is_a?(Proc)
33
34
  params = sanitize(element, params)
34
- create_particle(element, params, &user_proc)
35
+ create_particle(element)
36
+ send("set_#{element}", params, &user_proc)
35
37
  else
36
38
  get_particle(element, &user_proc)
37
39
  end
@@ -42,20 +44,27 @@ class Atome
42
44
  Atome.define_method "#{element}=" do |params = nil, &user_proc|
43
45
  instance_exec(params, user_proc, &method_proc) if method_proc.is_a?(Proc)
44
46
  params = sanitize(element, params)
45
- create_particle(element, params, &user_proc)
47
+ particle_creation(element, params, &user_proc)
46
48
  end
47
49
  end
48
50
 
51
+ def atome_creation_pre_treatment(element, params, &user_proc)
52
+ params = sanitize(element, params)
53
+ create_atome(element)
54
+ send("set_#{element}", params, &user_proc)
55
+ end
56
+
49
57
  def new_atome(element, &method_proc)
50
58
  Atome.define_method element do |params = nil, &user_proc|
51
59
  if params
52
60
  instance_exec(params, user_proc, &method_proc) if method_proc.is_a?(Proc)
53
- params = sanitize(element, params)
54
- Atome.new({ element => params })
61
+ atome_creation_pre_treatment(element, params, &user_proc)
55
62
  else
56
63
  get_atome(element, &user_proc)
57
64
  end
58
65
  end
66
+ # the method below generate Atome method creation at Object level
67
+ create_method_at_object_level(element)
59
68
  end
60
69
 
61
70
  def new_render_engine(renderer_name, &method_proc)
@@ -66,39 +75,52 @@ class Atome
66
75
 
67
76
  def run_optional_proc(proc_name, atome = self, value = '', &user_proc)
68
77
  option_found = Universe.get_optional_method(proc_name)
69
- atome.instance_exec(value,user_proc, &option_found) if option_found.is_a?(Proc)
78
+ atome.instance_exec(value, user_proc, atome, &option_found) if option_found.is_a?(Proc)
70
79
  end
71
80
 
72
81
  def inject_value(element, value)
82
+ # attention : please keep the method 'inject_value' available as it is sometimes needed to access it directly
73
83
  @atome[element] = value
74
84
  end
75
85
 
76
- def store_value(element, value)
86
+ def store_value(element)
77
87
  # this method save the value of the particle and broadcast to the atomes listed in broadcast
78
- broadcasting(element, value)
79
- inject_value(element, value)
88
+ broadcasting(element, @atome[element])
89
+ inject_value(element, @atome[element])
80
90
  end
81
91
 
82
92
  public
83
93
 
84
94
  # the line below is used for ephemera atomes
85
95
  attr_accessor :property, :value, :real_atome, :user_proc
86
- attr_reader :atome, :structure, :at_time
96
+ attr_reader :atome, :structure#, :at_time
87
97
 
88
98
  def set(value)
89
99
  @real_atome[@property] = value
90
100
  end
91
101
 
92
- def create_particle(element, value, &user_proc)
93
- return false unless security_pass(element, value)
94
-
95
- run_optional_proc("pre_render_#{element}".to_sym, self, value, &user_proc)
96
- rendering(element, value, &user_proc)
97
- run_optional_proc("post_render_#{element}".to_sym, self, value, &user_proc)
98
- store_value(element, value)
102
+ def particle_creation(element, params, &user_proc)
103
+ return false unless security_pass(element, params)
104
+
105
+ # we create a proc holder of any new particle if user pass a bloc
106
+ store_code_bloc(element, &user_proc) if user_proc
107
+ # we store the params immediately into the atome so optionals methods can access and modify it
108
+ @atome[element] = params
109
+ run_optional_proc("pre_render_#{@atome[:type]}".to_sym, self, @atome[element], &user_proc)
110
+ run_optional_proc("pre_render_#{element}".to_sym, self, @atome[element], &user_proc)
111
+ rendering(element, @atome[element], &user_proc)
112
+ run_optional_proc("post_render_#{@atome[:type]}".to_sym, self, @atome[element], &user_proc)
113
+ run_optional_proc("post_render_#{element}".to_sym, self, @atome[element], &user_proc)
114
+ store_value(element)
99
115
  self
100
116
  end
101
117
 
118
+ def create_particle(element)
119
+ Atome.define_method "set_#{element}" do |params, &user_proc|
120
+ particle_creation(element, params, &user_proc)
121
+ end
122
+ end
123
+
102
124
  def get(element)
103
125
  @atome[element]
104
126
  end
@@ -109,7 +131,8 @@ class Atome
109
131
  virtual_atome.real_atome = @atome
110
132
  virtual_atome.property = element
111
133
  virtual_atome.user_proc = user_proc
112
- run_optional_proc("pre_get_#{element}".to_sym, virtual_atome, &user_proc)
134
+ run_optional_proc("pre_get_#{@atome[:type]}".to_sym, "virtual_atome", &user_proc)
135
+ run_optional_proc("pre_get_#{element}".to_sym, self, "virtual_atome", &user_proc)
113
136
  virtual_atome
114
137
  end
115
138
 
@@ -123,7 +146,9 @@ class Atome
123
146
  end
124
147
 
125
148
  def create_atome(new_atome)
126
- Atome.new(new_atome)
149
+ Atome.define_method "set_#{new_atome}" do |params, &user_proc|
150
+ Atome.new({ new_atome => params }, &user_proc)
151
+ end
127
152
  end
128
153
 
129
154
  Universe.connected
@@ -12,30 +12,9 @@ def circle(params = {}, &proc)
12
12
  grab(:view).circle(params, &proc)
13
13
  end
14
14
 
15
- def text(params = {}, &bloc)
16
- grab(:view).text(params, &bloc)
17
- end
18
-
19
- def image(params = {}, &bloc)
20
- grab(:view).image(params, &bloc)
21
- end
22
-
23
- def video(params = {}, &bloc)
24
- grab(:view).video(params, &bloc)
25
- end
26
-
27
- def color(params = {}, &bloc)
28
- grab(:view).color(params, &bloc)
29
- end
30
-
31
- def element(params = {}, &bloc)
32
- grab(:view).element(params, &bloc)
33
- end
34
-
35
- def shadow(params = {}, &bloc)
36
- grab(:view).shadow(params, &bloc)
37
- end
38
-
39
- def web(params = {}, &bloc)
40
- grab(:view).web(params, bloc)
15
+ # the method below generate Atome method creation at Object level
16
+ def create_method_at_object_level(element)
17
+ Object.define_method element do |params = nil, &user_proc|
18
+ grab(:view).send(element, params, &user_proc)
19
+ end
41
20
  end
@@ -11,4 +11,3 @@ class Atome
11
11
  results.first.coordinates
12
12
  end
13
13
  end
14
-
@@ -0,0 +1,171 @@
1
+ # frozen_string_literal: true
2
+
3
+ # powerful and simple to use table and list generator
4
+ class Matrix
5
+ attr_accessor :matrix
6
+
7
+ def create_matrix_back( id, style)
8
+ @matrix = Atome.new(
9
+ shape: { type: :shape, renderers: [:browser], id: id, parents: [:view], children: [:matrix_color],
10
+ overflow: :auto }
11
+ )
12
+ @matrix.style(style)
13
+ end
14
+
15
+ def create_matrix_colors
16
+ Atome.new({ color: { renderers: [:browser], id: :matrix_color, type: :color, parents: [], children: [],
17
+ red: 0, green: 1, blue: 1, alpha: 1 } })
18
+
19
+ Atome.new({ color: { renderers: [:browser], id: :cell_color, type: :color, parents: [], children: [],
20
+ red: 1, green: 0.15, blue: 0.7, alpha: 1 } })
21
+ end
22
+
23
+ def create_cells(id, cell_number, number_of_cells, style)
24
+ while cell_number < number_of_cells
25
+ @matrix_dataset[cell_number] = []
26
+ @cells << a = Atome.new(
27
+ shape: { type: :shape, renderers: [:browser], id: id + "_#{cell_number}", parents: [id],
28
+ children: [:cell_color] }
29
+ )
30
+ a.style(style)
31
+ cell_number += 1
32
+ end
33
+ end
34
+
35
+ def initialize(params)
36
+ default = { col: 4, row: 4, size: 333, margin: 12, name: :matrix, parent: :view }
37
+ params = default.merge(params)
38
+ nb_of_rows = params[:row]
39
+ nb_of_cols = params[:col]
40
+ matrix_width = params[:width]
41
+ matrix_height = params[:height]
42
+
43
+ @matrix_dataset = []
44
+ @matrix_margin = params[:margin]
45
+ params[:id] = :matrix unless params[:id]
46
+ @matrix_id = params[:id]
47
+ # styles
48
+ @matrix_style = params[:matrix_style]
49
+ @cell_style = params[:cell_style]
50
+ # Colors
51
+ create_matrix_colors
52
+ # now we create the background
53
+ create_matrix_back( @matrix_id, @matrix_style)
54
+
55
+ @nb_of_rows = nb_of_rows.to_i
56
+ @nb_of_cols = nb_of_cols.to_i
57
+ number_of_cells = @nb_of_rows * @nb_of_cols
58
+ @cells = []
59
+ cell_number = 0
60
+ create_cells(@matrix_id, cell_number, number_of_cells, @cell_style)
61
+
62
+ resize_matrix({ width: matrix_width, height: matrix_height })
63
+ end
64
+
65
+ def width(val = nil)
66
+ if val
67
+ resize_matrix({ height: height, width: val })
68
+ else
69
+ @matrix.width.value
70
+ end
71
+
72
+ end
73
+
74
+ def height(val = nil)
75
+ if val
76
+ resize_matrix({ width: width, height: val })
77
+ else
78
+ @matrix.height.value
79
+ end
80
+ end
81
+
82
+ def left(val)
83
+ @matrix.left(val)
84
+ end
85
+
86
+ def right(val)
87
+ @matrix.right(val)
88
+ end
89
+
90
+ def resize_matrix(params)
91
+ matrix_width = params[:width]
92
+ matrix_height = params[:height]
93
+ cell_width = (matrix_width / @nb_of_cols) - @matrix_margin
94
+ cell_height = (matrix_height / @nb_of_rows) - @matrix_margin
95
+ row = -1
96
+ @cells.each_with_index do |cell, index|
97
+ cell.height = cell_height
98
+ cell.width = cell_width
99
+ row += 1 if index.modulo(@nb_of_cols).zero?
100
+ cell.left(index % @nb_of_cols * (cell_width + @matrix_margin) + @matrix_margin)
101
+ cell.top(row * (cell_height + @matrix_margin) + @matrix_margin)
102
+ end
103
+
104
+ @matrix.width = matrix_width + @matrix_margin
105
+ @matrix.height = matrix_height + @matrix_margin
106
+ end
107
+
108
+ def get_cell(id)
109
+ grab("#{@matrix_id}_#{id}")
110
+ end
111
+
112
+ def delete(val = true)
113
+ @matrix.delete(true) if val
114
+ end
115
+
116
+ attr_reader :cells
117
+
118
+ def name
119
+ @matrix.name
120
+ end
121
+
122
+ def get_cell_data(codes, cell_nb)
123
+ codes.each do |proc|
124
+ if proc.is_a? Proc
125
+ assign(cell_nb, &proc)
126
+ end
127
+ end
128
+ end
129
+
130
+ def add(params)
131
+ nb_of_cols = @nb_of_cols + params[:columns].to_i
132
+ nb_of_rows = @nb_of_rows + params[:rows].to_i
133
+ current_id = @matrix.atome[:id]
134
+ # we delete all children to unbind any event
135
+ @cells.each do |cell|
136
+ cell.delete(true)
137
+ cell.unbind(:all)
138
+ end
139
+ temp_id = "#{current_id}_temporary"
140
+ @matrix.id = temp_id
141
+ old_matrix=grab(temp_id)
142
+
143
+ old_matrix.delete(true)
144
+
145
+
146
+ Matrix.new({ col: nb_of_cols, row: nb_of_rows, width: 300, height: 300, id: current_id, margin: @matrix_margin,
147
+ matrix_style: @matrix_style,
148
+ cell_style: @cell_style
149
+ })
150
+
151
+ @matrix_dataset.each_with_index do |cell_data, index|
152
+ get_cell_data(cell_data, index)
153
+ end
154
+ end
155
+
156
+ def assign(cell_nb = nil, &proc)
157
+ current_cell = grab("#{@matrix_id}_#{cell_nb}")
158
+ if proc
159
+ @matrix_dataset[cell_nb] << proc
160
+ current_cell.instance_exec(&proc) if proc.is_a? Proc
161
+ else
162
+ @matrix_dataset[cell_nb]
163
+ end
164
+ end
165
+
166
+ def reformat(params)
167
+ @nb_of_rows = params[:rows]
168
+ @nb_of_cols = params[:cols]
169
+ resize_matrix({ height: height, width: width })
170
+ end
171
+ end
@@ -1,17 +1,15 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # ping method
3
4
  class Atome
4
- def ping(address, my_proc: false)
5
- # if RUBY_ENGINE.downcase != 'opal'
6
- def up?(host, my_proc)
7
- check = Net::Ping::External.new(host)
8
- if check.ping?
9
- puts "ping respond!! "
10
- end
11
- end
5
+ def up?(host, _my_proc)
6
+ check = Net::Ping::External.new(host)
7
+ return unless check.ping?
8
+
9
+ puts 'ping respond!!'
10
+ end
12
11
 
13
- chost = address
14
- puts up?(chost, my_proc) # prints "true" if ping replies
15
- # end
12
+ def ping(address, my_proc: false)
13
+ puts up(address, my_proc) # prints "true" if ping replies
16
14
  end
17
15
  end
@@ -2,15 +2,18 @@
2
2
 
3
3
  generator = Genesis.generator
4
4
 
5
+ generator.build_atome(:animation)
5
6
  generator.build_atome(:color)
6
7
  generator.build_sanitizer(:color) do |params|
7
8
  parent_found = found_parents_and_renderers[:parent]
8
9
  render_found = found_parents_and_renderers[:renderers]
9
10
  default_params = { renderers: render_found, id: "color_#{Universe.atomes.length}", type: :color,
10
- parents: parent_found,
11
+ attach: parent_found,
11
12
  red: 0, green: 0, blue: 0, alpha: 1 }
12
13
  params = create_color_hash(params) unless params.instance_of? Hash
13
- default_params.merge!(params)
14
+ new_params = default_params.merge!(params)
15
+ atome[:color] = new_params
16
+ new_params
14
17
  end
15
18
 
16
19
  generator.build_sanitizer(:video) do |params|
@@ -21,6 +24,15 @@ generator.build_sanitizer(:video) do |params|
21
24
  default_params.merge!(params)
22
25
  end
23
26
  generator.build_atome(:shadow)
27
+
28
+ generator.build_sanitizer(:shadow) do |params|
29
+ parent_found = found_parents_and_renderers[:parent]
30
+ render_found = found_parents_and_renderers[:renderers]
31
+ default_params = { renderers: render_found, id: "shadow_#{Universe.atomes.length}", type: :shadow,
32
+ attach: parent_found,
33
+ red: 0, green: 0, blue: 0, alpha: 1 , blur: 3, left: 3, top: 3}
34
+ default_params.merge!(params)
35
+ end
24
36
  generator.build_atome(:shape)
25
37
  generator.build_atome(:text)
26
38
  generator.build_atome(:image)
@@ -1,3 +1,3 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- generator = Genesis.generator
3
+ # generator = Genesis.generator
@@ -2,20 +2,49 @@
2
2
 
3
3
  generator = Genesis.generator
4
4
 
5
+ # touch
5
6
  generator.build_particle(:touch)
6
- generator.build_particle(:play)
7
+ # video
8
+ generator.build_particle(:play) do
9
+ @atome[:pause] = :false
10
+ end
7
11
  generator.build_particle(:time)
8
- generator.build_particle(:pause)
12
+ generator.build_particle(:pause) do
13
+ @atome[:play] = :false
14
+ end
9
15
  generator.build_particle(:on)
10
16
  generator.build_particle(:fullscreen)
11
17
  generator.build_particle(:mute)
12
18
  # TODO : add the at event to ny particle : (width, left, ...) maybe use monitor particle
13
- generator.build_particle(:at)
19
+ # generator.build_particle(:at)
20
+ # drag
14
21
  generator.build_particle(:drag)
15
22
  generator.build_sanitizer(:drag) do |params|
16
23
  params = { move: true } if params == true
17
24
  params
18
25
  end
26
+ # sort
19
27
  generator.build_particle(:sort) do |_value, sort_proc|
20
28
  @sort_proc = sort_proc
21
29
  end
30
+
31
+ # animation
32
+ generator.build_particle(:targets)
33
+ generator.build_particle(:start)
34
+ generator.build_option(:pre_render_start) do |_value, user_proc|
35
+ @animation_start_proc = user_proc
36
+ end
37
+ generator.build_particle(:stop)
38
+ generator.build_option(:pre_render_stop) do |_value, user_proc|
39
+ @animation_stop_proc = user_proc
40
+ end
41
+ generator.build_particle(:begin)
42
+ generator.build_particle(:end)
43
+ generator.build_particle(:duration)
44
+ generator.build_particle(:mass)
45
+ generator.build_particle(:damping)
46
+ generator.build_particle(:stiffness)
47
+ generator.build_particle(:velocity)
48
+ generator.build_particle(:repeat)
49
+ generator.build_particle(:ease)
50
+ generator.build_particle(:unbind)
@@ -25,3 +25,35 @@ generator.build_option(:pre_render_parents) do |parents_id_found|
25
25
  parents_found.children << id if parents_found
26
26
  end
27
27
  end
28
+ generator.build_particle(:name)
29
+
30
+ generator.build_particle(:active)
31
+
32
+ generator.build_particle(:attach) do |parents|
33
+ parents.each do |parent|
34
+ grab(parent).atome[:attached] = [atome[:id]]
35
+ end
36
+ end
37
+
38
+ generator.build_particle(:attached) do |targets|
39
+ targets.each do |target|
40
+ grab(target).attach([atome[:id]])
41
+ end
42
+ end
43
+
44
+ generator.build_particle(:intricate, :array)
45
+
46
+
47
+ generator.build_particle(:clones) do |clones_found|
48
+ clones_found.each_with_index do |clone_found, index|
49
+ particles_intricated= clone_found[:intricate] ||= [:width]
50
+ clone_id="#{particles[:id]}_clone_#{index}"
51
+ original_id=atome[:id]
52
+ clone_found[:id] = clone_id
53
+ clone_found = particles.merge(clone_found)
54
+ cloned_atome=Atome.new({ clone: clone_found })
55
+ cloned_atome.monitor({ atomes: [original_id], particles: particles_intricated}) do |_atome, particle, value|
56
+ cloned_atome.send(particle,value)
57
+ end
58
+ end
59
+ end
@@ -6,5 +6,26 @@ generator.build_particle(:red)
6
6
  generator.build_particle(:green)
7
7
  generator.build_particle(:blue)
8
8
  generator.build_particle(:alpha)
9
+ generator.build_particle(:diffusion)
9
10
  generator.build_particle(:visual)
10
11
  generator.build_particle(:overflow)
12
+ generator.build_particle(:edit)
13
+ generator.build_particle(:style)
14
+ generator.build_option(:pre_render_style) do |styles_send, _user_proc|
15
+ styles_send.each do |particle_send, value|
16
+ send(particle_send, value)
17
+ end
18
+ end
19
+ generator.build_particle(:hide)
20
+
21
+ generator.build_particle(:remove) do |particle_to_remove|
22
+ case particle_to_remove
23
+ when :color
24
+ send(particle_to_remove, :black)
25
+ when :shadow
26
+ # TODO : code to write
27
+ puts 'code to write'
28
+ else
29
+ send(particle_to_remove, 0)
30
+ end
31
+ end
@@ -11,3 +11,4 @@ generator.build_particle(:top)
11
11
  generator.build_particle(:bottom)
12
12
  generator.build_particle(:rotate)
13
13
  generator.build_particle(:direction)
14
+ generator.build_particle(:center)
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ generator = Genesis.generator
4
+ # create particles
5
+ generator.build_particle(:markers, :hash)
@@ -11,8 +11,23 @@ end
11
11
  generator.build_particle(:broadcast)
12
12
  generator.build_particle(:additional)
13
13
  generator.build_particle(:data)
14
- generator.build_particle(:delete) do
15
- Universe.delete(@atome[:id])
14
+ generator.build_particle(:delete) do |params|
15
+ if params == true
16
+ # the machine delete the current atome
17
+ Universe.delete(@atome[:id])
18
+ elsif params[:id]
19
+ # the machine try to an atome by it's ID and delete it
20
+ grab(params[:id]).delete(true)
21
+ elsif instance_of? Hash
22
+ # the machine try to find the sub particle id and remove it eg a.delete(monitor: :my_monitor) remove the monitor
23
+ # with id my_monitor
24
+ params.each do |param, value|
25
+ atome[param][value] = nil
26
+ end
27
+ else
28
+ # the machine try to reset the current particle(params), eg a.delete(:left) => left: 0
29
+ send(params,0)
30
+ end
16
31
  end
17
32
  generator.build_particle(:clear)
18
33
  generator.build_particle(:path)
@@ -29,3 +44,6 @@ generator.build_particle(:read) do |file, proc|
29
44
  send("#{renderer}_reader", file, &proc)
30
45
  end
31
46
  end
47
+
48
+ generator.build_particle(:cursor)
49
+
@@ -11,9 +11,9 @@ end
11
11
 
12
12
  # Genesis method here
13
13
  class Atome
14
- def build_particle(particle_name, &particle_proc)
14
+ def build_particle(particle_name,type=:string, &particle_proc)
15
15
  # we add the new method to the particle's collection of methods
16
- Universe.add_to_particle_list(particle_name)
16
+ Universe.add_to_particle_list(particle_name, type)
17
17
  auto_render_generator(particle_name)
18
18
  new_particle(particle_name, &particle_proc)
19
19
  additional_particle_methods(particle_name, &particle_proc)
@@ -28,11 +28,11 @@ class Atome
28
28
 
29
29
  def auto_render_generator(element)
30
30
  Universe.renderer_list.each do |render_engine|
31
- build_render_method("#{render_engine}_#{element}")
31
+ build_render("#{render_engine}_#{element}")
32
32
  end
33
33
  end
34
34
 
35
- def build_render_method(renderer_name, &method_proc)
35
+ def build_render(renderer_name, &method_proc)
36
36
  new_render_engine(renderer_name, &method_proc)
37
37
  end
38
38