atome 0.5.7.1.0 → 0.5.7.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -0
- data/documentation/deep learning/basic_infos.txt +1 -1
- data/lib/atome/extensions/atome.rb +9 -19
- data/lib/atome/genesis/atomes.rb +11 -0
- data/lib/atome/genesis/particles/property.rb +3 -1
- data/lib/atome/genesis/sparkle.rb +2 -1
- data/lib/atome/kernel/universe.rb +2 -1
- data/lib/atome/presets/atome.rb +5 -14
- data/lib/atome/version.rb +1 -1
- data/lib/renderers/html/hierarchy.rb +2 -2
- data/lib/renderers/html/html.rb +44 -17
- data/lib/renderers/html/identity.rb +4 -1
- data/lib/renderers/html/material.rb +10 -10
- data/lib/renderers/html/property.rb +5 -0
- data/lib/renderers/html/utility.rb +1 -1
- data/vendor/assets/application/examples/audio.rb +70 -0
- data/vendor/assets/application/examples/hypertext.rb +24 -3
- data/vendor/assets/application/examples/rotate.rb +8 -0
- data/vendor/assets/application/examples/test.rb +146 -572
- data/vendor/assets/application/examples/text_align.rb +3 -0
- data/vendor/assets/application/examples/tools.rb +46 -31
- data/vendor/assets/src/index.html +14 -6
- data/vendor/assets/src/index_opal.html +16 -7
- data/vendor/assets/src/index_server.html +20 -0
- data/vendor/assets/src/index_server_wasm.html +14 -6
- data/vendor/assets/src/index_wasm.html +20 -12
- data/vendor/assets/src/js/third_parties/wavesurfer.min.js +1 -0
- data/vendor/assets/src/js/third_parties/webaudio-pianoroll.min.js +66 -0
- data/vendor/assets/src/medias/images/icons/module.svg +6 -0
- data/vendor/assets/src/medias/images/utils/full_keyboard.svg +50 -0
- data/vendor/assets/src/medias/images/utils/keyboard.svg +29 -0
- data/vendor/assets/src/medias/images/utils/notes.svg +28 -0
- metadata +12 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f381b9c8d4123904b8ee97d71b0c6e1f78dc8143eb34b953670a273bd29fad10
|
4
|
+
data.tar.gz: d517e9cf6a13592fda0352bd5aa55c64ff30ffd4a0daab3776ce420c3ec0b970
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bd812f2209652f5f4e8b24a7d16214cedfc1e8ae5be2149d7f106393cef7f810908f61fbeb33a7854f0bbaab607e63b7d5c46c72c908e27a9cf799e27dd5380e
|
7
|
+
data.tar.gz: 77b884af5e674424861d278dcbd803f094d37600d2bf990cfbd14f041c9103e5cfbd392b772b2065485a5e54b2e146741f7f1654ae96272087d9ab9528eaeff5
|
data/Gemfile
CHANGED
@@ -13,7 +13,7 @@ curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf | sh
|
|
13
13
|
brew install openssl
|
14
14
|
cargo install tauri-cli --force
|
15
15
|
|
16
|
-
Install
|
16
|
+
Install Homebrew
|
17
17
|
|
18
18
|
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
|
19
19
|
|
@@ -614,11 +614,6 @@ class Object
|
|
614
614
|
end
|
615
615
|
|
616
616
|
|
617
|
-
JS.eval(<<~JS)
|
618
|
-
window.preventDefaultAction = function(e) {
|
619
|
-
e.preventDefault();
|
620
|
-
}
|
621
|
-
JS
|
622
617
|
|
623
618
|
def touch_allow(allow)
|
624
619
|
if allow
|
@@ -633,26 +628,21 @@ JS
|
|
633
628
|
|
634
629
|
def allow_copy(allow)
|
635
630
|
if allow
|
636
|
-
#
|
631
|
+
# allow selection and text copy
|
637
632
|
JS.eval(<<~JS)
|
638
|
-
|
639
|
-
|
640
|
-
|
633
|
+
document.body.style.userSelect = 'auto'; // allow text slectiion
|
634
|
+
document.removeEventListener('copy', preventDefaultAction); // allow copy
|
635
|
+
JS
|
641
636
|
else
|
642
|
-
#
|
637
|
+
# lock selection and text copy
|
643
638
|
JS.eval(<<~JS)
|
644
|
-
|
645
|
-
|
646
|
-
|
639
|
+
document.body.style.userSelect = 'none'; // prevent text selection
|
640
|
+
document.addEventListener('copy', preventDefaultAction); // prevent copy
|
641
|
+
JS
|
647
642
|
end
|
648
643
|
end
|
649
644
|
|
650
|
-
|
651
|
-
JS.eval(<<~JS)
|
652
|
-
window.preventDefaultAction = function(e) {
|
653
|
-
e.preventDefault();
|
654
|
-
}
|
655
|
-
JS
|
645
|
+
|
656
646
|
|
657
647
|
|
658
648
|
end
|
data/lib/atome/genesis/atomes.rb
CHANGED
@@ -63,6 +63,17 @@ new({ atome: :raw })
|
|
63
63
|
new({ atome: :shape })
|
64
64
|
new({ atome: :code })
|
65
65
|
new({ atome: :audio })
|
66
|
+
new({ sanitizer: :audio }) do |params|
|
67
|
+
unless params.instance_of? Hash
|
68
|
+
# TODO : we have to convert all image to png or maintain a database with extension
|
69
|
+
# FIXME : temporary patch that add .mp4 to the string if no extension is found
|
70
|
+
params = "#{params}.mp4" if params.to_s.split('.').length == 1
|
71
|
+
|
72
|
+
params = { path: "./medias/audios/#{params}" }
|
73
|
+
end
|
74
|
+
# TODO : the line below should get the value from default params Essentials
|
75
|
+
params
|
76
|
+
end
|
66
77
|
new({ atome: :element })
|
67
78
|
new({ sanitizer: :element }) do |params|
|
68
79
|
default_params = { data: '' }
|
@@ -142,6 +142,8 @@ new({ particle: :value }) do |val|
|
|
142
142
|
val
|
143
143
|
end
|
144
144
|
|
145
|
-
new({ particle: :behavior })
|
145
|
+
new({ particle: :behavior, type: :symbol, category: :property })
|
146
146
|
|
147
147
|
new({ particle: :orientation, type: :symbol, category: :property })
|
148
|
+
|
149
|
+
new({ particle: :align , type: :symbol, category: :property })
|
@@ -154,7 +154,8 @@ def atome_genesis
|
|
154
154
|
end
|
155
155
|
end
|
156
156
|
|
157
|
-
|
157
|
+
# this method is call from JS (atome/communication) at WS connection
|
158
|
+
def init_database
|
158
159
|
# we init the db file eDen
|
159
160
|
A.sync({ action: :init_db, data: { database: :eDen } }) do |data|
|
160
161
|
Universe.database_ready = data[:data][:message] == 'database_ready'
|
@@ -23,6 +23,7 @@ class Universe
|
|
23
23
|
@allow_sync = false # temp server storage sync
|
24
24
|
@connected = false
|
25
25
|
@database_ready = false
|
26
|
+
@tools_root=[]
|
26
27
|
@tools = {}
|
27
28
|
@allow_tool_operations = false
|
28
29
|
@active_tools = []
|
@@ -33,7 +34,7 @@ class Universe
|
|
33
34
|
class << self
|
34
35
|
attr_reader :atomes, :atomes_ids, :renderer_list, :molecule_list, :atome_list, :particle_list, :classes, :counter,
|
35
36
|
:atomes_specificities
|
36
|
-
attr_accessor :connected, :allow_sync, :allow_localstorage, :database_ready, :edit_mode, :tools,
|
37
|
+
attr_accessor :connected, :allow_sync, :allow_localstorage, :database_ready, :edit_mode, :tools,:tools_root,
|
37
38
|
:allow_tool_operations, :active_tools, :atome_preset, :applicable_atomes, :default_selection_style
|
38
39
|
|
39
40
|
def messages
|
data/lib/atome/presets/atome.rb
CHANGED
@@ -16,13 +16,15 @@ class Atome
|
|
16
16
|
# preset_params = {preset: atome_preset}
|
17
17
|
basic_params[:type] = preset_params[:type] || :element
|
18
18
|
# basic_params[:aid] = identity_generator(:a)
|
19
|
-
|
19
|
+
# alert "common => #{params[:id]}"
|
20
|
+
# alert "basic_params #{basic_params[:id].class}"
|
21
|
+
basic_params[:id] = params[:id] || identity_generator
|
20
22
|
basic_params[:renderers] = @renderers || preset_params[:renderers]
|
21
23
|
essential_params = basic_params.merge(preset_params)
|
22
24
|
#
|
23
25
|
reordered_params = essential_params.reject { |key, _| params.has_key?(key) }
|
24
26
|
params = reordered_params.merge(params)
|
25
|
-
params[:id]=params[:id].to_sym
|
27
|
+
params[:id] = params[:id].to_sym
|
26
28
|
# condition to handle color/shadow/paint atomes that shouldn't be attach to view
|
27
29
|
if Universe.applicable_atomes.include?(atome_preset)
|
28
30
|
unless params[:affect]
|
@@ -36,24 +38,13 @@ class Atome
|
|
36
38
|
params[:attach] = params[:attach] || @id || :view
|
37
39
|
end
|
38
40
|
# we reorder the hash
|
39
|
-
|
41
|
+
reorder_particles(params)
|
40
42
|
end
|
41
43
|
|
42
44
|
def preset_common(params, &bloc)
|
43
|
-
|
44
|
-
## if an atome with current id exist we update the ID in the params
|
45
|
-
# params[:id] = "#{params[:id]}_#{Universe.atomes.length}" if grab(params[:id])
|
46
|
-
# if Universe.atomes[params[:id]]
|
47
|
-
# alert "atome found : #{ grab(params[:id])}"
|
48
|
-
# grab(params[:id])
|
49
|
-
# else
|
50
|
-
|
51
45
|
Atome.new(params, &bloc)
|
52
|
-
# end
|
53
46
|
end
|
54
47
|
|
55
|
-
|
56
|
-
|
57
48
|
# def box(params = {}, &bloc)
|
58
49
|
# atome_preset = :box
|
59
50
|
# params = atome_common(atome_preset, params)
|
data/lib/atome/version.rb
CHANGED
@@ -4,9 +4,10 @@ new({ renderer: :html, method: :attach, type: :string }) do |parent_found, _user
|
|
4
4
|
html.append_to(parent_found)
|
5
5
|
end
|
6
6
|
|
7
|
+
|
7
8
|
new({ renderer: :html, method: :apply, type: :string }) do |parent_found, _user_proc|
|
8
9
|
|
9
|
-
# TODO : factorise code below between text and shape, especially shadow as code is written twice and
|
10
|
+
# TODO : factorise code below between text and shape, especially shadow as code is written twice and identical
|
10
11
|
case parent_found.type
|
11
12
|
when :shadow
|
12
13
|
shadows_to_apply = { filter: [], boxShadow: [] }
|
@@ -32,7 +33,6 @@ new({ renderer: :html, method: :apply, type: :string }) do |parent_found, _user_
|
|
32
33
|
html.style("boxShadow", box_shadow)
|
33
34
|
html.style("filter", drop_shadow)
|
34
35
|
when :color
|
35
|
-
|
36
36
|
red = parent_found.red * 255
|
37
37
|
green = parent_found.green * 255
|
38
38
|
blue = parent_found.blue * 255
|
data/lib/renderers/html/html.rb
CHANGED
@@ -4,8 +4,6 @@
|
|
4
4
|
|
5
5
|
class HTML
|
6
6
|
|
7
|
-
|
8
|
-
|
9
7
|
# def id
|
10
8
|
# :poil
|
11
9
|
# end
|
@@ -221,7 +219,6 @@ STRDELIM
|
|
221
219
|
particles_from_style[key.to_sym] = value if key && value
|
222
220
|
end
|
223
221
|
|
224
|
-
# alert "hyperedit"
|
225
222
|
|
226
223
|
particles_found = particles_found.merge(particles_from_style)
|
227
224
|
current_atome = grab(@id)
|
@@ -378,6 +375,18 @@ STRDELIM
|
|
378
375
|
self
|
379
376
|
end
|
380
377
|
|
378
|
+
def audio(id)
|
379
|
+
# we remove any element if the id already exist
|
380
|
+
check_double(id)
|
381
|
+
markup_found = @original_atome.markup || :audio
|
382
|
+
@element_type = markup_found.to_s
|
383
|
+
@element = JS.global[:document].createElement(@element_type)
|
384
|
+
JS.global[:document][:body].appendChild(@element)
|
385
|
+
add_class('atome')
|
386
|
+
self.id(id)
|
387
|
+
self
|
388
|
+
end
|
389
|
+
|
381
390
|
def www(id)
|
382
391
|
# we remove any element if the id already exist
|
383
392
|
check_double(id)
|
@@ -505,7 +514,6 @@ STRDELIM
|
|
505
514
|
end
|
506
515
|
end
|
507
516
|
|
508
|
-
|
509
517
|
def transform(property, value = nil)
|
510
518
|
transform_needed = "#{property}(#{value}deg)"
|
511
519
|
@element[:style][:transform] = transform_needed.to_s
|
@@ -578,8 +586,6 @@ STRDELIM
|
|
578
586
|
@element[:style][:"-webkit-backdrop-filter"] = filter_needed
|
579
587
|
end
|
580
588
|
|
581
|
-
|
582
|
-
|
583
589
|
def currentTime(time)
|
584
590
|
@element[:currentTime] = time
|
585
591
|
end
|
@@ -598,7 +604,6 @@ STRDELIM
|
|
598
604
|
|
599
605
|
def action(_particle, action_found, option = nil)
|
600
606
|
|
601
|
-
# alert option
|
602
607
|
if action_found == :stop
|
603
608
|
currentTime(option)
|
604
609
|
@element.pause
|
@@ -1146,13 +1151,11 @@ STRDELIM
|
|
1146
1151
|
end
|
1147
1152
|
|
1148
1153
|
def touch_tap(_option)
|
1149
|
-
# alert :touch_tap
|
1150
1154
|
@element[:style][:cursor] = 'pointer'
|
1151
1155
|
interact = JS.eval("return interact('##{@id}')")
|
1152
1156
|
touch_tap = @original_atome.instance_variable_get('@touch_code')[:tap]
|
1153
1157
|
# unless @touch_removed[:tap]
|
1154
1158
|
interact.on('tap') do |native_event|
|
1155
|
-
# alert 'touchy'
|
1156
1159
|
event = Native(native_event)
|
1157
1160
|
# we use .call instead of instance_eval because instance_eval bring the current object as context
|
1158
1161
|
# and it's lead to a problem of context and force the use of grab(:view) when using atome method such as shape ,
|
@@ -1339,6 +1342,7 @@ STRDELIM
|
|
1339
1342
|
# Table manipulation
|
1340
1343
|
|
1341
1344
|
def table(data)
|
1345
|
+
|
1342
1346
|
table_html = JS.global[:document].createElement('table')
|
1343
1347
|
thead = JS.global[:document].createElement('thead')
|
1344
1348
|
|
@@ -1358,7 +1362,6 @@ STRDELIM
|
|
1358
1362
|
|
1359
1363
|
table_html.appendChild(thead)
|
1360
1364
|
tbody = JS.global[:document].createElement('tbody')
|
1361
|
-
|
1362
1365
|
data.each_with_index do |row, row_index|
|
1363
1366
|
tr = JS.global[:document].createElement('tr')
|
1364
1367
|
|
@@ -1388,6 +1391,17 @@ STRDELIM
|
|
1388
1391
|
JS.global[:document].querySelector("##{@id}").appendChild(table_html)
|
1389
1392
|
end
|
1390
1393
|
|
1394
|
+
# Helper function to handle Atome objects
|
1395
|
+
def handle_atome(atome, td_element)
|
1396
|
+
atome.fit(cell_height)
|
1397
|
+
html_element = JS.global[:document].getElementById(atome.id.to_s)
|
1398
|
+
td_element.appendChild(html_element)
|
1399
|
+
html_element[:style][:transformOrigin] = 'top left'
|
1400
|
+
html_element[:style][:position] = 'relative'
|
1401
|
+
atome.top(0)
|
1402
|
+
atome.left(0)
|
1403
|
+
end
|
1404
|
+
|
1391
1405
|
def refresh_table(_params)
|
1392
1406
|
# first we need to extact all atome from the table or they will be deleted by the table refres
|
1393
1407
|
data = @original_atome.data
|
@@ -1425,18 +1439,31 @@ STRDELIM
|
|
1425
1439
|
end
|
1426
1440
|
|
1427
1441
|
def set_td_style(td)
|
1428
|
-
cell_height =
|
1429
|
-
|
1442
|
+
cell_height = @original_atome.component[:height]
|
1443
|
+
cell_width = @original_atome.component[:width]
|
1444
|
+
# shadow_found = @original_atome.component[:shadow]
|
1445
|
+
# if shadow_found
|
1446
|
+
# red = shadow_found[:red] * 255
|
1447
|
+
# green = shadow_found[:green] * 255
|
1448
|
+
# blue = shadow_found[:blue] * 255
|
1449
|
+
# alpha = shadow_found[:alpha]
|
1450
|
+
# left = shadow_found[:left]
|
1451
|
+
# top = shadow_found[:top]
|
1452
|
+
# blur = shadow_found[:blur] # new correct behavior all atome's value should now be get using :value,here to resolve conflict with blur and back blur
|
1453
|
+
# inset = :inset if shadow_found[:invert]
|
1454
|
+
# shadow_created = "#{left}px #{top}px #{blur}px rgba(#{red}, #{green}, #{blue}, #{alpha}) #{inset}"
|
1455
|
+
# end
|
1456
|
+
# td[:style][:border] = '1px solid black'
|
1430
1457
|
td[:style][:backgroundColor] = 'white'
|
1431
|
-
td[:style][:boxShadow] =
|
1432
|
-
td[:style][:width] = "#{
|
1433
|
-
td[:style]['min-width'] = "#{
|
1458
|
+
# td[:style][:boxShadow] = shadow_created
|
1459
|
+
td[:style][:width] = "#{cell_width}px"
|
1460
|
+
td[:style]['min-width'] = "#{cell_width}px"
|
1434
1461
|
td[:style]['max-width'] = "#{cell_height}px"
|
1435
1462
|
td[:style]['min-height'] = "#{cell_height}px"
|
1436
1463
|
td[:style]['max-height'] = "#{cell_height}px"
|
1437
1464
|
td[:style][:height] = "#{cell_height}px"
|
1438
1465
|
td[:style][:overflow] = 'hidden'
|
1439
|
-
{ cell_height: cell_height, cell_width:
|
1466
|
+
{ cell_height: cell_height, cell_width: cell_width }
|
1440
1467
|
end
|
1441
1468
|
|
1442
1469
|
def insert_cell(params)
|
@@ -1625,7 +1652,7 @@ STRDELIM
|
|
1625
1652
|
|
1626
1653
|
# atomisation!
|
1627
1654
|
def atomized(html_object)
|
1628
|
-
html_object = html_object[0] if html_object.instance_of? Array
|
1655
|
+
# html_object = html_object[0] if html_object.instance_of? Array
|
1629
1656
|
@element = html_object
|
1630
1657
|
end
|
1631
1658
|
|
@@ -17,6 +17,9 @@ end
|
|
17
17
|
new({ method: :type, type: :string, renderer: :html, specific: :video }) do |_value, _user_proc|
|
18
18
|
html.video(@id)
|
19
19
|
end
|
20
|
+
new({ method: :type, type: :string, renderer: :html, specific: :audio }) do |_value, _user_proc|
|
21
|
+
html.audio(@id)
|
22
|
+
end
|
20
23
|
|
21
24
|
new({ method: :type, type: :string, renderer: :html, specific: :www }) do |_value, _user_proc|
|
22
25
|
html.www(@id)
|
@@ -95,7 +98,7 @@ new({ method: :data, type: :string, specific: :table, renderer: :html }) do |val
|
|
95
98
|
end
|
96
99
|
|
97
100
|
new({ method: :type, type: :hash, specific: :atomized, renderer: :html }) do |value, _user_proc|
|
98
|
-
html.atomized(
|
101
|
+
html.atomized(alien)
|
99
102
|
end
|
100
103
|
|
101
104
|
|
@@ -20,9 +20,11 @@ new({ method: :remove, renderer: :html, type: :string }) do |object_id_to_remove
|
|
20
20
|
when :category
|
21
21
|
html.remove_class(value)
|
22
22
|
else
|
23
|
-
|
24
|
-
|
25
|
-
|
23
|
+
if object_id_to_remove[:all]
|
24
|
+
atome_ids_found = send(object_id_to_remove[:all])
|
25
|
+
atome_ids_found.each do |atome_id|
|
26
|
+
remove(atome_id)
|
27
|
+
end
|
26
28
|
end
|
27
29
|
end
|
28
30
|
end
|
@@ -44,9 +46,7 @@ new({ method: :remove, renderer: :html, type: :string }) do |object_id_to_remove
|
|
44
46
|
html.style("boxShadow", 'none')
|
45
47
|
html.style("filter", 'none')
|
46
48
|
@apply.delete(object_id_to_remove)
|
47
|
-
# apply(@apply)
|
48
49
|
when :border
|
49
|
-
# alert :poipoipoipoipo
|
50
50
|
html.style("border", 'none')
|
51
51
|
html.style("filter", 'none')
|
52
52
|
@apply.delete(object_id_to_remove)
|
@@ -81,20 +81,20 @@ end
|
|
81
81
|
#
|
82
82
|
# html.style(:border, "#{type} #{thickness}px rgba(#{red},#{green},#{blue},#{alpha})")
|
83
83
|
# end
|
84
|
-
new({ method: :thickness, type: :integer, renderer: :html})
|
84
|
+
new({ method: :thickness, type: :integer, renderer: :html })
|
85
85
|
|
86
86
|
# end
|
87
|
-
new({ method: :pattern, type: :integer, renderer: :html})
|
87
|
+
new({ method: :pattern, type: :integer, renderer: :html })
|
88
88
|
|
89
89
|
new({ method: :fill, renderer: :html }) do |params|
|
90
90
|
html.fill(params)
|
91
91
|
end
|
92
92
|
|
93
|
-
new({ method: :opacity, type: :integer, renderer: :html}) do |value|
|
93
|
+
new({ method: :opacity, type: :integer, renderer: :html }) do |value|
|
94
94
|
# html.opacity(value)
|
95
|
-
html.style('opacity',value)
|
95
|
+
html.style('opacity', value)
|
96
96
|
end
|
97
97
|
|
98
98
|
new({ method: :visual, type: :string, renderer: :html, specific: :text }) do |value, _user_proc|
|
99
|
-
|
99
|
+
html.style('fontFamily', value)
|
100
100
|
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
#
|
3
|
+
# # audio tag
|
4
|
+
a = audio({ path: 'medias/audios/clap.wav', id: :audioElement })
|
5
|
+
b=box({id: :playButton})
|
6
|
+
b.text(:audio_tag)
|
7
|
+
a.left(333)
|
8
|
+
b.touch(:down) do
|
9
|
+
a.play(true)
|
10
|
+
end
|
11
|
+
|
12
|
+
|
13
|
+
#
|
14
|
+
#
|
15
|
+
### Web Audio
|
16
|
+
# Initialisation des variables globales
|
17
|
+
@audio_context = JS.eval('return new AudioContext()')
|
18
|
+
@audio_element = JS.global[:document].getElementById('audioElement')
|
19
|
+
@track = @audio_context.createMediaElementSource(@audio_element)
|
20
|
+
|
21
|
+
# Ajout d'un nœud de gain (volume)
|
22
|
+
@gain_node = @audio_context.createGain()
|
23
|
+
@gain_node[:gain][:value] = 0.5 # Réduit le volume à 50%
|
24
|
+
#
|
25
|
+
# # Connexion de la chaîne
|
26
|
+
@track.connect(@gain_node) # Connecte la source au nœud de gain
|
27
|
+
@gain_node.connect(@audio_context[:destination]) # Connecte le nœud de gain à la sortie
|
28
|
+
|
29
|
+
def play_audio
|
30
|
+
# Réactive l'AudioContext s'il est suspendu
|
31
|
+
@audio_context[:resume].to_s if @audio_context[:state].to_s == 'suspended'
|
32
|
+
# Joue l'audio
|
33
|
+
@audio_element.play
|
34
|
+
end
|
35
|
+
b2=box({left: 166})
|
36
|
+
b2.text(:web_audio)
|
37
|
+
b2.touch(:down) do
|
38
|
+
play_audio
|
39
|
+
end
|
40
|
+
|
41
|
+
|
42
|
+
# ######### wadjs
|
43
|
+
bb=box({left: 333})
|
44
|
+
bb.text(:wadjs)
|
45
|
+
init_code = "window.snare = new Wad({source : 'medias/audios/clap.wav'});"
|
46
|
+
JS.eval(init_code)
|
47
|
+
|
48
|
+
# Code JavaScript pour jouer le son et l'arrêter après 300 ms, dans un bloc indépendant
|
49
|
+
play_code = <<~STRDEL
|
50
|
+
window.snare.play();
|
51
|
+
setTimeout(function() {
|
52
|
+
window.snare.stop();
|
53
|
+
}, 300);
|
54
|
+
STRDEL
|
55
|
+
|
56
|
+
# Exécution du bloc indépendant pour jouer et arrêter le son
|
57
|
+
# JS.eval(play_code)
|
58
|
+
# snare=JS.eval("return new Wad({source : 'medias/audios/clap.wav'})")
|
59
|
+
# js_code=<<STRDEL
|
60
|
+
# snare = #{snare};
|
61
|
+
# snare =new Wad({source : 'medias/audios/clap.wav'})
|
62
|
+
# snare.play();
|
63
|
+
# setTimeout(() => {
|
64
|
+
# snare.stop();
|
65
|
+
# }, "300");
|
66
|
+
# STRDEL
|
67
|
+
bb.touch(:down) do
|
68
|
+
JS.eval(play_code)
|
69
|
+
end
|
70
|
+
|
@@ -58,7 +58,7 @@ html_desc = <<STR
|
|
58
58
|
</nav>
|
59
59
|
</header>
|
60
60
|
|
61
|
-
<section id='
|
61
|
+
<section id='div_id' class="section my_class" style='left: 333px;color: yellow'>
|
62
62
|
<h2>PRODUCTIONS AUDIOVISUELLES</h2>
|
63
63
|
<!-- Contenu de la section -->
|
64
64
|
</section>
|
@@ -105,8 +105,29 @@ b.hypertext(html_desc)
|
|
105
105
|
# get tag content convert to data
|
106
106
|
# get style and class convert to particle
|
107
107
|
# end
|
108
|
-
b.hyperedit(:
|
109
|
-
puts
|
108
|
+
b.hyperedit(:div_id) do |tag_desc|
|
109
|
+
puts tag_desc.class
|
110
|
+
end
|
111
|
+
|
112
|
+
wait 2 do
|
113
|
+
div_result = HTML.locate(id: 'div_id') # find by ID
|
114
|
+
|
115
|
+
atomized_el= atomizer({ target: div_result, id: :my_second_html_obj })
|
116
|
+
atomized_el.rotate(55)
|
117
|
+
atomized_el.color(:purple)
|
118
|
+
atomized_el.position(:absolute)
|
119
|
+
atomized_el.left(255)
|
120
|
+
atomized_el.top(255)
|
121
|
+
end
|
122
|
+
|
123
|
+
|
124
|
+
wait 3 do
|
125
|
+
# or handle the objet in pure ruby js style
|
126
|
+
div_result = HTML.locate(id: 'div_id') # find by ID
|
127
|
+
div_result[:style][:left]= "66px"
|
128
|
+
puts "the div is : #{div_result[:style][:left]}"
|
129
|
+
|
130
|
+
|
110
131
|
end
|
111
132
|
|
112
133
|
# TODO : create an html to atome converter
|