atome 0.5.2.8 → 0.5.3.2
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/Rakefile +7 -1
- data/app_builder_helpers/Rakefile +2 -2
- data/exe/atome +1 -1
- data/lib/atome/atome.rb +28 -26
- data/lib/atome/extensions/atome.rb +4 -0
- data/lib/atome/extensions/matrix.rb +349 -122
- data/lib/atome/genesis/generators/atome.rb +5 -1
- data/lib/atome/genesis/generators/identity.rb +43 -13
- data/lib/atome/genesis/generators/material.rb +20 -5
- data/lib/atome/genesis/generators/time.rb +1 -1
- data/lib/atome/genesis/generators/utility.rb +26 -2
- data/lib/atome/genesis/genesis.rb +12 -4
- data/lib/atome/genesis/sparkle.rb +35 -3
- data/lib/atome/helpers/essentials.rb +24 -15
- data/lib/atome/helpers/utilities.rb +42 -3
- data/lib/atome/kernel/batch.rb +48 -0
- data/lib/atome/presets/atome.rb +22 -6
- data/lib/atome/renderers/browser/atome.rb +1 -3
- data/lib/atome/renderers/browser/browser.rb +14 -1
- data/lib/atome/renderers/browser/geometry.rb +10 -2
- data/lib/atome/renderers/browser/helpers/video_helper.rb +1 -1
- data/lib/atome/renderers/browser/helpers/web_helper.rb +1 -5
- data/lib/atome/renderers/browser/identity.rb +7 -11
- data/lib/atome/renderers/browser/material.rb +10 -0
- data/lib/atome/renderers/html/atome.rb +2 -0
- data/lib/atome/renderers/renderer.rb +3 -2
- data/lib/atome/version.rb +1 -1
- data/lib/atome.rb +2 -1
- data/sig/atome.rbs +14 -0
- data/vendor/assets/Rakefile +1 -1
- data/vendor/assets/src/css/style.css +6 -6
- data/vendor/assets/src/medias/rubies/examples/_2_solve.rb +41 -27
- data/vendor/assets/src/medias/rubies/examples/_attach.rb +12 -0
- data/vendor/assets/src/medias/rubies/examples/_audio.rb +81 -28
- data/vendor/assets/src/medias/rubies/examples/_dataset.rb +191 -111
- data/vendor/assets/src/medias/rubies/examples/clone.rb +4 -4
- data/vendor/assets/src/medias/rubies/examples/delete.rb +2 -2
- data/vendor/assets/src/medias/rubies/examples/drag.rb +2 -1
- data/vendor/assets/src/medias/rubies/examples/table.rb +479 -0
- data/vendor/assets/src/medias/rubies/examples/to_px.rb +10 -0
- metadata +7 -4
- data/vendor/assets/src/medias/rubies/examples/attach.rb +0 -12
@@ -12,47 +12,61 @@ end
|
|
12
12
|
|
13
13
|
c.run('it works')
|
14
14
|
|
15
|
-
|
15
|
+
###### SOLVED ##### : object in object
|
16
16
|
|
17
|
-
a = box({ width: 333, height: 333, id: :the_boxy })
|
18
|
-
a.color(:red)
|
19
|
-
b = a.box({ width: 33, height: 33, id: :the_box, drag: true })
|
20
|
-
b.color(:black)
|
17
|
+
# a = box({ width: 333, height: 333, id: :the_boxy })
|
18
|
+
# a.color(:red)
|
19
|
+
# b = a.box({ width: 33, height: 33, id: :the_box, drag: true })
|
20
|
+
# b.color(:black)
|
21
|
+
#
|
22
|
+
# # color doesn't work
|
23
|
+
# circle({ id: :circle_123, color: :cyan, left: 233 })
|
21
24
|
|
22
|
-
# color doesn't work
|
23
|
-
circle({ id: :circle_123, color: :cyan, left: 233 })
|
24
25
|
|
26
|
+
###### SOLVED ##### : big performance problem plus params as left is not interpreted
|
25
27
|
|
26
|
-
#
|
28
|
+
# i = 0
|
29
|
+
# while i < 16
|
30
|
+
# b = box({ width: 33, height: 33 })
|
31
|
+
# b.color(:red)
|
32
|
+
# b.left((33 + 10) * i)
|
33
|
+
# i += 1
|
34
|
+
# # b.drag(true)
|
35
|
+
# end
|
27
36
|
|
28
|
-
i = 0
|
29
|
-
while i < 16
|
30
|
-
b = box({ width: 33, height: 33 })
|
31
|
-
b.parents([:the_grid])
|
32
|
-
b.color(:red)
|
33
|
-
b.left((33 + 10) * i)
|
34
|
-
i += 1
|
35
|
-
# b.drag(true)
|
36
|
-
end
|
37
37
|
|
38
|
+
###### SOLVED ##### : .color (return the color itself instead of the box ) and .red return itself too so it's impossible to set green and blue
|
39
|
+
# another problem : when setting .red it reset the whole color object and remove green an blue components
|
40
|
+
# box({id: :mybox})
|
41
|
+
# grab(:my_box).smooth(6).color(:black).red(0.6).green(0.6).blue(0.6)
|
38
42
|
|
39
|
-
# .color (return the color itself instead of the box ) and .red retrun itself too so it's impossible to set green and blue
|
40
|
-
# another problem : when steeing .red it reset the whole color object and remove green an blue components
|
41
|
-
box({id: :mybox})
|
42
|
-
grab(:my_box).smooth(6).color(:black).red(0.6).green(0.6).blue(0.6)
|
43
43
|
|
44
44
|
# color can't be changed easily
|
45
45
|
|
46
46
|
b=box
|
47
47
|
b.color.red(1)
|
48
48
|
|
49
|
-
# box in box doesn't work( incorrect node tree error)
|
50
|
-
b=box({id: :mybox, width: 666, height: 555})
|
49
|
+
# ###### SOLVED ##### : box in box doesn't work( incorrect node tree error)
|
50
|
+
# b=box({id: :mybox, width: 666, height: 555})
|
51
|
+
#
|
52
|
+
# b.box()
|
53
|
+
|
54
|
+
# ###### SOLVED ##### atome i, atome using preset doesn't work
|
55
|
+
#
|
56
|
+
# b=box
|
57
|
+
# c=b.box
|
58
|
+
# c.left(200)
|
59
|
+
|
60
|
+
|
61
|
+
# Children doesn't work
|
62
|
+
box({ id: :the_box })
|
63
|
+
circle({ top: 300, id: :circle098 })
|
51
64
|
|
52
|
-
|
65
|
+
t = text({ data: :hello })
|
66
|
+
t.children[:the_box, :circle098]
|
53
67
|
|
54
|
-
# atome i, atome using preset doesn't work
|
55
68
|
|
69
|
+
# if id change then we can't add color
|
56
70
|
b=box
|
57
|
-
|
58
|
-
|
71
|
+
b.id(:new_id)
|
72
|
+
b.color(:blue)
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
|
4
|
+
# removed because it has conflict with children / parents
|
5
|
+
# # TODO : debug the attach method it color the view by default
|
6
|
+
# # box({id: :my_box})
|
7
|
+
# # c=color(:red)
|
8
|
+
# # grab(:view).color(:black)
|
9
|
+
# # c.attach([:my_box])
|
10
|
+
#
|
11
|
+
# box({id: :my_box})
|
12
|
+
# color({red: 1, blue: 1, attach: [:my_box]})
|
@@ -1,6 +1,61 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
generator = Genesis.generator
|
4
|
+
|
5
|
+
generator.build_atome(:audio) do |p|
|
6
|
+
puts p
|
7
|
+
|
8
|
+
end
|
9
|
+
|
10
|
+
generator.build_render(:browser_audio) do |_value, _user_proc|
|
11
|
+
@browser_type = :div
|
12
|
+
id_found = @atome[:id]
|
13
|
+
DOM do
|
14
|
+
audio({ id: id_found, autoplay: false, loop: false, muted: false }).atome
|
15
|
+
end.append_to(BrowserHelper.browser_document[:user_view])
|
16
|
+
@browser_object = BrowserHelper.browser_document[id_found]
|
17
|
+
|
18
|
+
|
19
|
+
# `
|
20
|
+
# var helloWorld = new Wad({
|
21
|
+
# source: './medias/audios/Binrpilot.mp3',
|
22
|
+
#
|
23
|
+
# // add a key for each sprite
|
24
|
+
# sprite: {
|
25
|
+
# hello : [0, .4], // the start and end time, in seconds
|
26
|
+
# world : [.4,1]
|
27
|
+
# }
|
28
|
+
# });
|
29
|
+
# `
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
end
|
34
|
+
|
35
|
+
generator.build_sanitizer(:audio) do |params|
|
36
|
+
parent_found = found_parents_and_renderers[:parent]
|
37
|
+
render_found = found_parents_and_renderers[:renderers]
|
38
|
+
default_params = { renderers: render_found, id: "audio_#{Universe.atomes.length}", type: :audio,
|
39
|
+
parents: parent_found }
|
40
|
+
default_params.merge!(params)
|
41
|
+
end
|
42
|
+
|
43
|
+
module BrowserHelper
|
44
|
+
def self.browser_path_audio(value, browser_object, _atome)
|
45
|
+
browser_object[:src] = value
|
46
|
+
end
|
47
|
+
|
48
|
+
|
49
|
+
end
|
50
|
+
|
51
|
+
box({ id: :mybox })
|
52
|
+
|
53
|
+
my_audio = audio({ path: 'medias/audios/Binrpilot.mp3', id: :audio3 }) do |params|
|
54
|
+
puts "3 - audio callback here #{params}, id is : #{id}"
|
55
|
+
end
|
56
|
+
|
57
|
+
# my_audio.clips[{begin: 4, end: 6}]
|
58
|
+
alert Universe.atome_list
|
4
59
|
|
5
60
|
|
6
61
|
# `
|
@@ -86,33 +141,33 @@ box({id: :mybox})
|
|
86
141
|
# `
|
87
142
|
#
|
88
143
|
#
|
89
|
-
|
90
|
-
`
|
91
|
-
const el = document.getElementById("mybox")
|
92
|
-
function modifyText(){
|
93
|
-
|
94
|
-
audio.play(2);
|
95
|
-
}
|
96
|
-
el.addEventListener("mousedown", modifyText, false);
|
97
|
-
`
|
98
|
-
b=box({left: 160})
|
99
|
-
b2=box({left: 333})
|
100
|
-
b.touch(:down) do
|
101
|
-
`
|
102
|
-
var audio = new Audio('medias/audios/Binrpilot.mp3');
|
103
|
-
audio.currentTime=12
|
104
|
-
audio.play(2);
|
105
|
-
console.log('ok')
|
106
|
-
`
|
107
|
-
end
|
108
|
-
|
109
|
-
|
110
|
-
b2.touch(:down) do
|
144
|
+
#########################################
|
145
|
+
# `
|
146
|
+
# const el = document.getElementById("mybox")
|
147
|
+
# function modifyText(){
|
148
|
+
# var audio = new Audio('medias/audios/snare.wav');
|
149
|
+
# audio.play(2);
|
150
|
+
# }
|
151
|
+
# el.addEventListener("mousedown", modifyText, false);
|
152
|
+
# `
|
153
|
+
# b=box({left: 160})
|
154
|
+
# b2=box({left: 333})
|
155
|
+
# b.touch(:down) do
|
111
156
|
# `
|
112
|
-
#
|
113
|
-
#
|
157
|
+
# var audio = new Audio('medias/audios/Binrpilot.mp3');
|
158
|
+
# audio.currentTime=12
|
159
|
+
# audio.play(2);
|
160
|
+
# console.log('ok')
|
114
161
|
# `
|
115
|
-
end
|
162
|
+
# end
|
163
|
+
#########################################
|
164
|
+
|
165
|
+
# b2.touch(:down) do
|
166
|
+
# # `
|
167
|
+
# # let bell= new Audio('medias/audios/snare.wav');
|
168
|
+
# #
|
169
|
+
# # `
|
170
|
+
# end
|
116
171
|
# generator = Genesis.generator
|
117
172
|
|
118
173
|
# b.touch(:double) do
|
@@ -164,8 +219,6 @@ end
|
|
164
219
|
# `
|
165
220
|
# end
|
166
221
|
|
167
|
-
|
168
|
-
|
169
222
|
# `
|
170
223
|
# //let saw = new Wad({source : 'sawtooth'});
|
171
224
|
# let saw = new Wad({
|
@@ -1,60 +1,50 @@
|
|
1
1
|
# # frozen_string_literal: true
|
2
|
-
|
3
|
-
# generator = Genesis.generator
|
4
|
-
# generator.build_atome(:data_set)
|
5
|
-
# generator.build_particle(:assign) do |cell_nb,&proc |
|
6
|
-
# # current_cell = grab("#{@matrix_id}_#{cell_nb}")
|
7
|
-
# if proc
|
8
|
-
# # @matrix_dataset[cell_nb] << proc
|
9
|
-
# # current_cell.instance_exec(&proc) if proc.is_a? Proc
|
10
|
-
# else
|
11
|
-
# # @matrix_dataset[cell_nb]
|
12
|
-
# end
|
13
|
-
# end
|
14
|
-
# class Atome
|
15
|
-
# def data_set(params = {}, &bloc)
|
16
|
-
# atome_type = :data_set
|
17
|
-
# generated_render = params[:renderers] || []
|
18
|
-
# generated_id = params[:id] || "#{atome_type}_#{Universe.atomes.length}"
|
19
|
-
# generated_parents = params[:parents] || [id.value]
|
20
|
-
# params = atome_common(atome_type, generated_id, generated_render, generated_parents, params)
|
21
|
-
# Atome.new({ atome_type => params }, &bloc)
|
22
|
-
# end
|
23
|
-
# end
|
24
|
-
#
|
25
|
-
#
|
26
|
-
# # create_atome(:data_set)
|
27
2
|
#
|
28
|
-
#
|
29
|
-
# puts a
|
3
|
+
# tt = text({ data: :hello, id: :the_text, drag: true })
|
30
4
|
#
|
31
|
-
#
|
32
|
-
#
|
33
|
-
# curent_cell.image({ path: "./medias/images/moto.png", width: 33, height: 33})
|
34
|
-
# curent_cell.active(:inactive)
|
35
|
-
# touch(:long) do
|
36
|
-
# if curent_cell.active.value ==:inactive
|
37
|
-
# curent_cell.color(:yellow)
|
38
|
-
# curent_cell.active(:active)
|
39
|
-
# else
|
40
|
-
# curent_cell.color(:red)
|
41
|
-
# curent_cell.active(:inactive)
|
42
|
-
# end
|
43
|
-
# end
|
44
|
-
# end
|
45
|
-
#
|
46
|
-
#*
|
47
|
-
# a.assign(3) do
|
48
|
-
# color({ red: 0.6, green: 0.333, blue: 0.6, alpha: 1 })
|
49
|
-
# grab(:vie_playground_3).shadow({ blur: 12 })
|
50
|
-
# end
|
51
|
-
# puts "assign : #{a.assign}"
|
5
|
+
# box({ id: :the_box })
|
6
|
+
# circle({ top: 300, id: :circle098 })
|
52
7
|
|
53
|
-
box({id: :the_box})
|
54
|
-
circle({top: 300, id: :circle098})
|
55
8
|
generator = Genesis.generator
|
56
|
-
|
57
9
|
generator.build_atome(:template)
|
10
|
+
generator.build_atome(:matrix)
|
11
|
+
|
12
|
+
class Atome
|
13
|
+
def matrix(params)
|
14
|
+
parent_found = found_parents_and_renderers[:parent]
|
15
|
+
render_found = found_parents_and_renderers[:renderers]
|
16
|
+
default_params = { renderers: render_found, id: "matrix_#{Universe.atomes.length}", type: :matrix,
|
17
|
+
parents: parent_found }
|
18
|
+
|
19
|
+
params[:renderer] = []
|
20
|
+
params[:children] = []
|
21
|
+
params[:parents] = [:view]
|
22
|
+
|
23
|
+
template_needed = params[:template]
|
24
|
+
found_margin = params[:margin] ||= 9
|
25
|
+
|
26
|
+
matrix_id = params[:id] ||= "matrix_display_nb"
|
27
|
+
matrix_width = params[:width] ||= 333
|
28
|
+
matrix_height = params[:height] ||= 333
|
29
|
+
matrix_left = params[:left ] ||= 33
|
30
|
+
matrix_top = params[:top] ||= 33
|
31
|
+
matrix_smooth = params[:smooth] ||= 3
|
32
|
+
template_grab = grab(template_needed)
|
33
|
+
# puts "template to get #{template_needed}"
|
34
|
+
matrix_color = create_matrix_colors('matrix_color_back', 0.3, 0.3, 0.6, 1)
|
35
|
+
cell_back_color = create_matrix_colors('cell_color_back', 0.333, 0.333, 0.7, 1)
|
36
|
+
matrix = create_matrix({ id: matrix_id, width: matrix_width,height: matrix_height,
|
37
|
+
left: matrix_left,top: matrix_top, smooth: matrix_smooth })
|
38
|
+
matrix_color.attach([matrix_id])
|
39
|
+
cells = create_matrix_cells(matrix_id, cell_back_color, 33, { width: 33, height: 33,
|
40
|
+
smooth: 9, shadow: { blur: 6 } })
|
41
|
+
resize_matrix({ matrix: matrix, width: matrix_width, height: matrix_height, cells: cells, columns: 3, rows: 8, margin: found_margin })
|
42
|
+
params
|
43
|
+
default_params.merge!(params)
|
44
|
+
matrix
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
58
48
|
generator.build_particle(:cells)
|
59
49
|
generator.build_particle(:rows)
|
60
50
|
generator.build_particle(:columns)
|
@@ -64,13 +54,27 @@ generator.build_sanitizer(:template) do |params|
|
|
64
54
|
end
|
65
55
|
|
66
56
|
def resize_matrix(params)
|
67
|
-
matrix=params[:matrix]
|
57
|
+
matrix = params[:matrix]
|
68
58
|
matrix_width = params[:width]
|
69
59
|
matrix_height = params[:height]
|
70
|
-
cells=params[:cells]
|
71
|
-
nb_of_cols= params[:columns]
|
72
|
-
nb_of_rows= params[:rows]
|
73
|
-
margin=params[:margin]
|
60
|
+
cells = params[:cells]
|
61
|
+
nb_of_cols = params[:columns]
|
62
|
+
nb_of_rows = params[:rows]
|
63
|
+
margin = params[:margin]
|
64
|
+
if matrix_width.instance_of? String
|
65
|
+
parent_found = grab(params[:matrix].parents.value.last)
|
66
|
+
parent_width= parent_found.width.to_px
|
67
|
+
matrix_width = matrix_width.sub('%', '').to_i
|
68
|
+
new_width= (parent_width* matrix_width)/100
|
69
|
+
matrix_width= new_width
|
70
|
+
end
|
71
|
+
if matrix_height.instance_of? String
|
72
|
+
parent_found = grab(params[:matrix].parents.value.last)
|
73
|
+
parent_height= parent_found.height.to_px
|
74
|
+
matrix_height = matrix_height.sub('%', '').to_i
|
75
|
+
new_height= (parent_height* matrix_height)/100
|
76
|
+
matrix_height= new_height
|
77
|
+
end
|
74
78
|
cell_width = (matrix_width / nb_of_cols) - margin
|
75
79
|
cell_height = (matrix_height / nb_of_rows) - margin
|
76
80
|
row = -1
|
@@ -89,89 +93,165 @@ end
|
|
89
93
|
generator.build_particle(:display) do |params|
|
90
94
|
|
91
95
|
template_needed = params[:template]
|
92
|
-
targeted_atomes = params[:
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
matrix_back_color=create_matrix_colors('matrix_color_back',0.3,0.3,0.6,1)
|
101
|
-
cell_back_color=create_matrix_colors('cell_color_back',0.333,0.333,0.7,1)
|
102
|
-
matrix_back_id="matrix_back_display_nb"
|
103
|
-
matrix_back=create_matrix_back( matrix_back_id, { width: 33, smooth: 9 })
|
104
|
-
matrix_back_color.attach([matrix_back_id])
|
105
|
-
|
106
|
-
cells=create_matrix_cells(matrix_back_id,cell_back_color,33,{width: 33, height: 33,
|
107
|
-
smooth: 9,shadow: { blur: 6 }})
|
108
|
-
resize_matrix({matrix: matrix_back, width: 333, height: 333, cells: cells, columns: 2, rows: 8, margin: 9 })
|
109
|
-
# We sort, clone and put the target in the matrix
|
110
|
-
sorted={}
|
111
|
-
targeted_atomes.each_with_index do |atome_id, index|
|
112
|
-
atome_found=grab(atome_id)
|
113
|
-
clone= atome_found.clones([{left: 33}])
|
114
|
-
selected_id="#{matrix_back_id}_#{index}"
|
115
|
-
clone.parents([selected_id])
|
116
|
-
cell_height=grab(selected_id).height.value-9
|
96
|
+
targeted_atomes = params[:elements] ||= []
|
97
|
+
# get params
|
98
|
+
sort_by = params[:sort]
|
99
|
+
found_width = params[:width]
|
100
|
+
found_height = params[:height]
|
101
|
+
found_left = params[:left]
|
102
|
+
found_right = params[:right]
|
103
|
+
found_margin = params[:margin] ||= 9
|
117
104
|
|
118
|
-
|
119
|
-
clone.top=3
|
120
|
-
clone.width(cell_height)
|
121
|
-
clone.height(cell_height)
|
122
|
-
sorted[atome_id]=atome_found.atome[sort_by]
|
105
|
+
matrix(params)
|
123
106
|
|
107
|
+
# matrix_back_id = params[:id] ||= "matrix_back_display_nb"
|
108
|
+
# template_grab = grab(template_needed)
|
109
|
+
#
|
110
|
+
# puts "template to get #{template_needed}"
|
111
|
+
# matrix_back_color = create_matrix_colors('matrix_color_back', 0.3, 0.3, 0.6, 1)
|
112
|
+
# cell_back_color = create_matrix_colors('cell_color_back', 0.333, 0.333, 0.7, 1)
|
113
|
+
# matrix_back = create_matrix_back(matrix_back_id, { width: 33, smooth: 9 })
|
114
|
+
# matrix_back_color.attach([matrix_back_id])
|
115
|
+
# cells = create_matrix_cells(matrix_back_id, cell_back_color, 33, { width: 33, height: 33,
|
116
|
+
# smooth: 9, shadow: { blur: 6 } })
|
117
|
+
# resize_matrix({ matrix: matrix_back, width: 333, height: 333, cells: cells, columns: 2, rows: 8, margin: found_margin })
|
124
118
|
|
125
|
-
|
126
|
-
#
|
127
|
-
|
128
|
-
#
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
119
|
+
# We sort, clone and put the target in the matrix
|
120
|
+
# sorted = {}
|
121
|
+
# targeted_atomes.each_with_index do |atome_id, index|
|
122
|
+
# atome_found = grab(atome_id)
|
123
|
+
# clone = atome_found.clones([{ left: 33 }])
|
124
|
+
# selected_id = "#{matrix_back_id}_#{index}"
|
125
|
+
# clone.parents([selected_id])
|
126
|
+
# cell_height = grab(selected_id).height.value - 9
|
127
|
+
#
|
128
|
+
# clone.left(3)
|
129
|
+
# clone.top(3)
|
130
|
+
# clone.width(cell_height)
|
131
|
+
# clone.height(cell_height)
|
132
|
+
# sorted[atome_id] = atome_found.atome[sort_by]
|
133
|
+
#
|
134
|
+
# end
|
135
|
+
# sorted = sorted.sort_by { |_key, value| value }.to_h
|
136
|
+
# selected = params[:select] ||= []
|
137
|
+
# selected.each do |select|
|
138
|
+
# selected_id = "#{matrix_back_id}_#{select}"
|
139
|
+
# grab(selected_id).color(:red)
|
140
|
+
# end
|
135
141
|
end
|
136
142
|
|
137
|
-
def create_matrix_colors(name,red,green,blue,alpha)
|
143
|
+
def create_matrix_colors(name, red, green, blue, alpha)
|
138
144
|
Atome.new({ color: { renderers: [:browser], id: name, type: :color, parents: [], children: [],
|
139
|
-
red: red, green: green, blue: blue, alpha: alpha
|
145
|
+
red: red, green: green, blue: blue, alpha: alpha } })
|
140
146
|
end
|
141
147
|
|
142
|
-
def
|
148
|
+
def create_matrix( style)
|
143
149
|
matrix = Atome.new(
|
144
|
-
shape: { type: :shape, renderers: [:browser], id: id, parents: [:view],width: 333, height: 333,left:
|
145
|
-
overflow: :hidden,children: [] }
|
150
|
+
shape: { type: :shape, renderers: [:browser], id: style[:id], parents: [:view], width: 333, height: 333, left: 33,top: 33,
|
151
|
+
overflow: :hidden, children: [] }
|
146
152
|
)
|
147
153
|
matrix.style(style)
|
148
154
|
matrix
|
149
155
|
end
|
150
156
|
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
cells=[]
|
157
|
+
def create_matrix_cells(id, cell_back_color, number_of_cells, style)
|
158
|
+
counter = 0
|
159
|
+
cells = []
|
155
160
|
while counter < number_of_cells
|
156
|
-
id_generated=id + "_#{counter}"
|
161
|
+
id_generated = id + "_#{counter}"
|
157
162
|
cells << a = Atome.new(
|
158
163
|
shape: { type: :shape, renderers: [:browser], id: id_generated, parents: [id],
|
159
164
|
children: [:cell_color]
|
160
165
|
|
161
|
-
|
166
|
+
}
|
162
167
|
)
|
163
168
|
cell_back_color.attach([id_generated])
|
164
169
|
a.style(style)
|
165
170
|
counter += 1
|
166
171
|
end
|
172
|
+
|
167
173
|
cells
|
168
174
|
end
|
169
175
|
|
176
|
+
# template({ id: :child_in_table, code: [], cells: 16, columns: 4, rows: 4 })
|
177
|
+
# the_view = grab(:view)
|
178
|
+
#
|
179
|
+
# tt.display(template: :child_in_table, sort: :id, elements: [:the_box,:the_text , :circle098], select: [1, 3, 7],
|
180
|
+
# id: :my_matrix, left: 33, top: 63, width: 633, height: 333, margin: 9,
|
181
|
+
# background: {color: :red, smooth: 3}, cells: {color: :orange, smooth: 9})
|
182
|
+
#
|
183
|
+
|
184
|
+
# matrix(template: :child_in_table, sort: :id, elements: [:the_box, :circle098], select: [1, 3, 7],
|
185
|
+
# id: :my_matrix, left: 33, top: 63, width: 633, height: 333, margin: 9,
|
186
|
+
# background: {color: :red, smooth: 3}, cells: {color: :orange, smooth: 9})
|
187
|
+
# class Atome
|
188
|
+
# def matrix(params)
|
189
|
+
# alert params
|
190
|
+
# end
|
191
|
+
# end
|
192
|
+
m=matrix({width: '100%', height: '100%', left: 0, top: 0,
|
193
|
+
smooth: 12,id: :the_big_amazing_matrix})
|
194
|
+
|
195
|
+
class Atome
|
196
|
+
def row(nb)
|
197
|
+
# alert self
|
198
|
+
|
199
|
+
end
|
200
|
+
end
|
201
|
+
# alert m
|
202
|
+
# m.cell(3).color(:red)
|
203
|
+
# alert m.cell(3)
|
204
|
+
puts m.row(3)
|
205
|
+
|
206
|
+
########### table Algo
|
207
|
+
# Define the table as an array
|
208
|
+
table = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34]
|
170
209
|
|
210
|
+
# Define the number of rows and columns in the table
|
211
|
+
num_rows = 5
|
212
|
+
num_columns = 7
|
171
213
|
|
172
|
-
|
173
|
-
|
174
|
-
|
214
|
+
# Define a method to retrieve the cells in a specified row
|
215
|
+
def get_row(table, num_columns, row_index)
|
216
|
+
# Calculate the start and end indices for the row
|
217
|
+
start_index = row_index * num_columns
|
218
|
+
end_index = start_index + num_columns - 1
|
219
|
+
|
220
|
+
# Get all the cells in the row using array slicing
|
221
|
+
row = table[start_index..end_index]
|
222
|
+
|
223
|
+
# Iterate over the cells in the row and print their values
|
224
|
+
row.each do |cell|
|
225
|
+
puts cell
|
226
|
+
end
|
227
|
+
end
|
228
|
+
|
229
|
+
# Define a method to retrieve the cells in a specified column
|
230
|
+
def get_column(table, num_rows, num_columns, column_index)
|
231
|
+
# Initialize an array to hold the cells in the column
|
232
|
+
column = []
|
233
|
+
|
234
|
+
# Iterate over the rows in the table
|
235
|
+
num_rows.times do |row_index|
|
236
|
+
# Calculate the index of the cell in the column
|
237
|
+
cell_index = row_index * num_columns + column_index
|
238
|
+
|
239
|
+
# Get the cell at the calculated index
|
240
|
+
cell = table[cell_index]
|
241
|
+
|
242
|
+
# Add the cell to the column array
|
243
|
+
column << cell
|
244
|
+
end
|
245
|
+
|
246
|
+
# Iterate over the cells in the column and print their values
|
247
|
+
column.each do |cell|
|
248
|
+
puts cell
|
249
|
+
end
|
250
|
+
end
|
175
251
|
|
176
|
-
|
252
|
+
# Test the methods
|
253
|
+
puts "Third row:"
|
254
|
+
get_row(table, num_columns, 2)
|
177
255
|
|
256
|
+
puts "\nSecond column:"
|
257
|
+
get_column(table, num_rows, num_columns, 1)
|
@@ -5,7 +5,7 @@
|
|
5
5
|
# 2 - this pre_render_clones option, will catch alterations and throw it the the original atome
|
6
6
|
# 3 - we also add a new particle call mirror that holds the particle's list that will reverse intrication
|
7
7
|
|
8
|
-
b = box({ color: :red, smooth: 6 })
|
8
|
+
b = box({ color: :red, smooth: 6, id: :the_box })
|
9
9
|
|
10
10
|
b.clones([{ left: 300, top: 300, color: :blue, intricate: [:width, :attached,:height ] },
|
11
11
|
{left: 600, top: 366, color: :green , intricate: [:left, :height ]}])
|
@@ -22,9 +22,9 @@ wait 3 do
|
|
22
22
|
b.left(180)
|
23
23
|
end
|
24
24
|
|
25
|
-
grab(:
|
26
|
-
|
27
|
-
grab(:
|
25
|
+
grab(:the_box_clone_0).smooth(33)
|
26
|
+
#
|
27
|
+
grab(:the_box_clone_1).rotate(33)
|
28
28
|
|
29
29
|
|
30
30
|
wait 5 do
|
@@ -2,14 +2,14 @@
|
|
2
2
|
|
3
3
|
b = box({left: 333})
|
4
4
|
|
5
|
-
b.circle({top: 66, id: :the_circle})
|
5
|
+
b.circle({top: 66, id: :the_circle, color: :green})
|
6
6
|
|
7
7
|
wait 4 do
|
8
8
|
b.delete(true)
|
9
9
|
end
|
10
10
|
|
11
11
|
wait 3 do
|
12
|
-
b.
|
12
|
+
b.children.value.each do |attached_atome_id|
|
13
13
|
b.delete({id: attached_atome_id})
|
14
14
|
b.shadow({ renderers: [:browser], id: :shadow2, type: :shadow, parents: [], children: [],
|
15
15
|
left: 3, top: 9, blur: 3, direction: '',
|
@@ -32,8 +32,9 @@ b.drag({ lock: :x })
|
|
32
32
|
# b.drag({ remove: true })
|
33
33
|
# b.drag({ remove: false })
|
34
34
|
|
35
|
-
# b.drag({ snap: { x: 100, y: 190 } })
|
36
35
|
|
37
36
|
# b.drag({ constraint: { top: 330, left: 30, bottom: 30, right: 1 } })
|
38
37
|
b.drag({ constraint: :parent })
|
38
|
+
b.drag({ snap: { x: 100, y: 190 } })
|
39
|
+
|
39
40
|
# b.drag({ constraint: :the_boxy })
|