atome 0.5.3.8.1 → 0.5.3.8.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +3 -3
  3. data/lib/atome/atome.rb +49 -46
  4. data/lib/atome/extensions/atome.rb +2 -2
  5. data/lib/atome/extensions/matrix.rb +27 -16
  6. data/lib/atome/genesis/generators/atome.rb +128 -85
  7. data/lib/atome/genesis/generators/identity.rb +82 -51
  8. data/lib/atome/genesis/generators/spatial.rb +8 -8
  9. data/lib/atome/genesis/generators/utility.rb +26 -17
  10. data/lib/atome/genesis/genesis.rb +7 -4
  11. data/lib/atome/genesis/sparkle.rb +6 -6
  12. data/lib/atome/helpers/essentials.rb +21 -18
  13. data/lib/atome/helpers/sanitizer.rb +10 -10
  14. data/lib/atome/helpers/utilities.rb +81 -29
  15. data/lib/atome/kernel/batch.rb +0 -1
  16. data/lib/atome/kernel/universe.rb +1 -1
  17. data/lib/atome/presets/atome.rb +22 -23
  18. data/lib/atome/renderers/browser/atome.rb +2 -1
  19. data/lib/atome/renderers/browser/helpers/browser_helper.rb +17 -0
  20. data/lib/atome/renderers/browser/helpers/text_helper.rb +10 -2
  21. data/lib/atome/renderers/browser/identity.rb +23 -5
  22. data/lib/atome/renderers/browser/utility.rb +5 -4
  23. data/lib/atome/renderers/renderer.rb +1 -0
  24. data/lib/atome/version.rb +1 -1
  25. data/sig/atome.rbs +20 -0
  26. data/sig/essentials.rbs +11 -0
  27. data/vendor/assets/src/medias/images/icons/email.svg +12 -12
  28. data/vendor/assets/src/medias/rubies/examples/add.rb +2 -3
  29. data/vendor/assets/src/medias/rubies/examples/animation.rb +2 -2
  30. data/vendor/assets/src/medias/rubies/examples/atome_new.rb +18 -6
  31. data/vendor/assets/src/medias/rubies/examples/{parents.rb → attach.rb} +6 -6
  32. data/vendor/assets/src/medias/rubies/examples/attached.rb +4 -4
  33. data/vendor/assets/src/medias/rubies/examples/box.rb +1 -1
  34. data/vendor/assets/src/medias/rubies/examples/code.rb +1 -1
  35. data/vendor/assets/src/medias/rubies/examples/color.rb +20 -4
  36. data/vendor/assets/src/medias/rubies/examples/delete.rb +2 -2
  37. data/vendor/assets/src/medias/rubies/examples/drag.rb +1 -1
  38. data/vendor/assets/src/medias/rubies/examples/fullscreen.rb +1 -1
  39. data/vendor/assets/src/medias/rubies/examples/image.rb +2 -2
  40. data/vendor/assets/src/medias/rubies/examples/link.rb +7 -5
  41. data/vendor/assets/src/medias/rubies/examples/markers.rb +1 -1
  42. data/vendor/assets/src/medias/rubies/examples/materials.rb +15 -0
  43. data/vendor/assets/src/medias/rubies/examples/monitoring.rb +44 -18
  44. data/vendor/assets/src/medias/rubies/examples/read.rb +2 -2
  45. data/vendor/assets/src/medias/rubies/examples/shadow.rb +1 -1
  46. data/vendor/assets/src/medias/rubies/examples/table.rb +2 -2
  47. data/vendor/assets/src/medias/rubies/examples/text.rb +4 -4
  48. data/vendor/assets/src/medias/rubies/examples/time.rb +1 -1
  49. data/vendor/assets/src/medias/rubies/examples/web.rb +2 -2
  50. metadata +7 -5
  51. /data/vendor/assets/src/medias/rubies/examples/{matrix.rb → _matrix.rb} +0 -0
@@ -5,39 +5,38 @@
5
5
  # TODO: Factorise codes below
6
6
  # TODO we must clarified/unified the usage of presets and sanitizer it is not clear
7
7
 
8
-
9
8
  class Atome
10
- def atome_common(atome_type, generated_id, generated_render, generated_parents, generated_children, params)
11
- temp_default = Essentials.default_params[atome_type] || {}
12
- temp_default[:id] = generated_id
13
- temp_default[:parents] = generated_parents
14
- temp_default[:clones] = []
15
- temp_default[:renderers] = generated_render
16
- temp_default[:children] = generated_children.concat(temp_default[:children])
17
- temp_default.merge(params)
9
+ def atome_common(atome_type, params)
10
+
11
+
12
+ # TODO : optimise the whole code below and make it rubocop friendly
13
+ essential_params = Essentials.default_params[atome_type] || {}
14
+ # puts "==== > #{essential_params.merge(params)}"
15
+ essential_params[:type] = essential_params[:type] || :element
16
+ essential_params[:renderers] = essential_params[:renderers] || @atome[:renderers]
17
+ essential_params[:id] = params[:id] || identity_generator(atome_type)
18
+ essential_params[:attach] = params[:attach] || [@atome[:id]] || [:view]
19
+ # puts "==== > #{essential_params.merge(params)}"
20
+ essential_params.merge(params)
18
21
  end
19
22
 
20
23
  def box(params = {}, &bloc)
21
- default_renderer = Essentials.default_params[:render_engines]
24
+ # default_renderer = Essentials.default_params[:render_engines]
22
25
  atome_type = :box
23
- generated_render = params[:renderers] || default_renderer
24
- generated_id = params[:id] || identity_generator(:box)
25
- generated_parents = params[:parents] || [id.value]
26
- generated_children = params[:children] || []
27
-
28
- params = atome_common(atome_type, generated_id, generated_render, generated_parents, generated_children, params)
29
-
26
+ # generated_render = params[:renderers] || default_renderer
27
+ # generated_id = params[:id] || identity_generator(:box)
28
+ # generated_parents = params[:attach] || [id.value]
29
+ params = atome_common(atome_type, params)
30
30
  Atome.new({ atome_type => params }, &bloc)
31
31
  end
32
32
 
33
33
  def circle(params = {}, &bloc)
34
- default_renderer = Essentials.default_params[:render_engines]
34
+ # default_renderer = Essentials.default_params[:render_engines]
35
35
  atome_type = :circle
36
- generated_render = params[:renderers] || default_renderer
37
- generated_id = params[:id] || identity_generator(:circle)
38
- generated_parents = params[:parents] || [id.value]
39
- generated_children = params[:children] || []
40
- params = atome_common(atome_type, generated_id, generated_render, generated_parents, generated_children, params)
36
+ # generated_render = params[:renderers] || default_renderer
37
+ # generated_id = params[:id] || identity_generator(:circle)
38
+ # generated_parents = params[:attach] || [id.value]
39
+ params = atome_common(atome_type, params)
41
40
  Atome.new({ atome_type => params }, &bloc)
42
41
  end
43
42
 
@@ -19,6 +19,7 @@ end
19
19
 
20
20
  generator.build_render(:browser_color) do |_value|
21
21
  @browser_type = :style
22
+ # puts "1 - for the id : #{id} the browserrtype is ::::> #{@browser_type}"
22
23
  id_found = @atome[:id]
23
24
  type_found = @atome[:type]
24
25
  # we remove previous unused style tag
@@ -30,7 +31,7 @@ generator.build_render(:browser_color) do |_value|
30
31
  BrowserHelper.browser_document.head << Browser.DOM("<style atome='#{type_found}'
31
32
  id='#{id_found}'>.#{id_found}{background-color: rgba(#{red_found * 255},
32
33
  #{green_found * 255},#{blue_found * 255},#{alpha_found})}</style>")
33
- # TODO/ use the code below to modify the style tag
34
+ # # TODO/ use the code below to modify the style tag
34
35
  @browser_object = BrowserHelper.browser_document[id_found]
35
36
  end
36
37
 
@@ -7,6 +7,10 @@ module BrowserHelper
7
7
  Browser.window
8
8
  end
9
9
 
10
+ def self.browser_attach_(_parents, _html_object, _atome)
11
+ # dummy methods to catch atomes that do not need to be attached to any particular visual atime
12
+ end
13
+
10
14
  def self.browser_attach_div(parents, html_object, _atome)
11
15
  html_object.append_to(browser_document[parents])
12
16
  end
@@ -15,6 +19,19 @@ module BrowserHelper
15
19
  browser_document[parents].add_class(atome[:id])
16
20
  end
17
21
 
22
+ def self.browser_attached_div(children, _html_object, atome)
23
+ children.each do |child_found|
24
+ # atome_child.browser_attach_div
25
+ html_child=grab(child_found).browser_object
26
+ html_child.append_to(browser_document[atome[:id]])
27
+ end
28
+ end
29
+
30
+ def self.browser_attached_style(children, _html_object, atome)
31
+
32
+ browser_document[atome[:id]].add_class(children)
33
+ end
34
+
18
35
  def self.value_parse(value)
19
36
  if value.instance_of?(String)
20
37
  value
@@ -2,7 +2,7 @@
2
2
 
3
3
  # for browser rendering
4
4
  module BrowserHelper
5
- # text
5
+
6
6
  def self.browser_left_text(value, browser_object, _atome)
7
7
  browser_object.style[:left] = BrowserHelper.value_parse(value)
8
8
  end
@@ -20,7 +20,15 @@ module BrowserHelper
20
20
  end
21
21
 
22
22
  def self.browser_data_text(value,atome_send)
23
- atome_send.browser_object.text = value
23
+ value = value.gsub(/\n/, '<br/>')
24
+ atome_send.browser_object.inner_html = value
25
+ end
26
+
27
+ def self.browser_data_shape(_value,_atome_send)
28
+
29
+ end
30
+ def self.browser_data_scolor(_value,_atome_send)
31
+
24
32
  end
25
33
 
26
34
  end
@@ -15,17 +15,35 @@ generator.build_render(:browser_type) do |params|
15
15
  send("browser_#{params}", user_proc)
16
16
  end
17
17
 
18
- generator.build_render(:browser_family) do |parents_found|
19
- BrowserHelper.send("browser_attach_#{@browser_type}", parents_found, @browser_object, @atome)
20
- end
18
+ # generator.build_render(:browser_family) do |parents_found|
19
+ # BrowserHelper.send("browser_attach_#{@browser_type}", parents_found, @browser_object, @atome)
20
+ # end
21
21
 
22
22
  generator.build_render(:browser_attach) do |parents_found|
23
+ # puts "parents_found : #{parents_found}, #{parents_found.class}"
23
24
  parents_found.each do |parent_found|
25
+ # puts "2 : >>>>> model: browser_type #{@browser_type} parents_found #{parents_found} , @browser_object, #{@browser_object}, self : #{self.id}"
24
26
  BrowserHelper.send("browser_attach_#{@browser_type}", parent_found, @browser_object, @atome)
25
27
  end
26
28
  end
27
29
 
28
- generator.build_render(:browser_detached) do |value, _user_proc|
29
- @browser_object.remove_class(value)
30
+ generator.build_render(:browser_attached) do |children_found|
31
+ children_found.each do |child_found|
32
+ # puts ">>>>> modeled: browser_type #{@browser_type} parents_found #{children_found} , @browser_object, #{@browser_object}, self : #{self.id}"
33
+ children_browser_type = grab(child_found).instance_variable_get('@browser_type')
34
+ BrowserHelper.send("browser_attached_#{children_browser_type}", children_found, @browser_object, @atome)
35
+ end
36
+ end
37
+
38
+ generator.build_render(:browser_detached) do |values, _user_proc|
39
+ values.each do |value|
40
+ # FIXME: ugly patch to check if the value passed is an atome must create a more robust global solution for .value
41
+ value = value.value if value.instance_of? Atome
42
+ if grab(value).instance_variable_get('@browser_type') == :style
43
+ @browser_object.remove_class(value)
44
+ else
45
+ BrowserHelper.browser_document[value]&.remove
46
+ end
47
+ end
30
48
  end
31
49
 
@@ -8,10 +8,11 @@ generator.build_render(:browser_delete) do |params|
8
8
  end
9
9
 
10
10
  generator.build_render(:browser_clear) do
11
- @atome[:children].each do |child_found|
12
- grab(child_found).browser_object&.remove
13
- end
14
- children([])
11
+ alert "rewrite code below"
12
+ # @atome[:children].each do |child_found|
13
+ # grab(child_found).browser_object&.remove
14
+ # end
15
+ # children([])
15
16
  end
16
17
 
17
18
  generator.build_render(:browser_path) do |value|
@@ -8,6 +8,7 @@ class Atome
8
8
  # params=instance_variable_get("@#{element}")
9
9
  render_engines = @atome[:renderers]
10
10
  render_engines.each do |render_engine|
11
+ # puts "rendering : send('#{render_engine}_#{element}', #{params}, &user_proc)"
11
12
  send("#{render_engine}_#{element}", params, &user_proc)
12
13
  end
13
14
  end
data/lib/atome/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class Atome
4
- VERSION = '0.5.3.8.1'
4
+ VERSION = '0.5.3.8.8'
5
5
  end
data/sig/atome.rbs CHANGED
@@ -9,8 +9,12 @@ module Atome
9
9
 
10
10
  def apply_style: -> untyped
11
11
 
12
+ def atome_common: -> untyped
13
+
12
14
  def auto_render_generator: -> untyped
13
15
 
16
+ def box: -> untyped
17
+
14
18
  def build_atome: -> Atome
15
19
 
16
20
  def build_option: -> untyped
@@ -21,6 +25,12 @@ module Atome
21
25
 
22
26
  def build_sanitizer: -> untyped
23
27
 
28
+ def circle: -> untyped
29
+
30
+ def detach_atome: -> untyped
31
+
32
+ def each_with_index: -> untyped
33
+
24
34
  def format_matrix: -> untyped
25
35
 
26
36
  def get_column: -> untyped
@@ -34,4 +44,14 @@ module Atome
34
44
  def set: -> untyped
35
45
 
36
46
  def sort_callback: -> untyped
47
+
48
+ def visuals: -> untyped
49
+
50
+ private
51
+
52
+ def atome_parsing: -> untyped
53
+
54
+ def found_parents_and_renderers: -> untyped
55
+
56
+ def new_render_engine: -> untyped
37
57
  end
@@ -0,0 +1,11 @@
1
+ module Essentials
2
+ @default_params: untyped
3
+
4
+ def self.default_params: -> untyped
5
+
6
+ def self.new_default_params: -> untyped
7
+
8
+ def add_essential_drm: -> untyped
9
+
10
+ def validation: -> untyped
11
+ end
@@ -1,13 +1,13 @@
1
- <?xml version="1.0" encoding="iso-8859-1"?>
2
- <!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
3
- <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
4
- <svg fill="#000000" height="800px" width="800px" version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
5
- viewBox="0 0 493.497 493.497" xml:space="preserve">
6
- <path d="M444.556,85.218H48.942C21.954,85.218,0,107.171,0,134.16v225.177c0,26.988,21.954,48.942,48.942,48.942h395.613
7
- c26.988,0,48.941-21.954,48.941-48.942V134.16C493.497,107.171,471.544,85.218,444.556,85.218z M460.87,134.16v225.177
8
- c0,2.574-0.725,4.924-1.793,7.09L343.74,251.081l117.097-117.097C460.837,134.049,460.87,134.096,460.87,134.16z M32.628,359.336
9
- V134.16c0-0.064,0.033-0.11,0.033-0.175l117.097,117.097L34.413,366.426C33.353,364.26,32.628,361.911,32.628,359.336z
10
- M251.784,296.902c-2.692,2.691-7.378,2.691-10.07,0L62.667,117.846h368.172L251.784,296.902z M172.827,274.152l45.818,45.819
11
- c7.512,7.511,17.493,11.645,28.104,11.645c10.61,0,20.592-4.134,28.104-11.645l45.82-45.819l101.49,101.499H71.327L172.827,274.152z
12
- "/>
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
3
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
4
+ <svg fill="#000000" height="800px" width="800px" version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
5
+ viewBox="0 0 493.497 493.497" xml:space="preserve">
6
+ <path d="M444.556,85.218H48.942C21.954,85.218,0,107.171,0,134.16v225.177c0,26.988,21.954,48.942,48.942,48.942h395.613
7
+ c26.988,0,48.941-21.954,48.941-48.942V134.16C493.497,107.171,471.544,85.218,444.556,85.218z M460.87,134.16v225.177
8
+ c0,2.574-0.725,4.924-1.793,7.09L343.74,251.081l117.097-117.097C460.837,134.049,460.87,134.096,460.87,134.16z M32.628,359.336
9
+ V134.16c0-0.064,0.033-0.11,0.033-0.175l117.097,117.097L34.413,366.426C33.353,364.26,32.628,361.911,32.628,359.336z
10
+ M251.784,296.902c-2.692,2.691-7.378,2.691-10.07,0L62.667,117.846h368.172L251.784,296.902z M172.827,274.152l45.818,45.819
11
+ c7.512,7.511,17.493,11.645,28.104,11.645c10.61,0,20.592-4.134,28.104-11.645l45.82-45.819l101.49,101.499H71.327L172.827,274.152z
12
+ "/>
13
13
  </svg>
@@ -2,7 +2,7 @@
2
2
 
3
3
  my_video = Atome.new(
4
4
  video: { renderers: [:browser], id: :video1, type: :video, parents: [:view],
5
- path: './medias/videos/avengers.mp4', left: 333, top: 33, width: 777
5
+ path: './medias/videos/avengers.mp4', left: 33, top: 33, width: 777
6
6
  }
7
7
  )
8
8
 
@@ -17,9 +17,8 @@ end
17
17
 
18
18
  jumper=lambda do
19
19
  my_video.play(12)
20
- my_video.play(12)
21
20
  end
22
21
 
23
22
  my_video.markers({ markers: { begin: 6, code: jumper } })
24
23
 
25
- my_video.add({ markers: { my_stop: { begin: 16, code: stoper } } })
24
+ my_video.add({ markers: { my_stop: { begin: 16, code: stoper } }, left: 33 })
@@ -5,12 +5,12 @@ bb.color(:orange)
5
5
  box({ id: :my_box, drag: true })
6
6
  c = circle({ id: :the_circle, left: 222, drag: { move: true, inertia: true, lock: :start } })
7
7
  c.shadow({ renderers: [:browser], id: :shadow2, type: :shadow,
8
- parents: [:the_circle], children: [],
8
+ parents: [:the_circle],
9
9
  left: 3, top: 9, blur: 19,
10
10
  red: 0, green: 0, blue: 0, alpha: 1
11
11
  })
12
12
 
13
- Atome.new(animation: { renderers: [:browser], id: :the_animation1, type: :animation, children: [] })
13
+ Atome.new(animation: { renderers: [:browser], id: :the_animation1, type: :animation })
14
14
  aa = animation({
15
15
  targets: %i[my_box the_circle],
16
16
  begin: {
@@ -1,15 +1,27 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  Atome.new(
4
- shape: { type: :shape, renderers: [:browser], id: :the_shape, parents: [:view], children: [], clones: [],
4
+ shape: { type: :shape, renderers: [:browser], id: :the_shape, attach: [:view], clones: [],
5
5
  left: 99, right: 99, width: 399, height: 99,
6
- color: { renderers: [:browser], id: :c315, type: :color, parents: [:the_shape], children: [],
7
- red: 0.3, green: 1, blue: 0.6, alpha: 1 } }
6
+ # color: { renderers: [:browser], id: :c315, type: :color, attach: [:the_shape],
7
+ # red: 0.3, green: 1, blue: 0.6, alpha: 1 }
8
+ }
8
9
  )
9
10
 
10
11
  Atome.new(
11
- shape: { renderers: [:browser], id: :the_shape2, type: :shape, parents: [:view], children: [], clones: [],
12
+ shape: { type: :color, renderers: [:browser], id: :c315, type: :color, attach: [:the_shape],
13
+ red: 0.3, green: 1, blue: 0.6, alpha: 1 }
14
+
15
+ )
16
+
17
+ Atome.new(
18
+ shape: { renderers: [:browser], id: :the_shape2, type: :shape, attach: [:view], clones: [],
12
19
  left: 99, right: 99, width: 99, height: 99,
13
- color: { renderers: [:browser], id: :c31, type: :color, parents: [:the_shape2], children: [],
14
- red: 1, green: 0.15, blue: 0.15, alpha: 0.6 } }
20
+
21
+ }
15
22
  )
23
+
24
+ Atome.new(
25
+ shape: { renderers: [:browser], id: :c31, type: :color, attach: [:the_shape2],
26
+ red: 1, green: 0.15, blue: 0.15, alpha: 0.6 }
27
+ )
@@ -3,13 +3,13 @@
3
3
  b=box({id: :c315})
4
4
  circle({id: :circle_12, top: 0,drag: true})
5
5
 
6
- b.parents([:circle_12])
6
+ b.attach([:circle_12])
7
7
 
8
8
  circle({ id: :circle_123, color: :cyan, left: 233, drag: true })
9
9
  box({ id: :box_1, left: 333 })
10
10
  bb=box({top: 99})
11
- grab(:box_1).parents([:circle_123])
12
- grab(:color_circle_123).parents([:box_1])
13
- #
14
- bb.parents([:box_1])
15
- grab(:c315).parents([:circle_12])
11
+ grab(:box_1).attach([:circle_123])
12
+ circle_123_color= grab(:circle_123).color[0]
13
+ grab(circle_123_color).attach([:box_1])
14
+ bb.attach([:box_1])
15
+ grab(:c315).attach([:circle_12])
@@ -1,16 +1,16 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- color({ red: 0.8, green: 0.8, blue: 0.8, id: :active_color })
3
+ color({ red: 1, green: 0.6, blue: 0.6, id: :active_color })
4
4
  color( { red: 0.3, green: 0.3, blue: 0.3, id: :inactive_color } )
5
5
 
6
- b=box
6
+ b=box({left: 99})
7
7
  wait 1 do
8
- b.attached([:inactive_color])
8
+ b.attached([:active_color])
9
9
 
10
10
  puts b.attached
11
11
  end
12
12
  puts b.attached
13
- c=circle
13
+ c=circle({left: 333})
14
14
  c.attached(:inactive_color)
15
15
 
16
16
 
@@ -8,7 +8,7 @@ a = box({ id: :my_box, left: 333 }) do |p|
8
8
  end
9
9
 
10
10
  b = Atome.new(
11
- { shape: { renderers: [:browser], id: :view_test, type: :shape, parents: [:view],children: [],
11
+ { shape: { renderers: [:browser], id: :view_test, type: :shape, parents: [:view],
12
12
  left: 0, width: 90, top: 0, height: 90, overflow: :auto,
13
13
  color: { renderers: [:browser], id: :view_test_color, type: :color, parents: [:view_test],
14
14
  red: 1, green: 0.15, blue: 0.15, alpha: 1 } } }
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- a=Atome.new(code: { type: :code, renderers: [:headless], parents: [], children: [] }) do |params_found|
3
+ a=Atome.new(code: { type: :code, renderers: [:headless], parents: [] }) do |params_found|
4
4
  puts "the param is #{params_found}"
5
5
  end
6
6
  a.run(:super)
@@ -11,47 +11,63 @@ wait 1 do
11
11
  { renderers: [:browser], id: :c319, type: :color,
12
12
  red: 1, green: 1, blue: 0.15, alpha: 0.6 }
13
13
  )
14
+ puts c
14
15
  end
15
16
 
16
17
  wait 2 do
17
18
  # now we overload the color
18
19
  c.color({ red: 1 })
20
+ puts c
21
+
19
22
  end
20
23
 
21
24
  wait 4 do
22
25
  # now the easy way
23
26
  c.color(:yellow)
27
+ puts c
28
+
24
29
  wait 1 do
25
30
  c.color({ green: 1, blue: 0.69, alpha: 1 })
31
+ puts c
32
+
26
33
  end
27
34
  end
28
35
 
29
36
  wait 5 do
30
37
  d=c.color(:red)
38
+ puts c
39
+
31
40
  wait 1 do
32
41
  d.blue(0)
42
+ puts c
43
+
33
44
  end
34
45
 
35
46
  wait 2 do
36
47
  d.red(1)
48
+ puts c
49
+
37
50
  end
38
51
  end
39
52
 
40
53
 
41
54
  wait 10 do
42
- Atome.new({ color: { renderers: [:browser], id: :col1, type: :color, parents: [], children: [],
55
+ d=Atome.new({ color: { renderers: [:browser], id: :col1, type: :color, parents: [],
43
56
  left: 33, top: 66, red: 1, green: 0.15, blue: 0.7, alpha: 1 } })
44
57
 
45
- col_2 = Atome.new({ color: { renderers: [:browser], id: :col2, type: :color, parents: [], children: [],
58
+ col_2 = Atome.new({ color: { renderers: [:browser], id: :col2, type: :color, parents: [],
46
59
  left: 33, top: 66, red: 0, green: 0.15, blue: 0.7, alpha: 1 } })
47
60
 
48
- Atome.new(
49
- shape: { type: :shape, renderers: [:browser], id: :shaped, parents: [:view], children: [], attached: [:col1],
61
+ puts d
62
+ e=Atome.new(
63
+ shape: { type: :shape, renderers: [:browser], id: :shaped, parents: [:view], attached: [:col1],
50
64
  left: 199, top: 99,
51
65
  width: 66, height: 66
52
66
  }
53
67
  )
68
+ puts e
54
69
  wait 2 do
55
70
  col_2.attach([:shaped])
71
+ puts e
56
72
  end
57
73
  end
@@ -9,9 +9,9 @@ wait 4 do
9
9
  end
10
10
 
11
11
  wait 3 do
12
- b.children.each do |attached_atome_id|
12
+ b.shape.each do |attached_atome_id|
13
13
  b.delete({id: attached_atome_id})
14
- b.shadow({ renderers: [:browser], id: :shadow2, type: :shadow, parents: [], children: [],
14
+ b.shadow({ renderers: [:browser], id: :shadow2, type: :shadow, parents: [],
15
15
  left: 3, top: 9, blur: 3, direction: '',
16
16
  red: 0, green: 0, blue: 0, alpha: 1
17
17
  })
@@ -42,6 +42,6 @@ b.drag({ snap: { x: 100, y: 190 } })
42
42
  cc=circle(drag: true)
43
43
  bb=box({drag: true, color: :yellow})
44
44
 
45
- bb.parents(cc.id)
45
+ bb.attach(cc.id)
46
46
 
47
47
  # alert"#{b.parents.class} : #{b.parents}"
@@ -2,7 +2,7 @@
2
2
 
3
3
  my_video = Atome.new(
4
4
  video: { renderers: [:browser], id: :video1, type: :video, parents: [:view],
5
- path: './medias/videos/avengers.mp4', left: 333, top: 33, width: 777
5
+ path: './medias/videos/avengers.mp4', left: 33, top: 33, width: 777
6
6
  }
7
7
  ) do |params|
8
8
  puts "video callback here #{params}"
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  Atome.new(
4
- image: { renderers: [:browser], id: :image1, type: :image, parents: [:view], path: "./medias/images/boat.png", left: 99, top: 120, width: 199, height: 199,
4
+ image: { renderers: [:browser], id: :image1, type: :image, attach: [:view], path: "./medias/images/red_planet.png", left: 99, top: 120, width: 199, height: 199,
5
5
  }
6
6
  )
7
7
 
8
- image({path: "./medias/images/moto.png", left: 33, top: 33})
8
+ image({path: "./medias/images/green_planet.png", left: 33, top: 33})
@@ -1,19 +1,21 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  text = Atome.new(
4
- text: { renderers: [:browser], id: :my_text, type: :text, parents: [:view], children: [], visual: { size: 18 },
4
+ text: { renderers: [:browser], id: :my_text, type: :text, attach: [:view], visual: { size: 18 },
5
5
  data: 'My first text!', left: 300, top: 33, width: 199, height: 33,
6
- color: { renderers: [:browser], id: :c31, type: :color, parents: [:my_text], children: [],
7
- red: 0.6, green: 0.6, blue: 0.6, alpha: 1 }
6
+
8
7
  }
9
8
  )
9
+ color({ renderers: [:browser], id: :c31, type: :color, attach: [:my_text],
10
+ red: 0.6, green: 0.6, blue: 0.6, alpha: 1 })
11
+
10
12
 
11
- Atome.new({ color: { renderers: [:browser], id: :new_col, type: :color, parents: [], children: [],
13
+ Atome.new({ color: { renderers: [:browser], id: :new_col, type: :color, attach: [],
12
14
  left: 33, top: 66, red: 0, green: 0.15, blue: 0.7, alpha: 0.6 } })
13
15
 
14
16
  # now we change the color all the object that share the care modified
15
17
  wait 1 do
16
- text.link(:new_col)
18
+ text.attached(:new_col)
17
19
  end
18
20
  wait 2 do
19
21
  grab(:new_col).red(1)
@@ -2,7 +2,7 @@
2
2
 
3
3
  my_video = Atome.new(
4
4
  video: { renderers: [:browser], id: :video1, type: :video, parents: [:view], clones: [],
5
- path: './medias/videos/avengers.mp4', left: 333, top: 33, width: 777
5
+ path: './medias/videos/avengers.mp4', left: 33, top: 33, width: 777
6
6
  }
7
7
  )
8
8
 
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ # the materials method is used to retrieve or delete all children with a visual rendering
4
+ # but leave alone other atome such as color
5
+ b = box
6
+ cc2 = color(:yellow)
7
+ b.color(:red)
8
+ c = b.circle
9
+ c.attached(cc2.id)
10
+ b.text(:hello)
11
+ b.add(text: { data: :ok, left: 133 })
12
+ wait 2 do
13
+ b.delete(:materials)
14
+ puts "b is : #{b}"
15
+ end