atome 0.5.4.1.3 → 0.5.4.1.9
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/CHANGELOG.md +10 -1
- data/lib/atome/genesis/generators/atome.rb +9 -0
- data/lib/atome/genesis/generators/identity.rb +5 -3
- data/lib/atome/genesis/generators/material.rb +16 -16
- data/lib/atome/helpers/essentials.rb +11 -1
- data/lib/atome/presets/atome.rb +23 -8
- data/lib/atome/renderers/browser/atome.rb +97 -25
- data/lib/atome/renderers/browser/helpers/browser_helper.rb +21 -22
- data/lib/atome/renderers/browser/helpers/color_helper.rb +67 -9
- data/lib/atome/renderers/browser/helpers/effect_helper.rb +10 -10
- data/lib/atome/renderers/browser/helpers/shadow_helper.rb +54 -13
- data/lib/atome/renderers/browser/identity.rb +25 -10
- data/lib/atome/renderers/browser/material.rb +24 -22
- data/lib/atome/renderers/browser/opal_add_on.rb +30 -29
- data/lib/atome/version.rb +1 -1
- data/vendor/assets/src/js/atome/atome.js +0 -1
- data/vendor/assets/src/medias/rubies/examples/over.rb +1 -1
- data/vendor/assets/src/medias/rubies/examples/shadow.rb +70 -23
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4feb89bd1af8453078bbe9c826af8f6176c321ee7b155e109c3b8a3f6033e87e
|
4
|
+
data.tar.gz: 7d13f98dde5fbafb74f27eae1ea4fe025ef7de735c939414cc23708205963a6f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 82eca49b901057c6070c7db3f64496efee49b63833a27b6b0dc2388a32a7cf1e6b37a7531bec2e9272f963f9d39f75ae7884c20d89cbe1482c0abe58dc674b6e
|
7
|
+
data.tar.gz: c1013e2b38c94c2a46fef8aa91fade3361ef952d71be71e7ddbeada26955c43a7ce21e252a5ceadf954fd4a8ea96faf7298f5666be5db9311b1478f6280d834e
|
data/CHANGELOG.md
CHANGED
@@ -9,4 +9,13 @@
|
|
9
9
|
## [0.5.4.1.3] - 2023-05-21
|
10
10
|
-version updated to '0.5.4.1.3'
|
11
11
|
vector now remove background-color if it exist
|
12
|
-
vector now use class instead of a local style
|
12
|
+
vector now use class instead of a local style
|
13
|
+
|
14
|
+
|
15
|
+
## [0.5.4.1.7] - 2023-05-25
|
16
|
+
|
17
|
+
remove "shape :pre" and move the condition when using :definition to atome_common , because of a bug that remove all
|
18
|
+
attached atome
|
19
|
+
|
20
|
+
## [0.5.4.1.8] - 2023-05-25
|
21
|
+
Ready to add gradient color now systematically use a variable for each component( Red, green , blue , alpha)
|
@@ -32,6 +32,15 @@ new({ sanitizer: :shadow }) do |params|
|
|
32
32
|
new_params
|
33
33
|
end
|
34
34
|
new({ atome: :shape })
|
35
|
+
# new({ pre: :shape }) do |params|
|
36
|
+
# if params[:definition]
|
37
|
+
# # if it is a vector we reorder tha params
|
38
|
+
# attached = params.delete(:attached)
|
39
|
+
# params = params.merge({ attached: attached })
|
40
|
+
# end
|
41
|
+
#
|
42
|
+
# params
|
43
|
+
# end
|
35
44
|
new({ atome: :code })
|
36
45
|
new({ atome: :audio })
|
37
46
|
new({ atome: :element })
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
new({ particle: :attach })
|
4
4
|
new({ sanitizer: :attach }) do |parents_ids|
|
5
|
-
puts "=> attach it! : #{parents_ids} <="
|
5
|
+
# puts "=> attach it! : #{parents_ids} <="
|
6
6
|
|
7
7
|
# parents_ids = parents_ids if parents_ids.instance_of? Atome
|
8
8
|
parents_ids = [parents_ids] unless parents_ids.instance_of?(Array)
|
@@ -30,7 +30,7 @@ end
|
|
30
30
|
|
31
31
|
new({ particle: :attached })
|
32
32
|
new({ sanitizer: :attached }) do |children_ids|
|
33
|
-
puts "=> attached now! : #{children_ids}<="
|
33
|
+
# puts "=> attached now! : #{children_ids}<="
|
34
34
|
# children_ids = children_ids if children_ids.instance_of? Atome
|
35
35
|
children_ids = [children_ids] unless children_ids.instance_of?(Array)
|
36
36
|
children_ids.each do |child_id|
|
@@ -55,7 +55,6 @@ new({ sanitizer: :attached }) do |children_ids|
|
|
55
55
|
end
|
56
56
|
|
57
57
|
new({ particle: :detached, store: false })
|
58
|
-
|
59
58
|
new({ sanitizer: :detached }) do |values|
|
60
59
|
if values.instance_of? Array
|
61
60
|
values.each do |value|
|
@@ -69,6 +68,9 @@ new({ sanitizer: :detached }) do |values|
|
|
69
68
|
values
|
70
69
|
end
|
71
70
|
|
71
|
+
|
72
|
+
|
73
|
+
new({ particle: :real })
|
72
74
|
new({ particle: :type })
|
73
75
|
new({ particle: :id })
|
74
76
|
new({ sanitizer: :id }) do |params|
|
@@ -1,21 +1,21 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
new({ particle: :red }) do
|
4
|
-
|
5
|
-
|
6
|
-
end
|
7
|
-
new({ particle: :green }) do
|
8
|
-
|
9
|
-
|
10
|
-
end
|
11
|
-
new({ particle: :blue }) do
|
12
|
-
|
13
|
-
|
14
|
-
end
|
15
|
-
new({ particle: :alpha }) do
|
16
|
-
|
17
|
-
|
18
|
-
end
|
3
|
+
# new({ particle: :red }) do
|
4
|
+
# # we return self to allow syntax of the type : a.color(:black).red(1).green(0.3)
|
5
|
+
# self
|
6
|
+
# end
|
7
|
+
# new({ particle: :green }) do
|
8
|
+
# # we return self to allow syntax of the type : a.color(:black).red(1).green(0.3)
|
9
|
+
# self
|
10
|
+
# end
|
11
|
+
# new({ particle: :blue }) do
|
12
|
+
# # we return self to allow syntax of the type : a.color(:black).red(1).green(0.3)
|
13
|
+
# self
|
14
|
+
# end
|
15
|
+
# new({ particle: :alpha }) do
|
16
|
+
# # we return self to allow syntax of the type : a.color(:black).red(1).green(0.3)
|
17
|
+
# self
|
18
|
+
# end
|
19
19
|
new({ particle: :diffusion }) do
|
20
20
|
# we return self to allow syntax of the type : a.color(:black).red(1).green(0.3)
|
21
21
|
self
|
@@ -2,6 +2,16 @@
|
|
2
2
|
|
3
3
|
# use to sanitize and secure user input
|
4
4
|
module Essentials
|
5
|
+
corp = <<~STR
|
6
|
+
<g transform="matrix(0.0267056,0,0,0.0267056,18.6376,20.2376)">
|
7
|
+
<g id="shapePath1" transform="matrix(4.16667,0,0,4.16667,-377.307,105.632)">
|
8
|
+
<path d="M629.175,81.832C740.508,190.188 742.921,368.28 634.565,479.613C526.209,590.945 348.116,593.358 236.784,485.002C125.451,376.646 123.038,198.554 231.394,87.221C339.75,-24.111 517.843,-26.524 629.175,81.832Z" style="fill:rgb(201,12,125);"/>
|
9
|
+
</g>
|
10
|
+
<g id="shapePath2" transform="matrix(4.16667,0,0,4.16667,-377.307,105.632)">
|
11
|
+
<path d="M1679.33,410.731C1503.98,413.882 1402.52,565.418 1402.72,691.803C1402.91,818.107 1486.13,846.234 1498.35,1056.78C1501.76,1313.32 1173.12,1490.47 987.025,1492.89C257.861,1502.39 73.275,904.061 71.639,735.381C70.841,653.675 1.164,647.648 2.788,737.449C12.787,1291.4 456.109,1712.79 989.247,1706.24C1570.67,1699.09 1982.31,1234 1965.76,683.236C1961.3,534.95 1835.31,407.931 1679.33,410.731Z" style="fill:rgb(201,12,125);"/>
|
12
|
+
</g>
|
13
|
+
</g>
|
14
|
+
STR
|
5
15
|
@default_params = {
|
6
16
|
# Warning : type must be define first
|
7
17
|
render_engines: [:browser],
|
@@ -19,7 +29,7 @@ module Essentials
|
|
19
29
|
left: 100, top: 100, clones: [], preset: :box },
|
20
30
|
vector: { type: :shape, width: 99, height: 99,
|
21
31
|
attach: [:view],
|
22
|
-
left: 100, top: 100, clones: [], preset: :vector },
|
32
|
+
left: 100, top: 100, clones: [], preset: :vector , definition: corp},
|
23
33
|
circle: { type: :shape, width: 99, height: 99, smooth: '100%',
|
24
34
|
attached: :circle_color, attach: [:view],
|
25
35
|
left: 100, top: 100, clones: [], preset: :circle },
|
data/lib/atome/presets/atome.rb
CHANGED
@@ -13,29 +13,44 @@ class Atome
|
|
13
13
|
essential_params[:renderers] = essential_params[:renderers] || @atome[:renderers]
|
14
14
|
essential_params[:id] = params[:id] || identity_generator(atome_type)
|
15
15
|
essential_params[:attach] = params[:attach] || [@atome[:id]] || [:view]
|
16
|
+
if params[:definition]
|
17
|
+
# if it is a vector we reorder tha params
|
18
|
+
attached = params.delete(:attached)
|
19
|
+
params = params.merge({ attached: attached })
|
20
|
+
end
|
21
|
+
|
22
|
+
|
16
23
|
essential_params.merge(params)
|
17
24
|
end
|
18
25
|
|
19
26
|
def box(params = {}, &bloc)
|
20
27
|
atome_type = :box
|
21
28
|
params = atome_common(atome_type, params)
|
22
|
-
|
29
|
+
# b= send(params[:type],params , &bloc)
|
30
|
+
Atome.new({ atome_type => params }, &bloc)
|
31
|
+
|
23
32
|
end
|
24
33
|
|
25
|
-
|
26
|
-
|
34
|
+
|
35
|
+
|
36
|
+
def circle(params = {}, &bloc)
|
37
|
+
atome_type = :circle
|
27
38
|
params = atome_common(atome_type, params)
|
39
|
+
# send(params[:type],params , &bloc)
|
28
40
|
Atome.new({ atome_type => params }, &bloc)
|
29
41
|
end
|
30
42
|
|
31
|
-
def circle(params = {}, &bloc)
|
32
|
-
atome_type = :circle
|
33
|
-
# puts "counter#{Universe.counter}"
|
34
43
|
|
44
|
+
def vector(params = {}, &bloc)
|
45
|
+
atome_type = :vector
|
35
46
|
params = atome_common(atome_type, params)
|
36
|
-
#
|
37
|
-
|
47
|
+
# send(params[:type],params, &bloc )
|
38
48
|
Atome.new({ atome_type => params }, &bloc)
|
49
|
+
|
50
|
+
|
39
51
|
end
|
40
52
|
|
41
53
|
end
|
54
|
+
|
55
|
+
|
56
|
+
|
@@ -12,42 +12,88 @@ generator.build_render(:browser_shape) do
|
|
12
12
|
# if @definition
|
13
13
|
# alert "why we never pass here??????"
|
14
14
|
# else
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
15
|
+
@browser_type = :div
|
16
|
+
id_found = @atome[:id]
|
17
|
+
DOM do
|
18
|
+
div(id: id_found).atome
|
19
|
+
end.append_to(BrowserHelper.browser_document[:user_view])
|
20
|
+
@browser_object = BrowserHelper.browser_document[id_found]
|
21
21
|
# end
|
22
22
|
|
23
23
|
end
|
24
24
|
|
25
25
|
generator.build_render(:browser_color) do |_value|
|
26
|
+
puts " @atome[:id] : #{@atome[:id]}"
|
26
27
|
@browser_type = :style
|
27
28
|
# puts "1 - for the id : #{id} the browser type is ::::> #{@browser_type}"
|
28
29
|
id_found = @atome[:id]
|
29
|
-
type_found = @atome[:type]
|
30
|
+
# type_found = @atome[:type]
|
30
31
|
# we remove previous unused style tag
|
31
32
|
BrowserHelper.browser_document[id]&.remove
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
#
|
42
|
-
#
|
43
|
-
#
|
33
|
+
red = @atome[:red]
|
34
|
+
green = @atome[:green]
|
35
|
+
blue = @atome[:blue]
|
36
|
+
alpha = @atome[:alpha]
|
37
|
+
########################### old code ###########################
|
38
|
+
# BrowserHelper.browser_document.head << Browser.DOM("<style atome='#{type_found}'
|
39
|
+
# id='#{id_found}'>.#{id_found}{
|
40
|
+
# poil
|
41
|
+
# //background-color: rgba(#{red_found * 255},#{green_found * 255},#{blue_found * 255},#{alpha_found});
|
42
|
+
# //fill: rgba(#{red_found * 255},#{green_found * 255},#{blue_found * 255},#{alpha_found}),
|
43
|
+
# //stroke: rgba(#{red_found * 255},#{green_found * 255},#{blue_found * 255},#{alpha_found})
|
44
|
+
#
|
45
|
+
# }</style>")
|
46
|
+
|
47
|
+
########################### new code ###########################
|
48
|
+
atomic_style = BrowserHelper.browser_document['#atomic_style']
|
49
|
+
|
50
|
+
# class_content = <<STR
|
51
|
+
# .#{id_found} {
|
52
|
+
# --#{id_found}_r : #{red * 255}
|
53
|
+
# --#{id_found}_g : #{green * 255}
|
54
|
+
# --#{id_found}_b : #{blue * 255}
|
55
|
+
# --#{id_found}_a : #{alpha}
|
56
|
+
# --#{id_found}_col : rgba(var(--#{id_found}_r ),var(--#{id_found}_g ),var(--#{id_found}_b ),var(--#{id_found}_a ))
|
57
|
+
#
|
58
|
+
# background-color: rgba(#{red * 255}, #{green * 255}, #{blue * 255}, #{alpha});
|
59
|
+
# fill: rgba(#{red * 255}, #{green * 255}, #{blue * 255}, #{alpha});
|
60
|
+
# stroke: rgba(#{red * 255}, #{green * 255}, #{blue * 255}, #{alpha});
|
61
|
+
# }
|
62
|
+
# STR
|
63
|
+
|
64
|
+
class_content = <<STR
|
65
|
+
.#{id_found} {
|
66
|
+
--#{id_found}_r : #{red * 255};
|
67
|
+
--#{id_found}_g : #{green * 255};
|
68
|
+
--#{id_found}_b : #{blue * 255};
|
69
|
+
--#{id_found}_a : #{alpha};
|
70
|
+
--#{id_found}_col : rgba(var(--#{id_found}_r ),var(--#{id_found}_g ),var(--#{id_found}_b ),var(--#{id_found}_a ));
|
71
|
+
background-color: var(--#{id_found}_col);
|
72
|
+
fill: var(--#{id_found}_col);
|
73
|
+
stroke: var(--#{id_found}_col);
|
74
|
+
}
|
75
|
+
STR
|
76
|
+
|
77
|
+
if atomic_style
|
78
|
+
if atomic_style.text.include?(".#{id_found}")
|
79
|
+
# if the class exist , update it's content with the new class
|
80
|
+
regex = /(\.#{id_found}\s*{)([\s\S]*?)(})/m
|
81
|
+
atomic_style.text = atomic_style.text.gsub(regex, class_content)
|
82
|
+
else
|
83
|
+
# if the class doesn't exist, add it to the end of the tag <style>
|
84
|
+
atomic_style.text += class_content
|
85
|
+
end
|
86
|
+
end
|
87
|
+
########################### new code end ###########################
|
88
|
+
|
89
|
+
# TODO: use the code below to modify the style tag
|
44
90
|
@browser_object = BrowserHelper.browser_document[id_found]
|
45
91
|
end
|
46
92
|
|
47
93
|
generator.build_render(:browser_shadow) do |_value|
|
48
94
|
@browser_type = :style
|
49
95
|
id_found = @atome[:id]
|
50
|
-
type_found = @atome[:type]
|
96
|
+
# type_found = @atome[:type]
|
51
97
|
# we remove previous unused style tag
|
52
98
|
BrowserHelper.browser_document[id]&.remove
|
53
99
|
red_found = @atome[:red]
|
@@ -58,12 +104,38 @@ generator.build_render(:browser_shadow) do |_value|
|
|
58
104
|
left = @atome[:left]
|
59
105
|
top = @atome[:top]
|
60
106
|
inset = @atome[:direction]
|
107
|
+
############ old code
|
108
|
+
# BrowserHelper.browser_document.head << Browser.DOM("<style atome='#{type_found}'
|
109
|
+
# id='#{id_found}'>.#{id_found}{box-shadow: #{left}px #{top}px #{blur}px #{inset} rgba(#{red_found * 255},
|
110
|
+
# #{green_found * 255},#{blue_found * 255},#{alpha_found})}</style>")
|
111
|
+
# # TODO/ use the code below to modify the style tag
|
112
|
+
# @browser_object = BrowserHelper.browser_document[id_found]
|
113
|
+
|
114
|
+
########## new code
|
115
|
+
atomic_style = BrowserHelper.browser_document['#atomic_style']
|
116
|
+
|
117
|
+
class_content = <<STR
|
118
|
+
.#{id_found} {
|
119
|
+
box-shadow: #{left}px #{top}px #{blur}px #{inset} rgba(#{red_found * 255},#{green_found * 255},#{blue_found * 255},
|
120
|
+
#{alpha_found});
|
121
|
+
filter: drop-shadow(#{left}px #{top}px #{blur}px rgba(#{red_found * 255},#{green_found * 255},#{blue_found * 255},
|
122
|
+
#{alpha_found}));
|
123
|
+
}
|
124
|
+
STR
|
125
|
+
|
126
|
+
if atomic_style
|
127
|
+
if atomic_style.text.include?(".#{id_found}")
|
128
|
+
# if the class exist , update it's content with the new class
|
129
|
+
regex = /(\.#{id_found}\s*{)([\s\S]*?)(})/m
|
130
|
+
atomic_style.text = atomic_style.text.gsub(regex, class_content)
|
131
|
+
else
|
132
|
+
# if the class doesn't exist, add it to the end of the tag <style>
|
133
|
+
atomic_style.text += class_content
|
134
|
+
end
|
135
|
+
end
|
136
|
+
#
|
137
|
+
# @browser_object = BrowserHelper.browser_document[id_found]
|
61
138
|
|
62
|
-
BrowserHelper.browser_document.head << Browser.DOM("<style atome='#{type_found}'
|
63
|
-
id='#{id_found}'>.#{id_found}{box-shadow: #{left}px #{top}px #{blur}px #{inset} rgba(#{red_found * 255},
|
64
|
-
#{green_found * 255},#{blue_found * 255},#{alpha_found})}</style>")
|
65
|
-
# TODO/ use the code below to modify the style tag
|
66
|
-
@browser_object = BrowserHelper.browser_document[id_found]
|
67
139
|
end
|
68
140
|
|
69
141
|
generator.build_render(:browser_image) do |_user_prc|
|
@@ -15,41 +15,40 @@ module BrowserHelper
|
|
15
15
|
html_object.append_to(browser_document[parents])
|
16
16
|
end
|
17
17
|
|
18
|
-
def self.
|
19
|
-
# TODO : Create a class instead of
|
18
|
+
def self.add_class_to_vector(vector_id, color_id)
|
19
|
+
# TODO : Create a class instead of modifying the vector
|
20
20
|
# get the content the <style> tag
|
21
|
-
color_class=self.color.last
|
21
|
+
# color_class=self.color.last
|
22
|
+
# alert color_class
|
22
23
|
# alert color_class.class
|
23
24
|
# content_style = tag_style.inner_html
|
24
25
|
# color_value = content_style[/background-color:\s*([^;}]+)/, 1]
|
25
26
|
`
|
26
27
|
let parser = new DOMParser();
|
27
28
|
var divElement = document.querySelector('#'+#{vector_id});
|
28
|
-
divElement.style.removeProperty('background-color');
|
29
|
-
divElement.style.backgroundColor = 'transparent';
|
29
|
+
// divElement.style.removeProperty('background-color');
|
30
|
+
//divElement.style.backgroundColor = 'transparent';
|
30
31
|
// select the first svg tag inside the div
|
31
32
|
let foundSVG = divElement.querySelector('svg');
|
32
33
|
let elements = foundSVG.getElementsByTagName("path");
|
33
34
|
Array.from(elements).forEach(el => {
|
34
|
-
el.classList.add(#{
|
35
|
+
el.classList.add(#{color_id});
|
35
36
|
});
|
36
37
|
`
|
37
38
|
end
|
38
39
|
|
39
40
|
def self.browser_attach_style(parents, _html_object, atome)
|
40
|
-
# we test if the atome has a
|
41
|
+
# we test if the atome has a definition ( it means hold some vectors information)
|
41
42
|
if grab(parents).atome[:definition]
|
42
|
-
tag_style = $document[atome[:id]]
|
43
|
-
# # get the content the <style> tag
|
44
|
-
# content_style = tag_style.inner_html
|
45
|
-
# extract the color value
|
46
|
-
|
47
|
-
|
43
|
+
# tag_style = $document[atome[:id]]
|
44
|
+
# # # get the content the <style> tag
|
45
|
+
# # content_style = tag_style.inner_html
|
46
|
+
# # extract the color value
|
47
|
+
# alert atome[:id]
|
48
|
+
add_class_to_vector(parents, atome[:id])
|
48
49
|
else
|
49
50
|
browser_document[parents].add_class(atome[:id])
|
50
|
-
|
51
51
|
end
|
52
|
-
|
53
52
|
end
|
54
53
|
|
55
54
|
def self.browser_attached_div(children, _html_object, atome)
|
@@ -62,10 +61,11 @@ divElement.style.backgroundColor = 'transparent';
|
|
62
61
|
|
63
62
|
def self.browser_attached_style(children, _html_object, atome)
|
64
63
|
if atome[:definition]
|
64
|
+
# alert "yes we arrived here :>\n\n=>#{children}, class:\n=>#{children.class} :\n\n=> #{atome} :\n\n=> #{_html_object}<:"
|
65
65
|
children.each do |child|
|
66
|
-
tag_style = $document[child]
|
67
|
-
|
68
|
-
|
66
|
+
# tag_style = $document[child]
|
67
|
+
# alert "(#{atome[:id]}, #{child})"
|
68
|
+
add_class_to_vector(atome[:id], child)
|
69
69
|
# get the content the <style> tag
|
70
70
|
# content_style = tag_style.inner_html
|
71
71
|
# # extract the color value
|
@@ -84,11 +84,10 @@ divElement.style.backgroundColor = 'transparent';
|
|
84
84
|
end
|
85
85
|
|
86
86
|
else
|
87
|
-
# alert
|
88
|
-
browser_document[atome[:id]].add_class(children)
|
87
|
+
# alert "class added : #{children}"
|
88
|
+
# browser_document[atome[:id]].add_class(children)
|
89
89
|
end
|
90
|
-
|
91
|
-
|
90
|
+
browser_document[atome[:id]].add_class(children)
|
92
91
|
end
|
93
92
|
|
94
93
|
def self.value_parse(value)
|
@@ -2,21 +2,79 @@
|
|
2
2
|
|
3
3
|
# for browser rendering
|
4
4
|
module BrowserHelper
|
5
|
-
def self.browser_colorize_color(
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
5
|
+
def self.browser_colorize_color(red, green, blue, alpha, atome)
|
6
|
+
########################### new code ###########################
|
7
|
+
id_found=atome[:id]
|
8
|
+
# color_updated = "rgba(#{red}, #{green}, #{blue}, #{alpha})"
|
9
|
+
new_class_content = <<STR
|
10
|
+
.#{id_found} {
|
11
|
+
--#{id_found}_r : #{red * 255};
|
12
|
+
--#{id_found}_g : #{green * 255};
|
13
|
+
--#{id_found}_b : #{blue * 255};
|
14
|
+
--#{id_found}_a : #{alpha};
|
15
|
+
--#{id_found}_col : rgba(var(--#{id_found}_r ),var(--#{id_found}_g ),var(--#{id_found}_b ),var(--#{id_found}_a ));
|
16
|
+
background-color: var(--#{id_found}_col);
|
17
|
+
fill: var(--#{id_found}_col);
|
18
|
+
stroke: var(--#{id_found}_col);
|
19
|
+
}
|
20
|
+
STR
|
21
|
+
|
22
|
+
atomic_style = BrowserHelper.browser_document['#atomic_style']
|
23
|
+
# atomic_style.text = atomic_style.text.gsub(/\.#{id_found}\s*{.*?}/m, new_class_content)
|
24
|
+
|
25
|
+
regex = /(\.#{id_found}\s*{)([\s\S]*?)(})/m
|
26
|
+
atomic_style.text = atomic_style.text.gsub(regex, new_class_content)
|
27
|
+
|
28
|
+
|
29
|
+
########################### old code ###########################
|
30
|
+
#
|
31
|
+
# puts "the code below may be updated to work with the new class handler :\n\n#{color_updated}\n\n#{atome}"
|
32
|
+
# `
|
33
|
+
# document.getElementById(#{atome[:id]}).sheet.cssRules[0].style.backgroundColor = #{color_updated}
|
34
|
+
# document.getElementById(#{atome[:id]}).sheet.cssRules[0].style.fill = #{color_updated}
|
35
|
+
# document.getElementById(#{atome[:id]}).sheet.cssRules[0].style.stroke = #{color_updated}
|
36
|
+
# `
|
37
|
+
########################### new old end ###########################
|
38
|
+
|
11
39
|
end
|
12
40
|
|
13
|
-
def self.browser_colorize_shadow(
|
41
|
+
def self.browser_colorize_shadow(red, green, blue, alpha, atome)
|
42
|
+
# "new shadow color is : #{color_updated}"
|
43
|
+
# puts "=====> #{color_updated} : #{atome}"
|
44
|
+
# TODO: check if we need to use variable for the color or let it like it is!
|
14
45
|
left = atome[:left]
|
15
46
|
top = atome[:top]
|
16
47
|
blur = atome[:blur]
|
17
48
|
direction = atome[:direction]
|
18
|
-
|
19
|
-
|
49
|
+
|
50
|
+
|
51
|
+
# shadow_updated = "#{left}px #{top}px #{blur}px #{color_updated} #{direction}"
|
52
|
+
# `document.getElementById(#{atome[:id]}).sheet.cssRules[0].style.boxShadow = #{shadow_updated}`
|
53
|
+
|
54
|
+
#new code
|
55
|
+
id_found= atome[:id]
|
56
|
+
class_content = <<STR
|
57
|
+
.#{id_found} {
|
58
|
+
--#{id_found}_r : #{red * 255};
|
59
|
+
--#{id_found}_g : #{green * 255};
|
60
|
+
--#{id_found}_b : #{blue * 255};
|
61
|
+
--#{id_found}_a : #{alpha};
|
62
|
+
--#{id_found}_col : rgba(var(--#{id_found}_r ),var(--#{id_found}_g ),var(--#{id_found}_b ),var(--#{id_found}_a ));
|
63
|
+
|
64
|
+
box-shadow: #{left}px #{top}px #{blur}px var(--#{id_found}_col) #{direction};
|
65
|
+
}
|
66
|
+
STR
|
67
|
+
|
68
|
+
atomic_style = BrowserHelper.browser_document['#atomic_style']
|
69
|
+
# atomic_style.text = atomic_style.text.gsub(/\.#{id_found}\s*{.*?}/m, new_class_content)
|
70
|
+
# puts new_class_content
|
71
|
+
regex = /(\.#{id_found}\s*{)([\s\S]*?)(})/m
|
72
|
+
atomic_style.text = atomic_style.text.gsub(regex, class_content)
|
73
|
+
|
74
|
+
# .view_shadow_17 {
|
75
|
+
# box-shadow: 3px 3px 3px rgba(0,
|
76
|
+
# 0,0,1)
|
77
|
+
# }
|
20
78
|
end
|
21
79
|
|
22
80
|
def self.browser_left_color(_value, _browser_object, _atome)
|
@@ -4,17 +4,17 @@
|
|
4
4
|
module BrowserHelper
|
5
5
|
|
6
6
|
def self.browser_blur_style(_browser_object, value, atome)
|
7
|
-
b_left = "#{atome[:left]}px"
|
8
|
-
b_top = "#{atome[:top]}px"
|
9
|
-
b_blur = "#{atome[:blur] = value}px"
|
10
|
-
b_red = atome[:red] * 255
|
11
|
-
b_green = atome[:green] * 255
|
12
|
-
b_blue = (atome[:blue]) * 255
|
13
|
-
b_direction = atome[:direction]
|
14
|
-
b_alpha = atome[:alpha]
|
7
|
+
# b_left = "#{atome[:left]}px"
|
8
|
+
# b_top = "#{atome[:top]}px"
|
9
|
+
# b_blur = "#{atome[:blur] = value}px"
|
10
|
+
# b_red = atome[:red] * 255
|
11
|
+
# b_green = atome[:green] * 255
|
12
|
+
# b_blue = (atome[:blue]) * 255
|
13
|
+
# b_direction = atome[:direction]
|
14
|
+
# b_alpha = atome[:alpha]
|
15
15
|
|
16
|
-
shadow_updated = "#{b_left} #{b_top} #{b_blur} rgba(#{b_red}, #{b_green}, #{b_blue}, #{b_alpha}) #{b_direction}"
|
17
|
-
`document.getElementById(#{atome[:id]}).sheet.cssRules[0].style.boxShadow = #{shadow_updated}`
|
16
|
+
# shadow_updated = "#{b_left} #{b_top} #{b_blur} rgba(#{b_red}, #{b_green}, #{b_blue}, #{b_alpha}) #{b_direction}"
|
17
|
+
# `document.getElementById(#{atome[:id]}).sheet.cssRules[0].style.boxShadow = #{shadow_updated}`
|
18
18
|
end
|
19
19
|
|
20
20
|
def self.browser_blur_div(browser_object, value, _atome)
|
@@ -12,22 +12,63 @@ module BrowserHelper
|
|
12
12
|
blue = (atome[:blue]) * 255
|
13
13
|
direction = atome[:direction]
|
14
14
|
alpha = atome[:alpha]
|
15
|
+
id_found = atome[:id]
|
16
|
+
real = atome[:real]
|
17
|
+
# `document.getElementById(#{atome[:id]}).sheet.cssRules[0].style.boxShadow = #{shadow_updated}`
|
18
|
+
if real
|
19
|
+
drop_shadow_updated = "drop-shadow(#{ls_left} #{ls_top} #{ls_blur} rgba(#{red}, #{green}, #{blue}, #{alpha}))"
|
20
|
+
class_content = <<STR
|
21
|
+
.#{id_found} {
|
15
22
|
|
16
|
-
|
17
|
-
|
23
|
+
filter: #{drop_shadow_updated};
|
24
|
+
}
|
25
|
+
STR
|
26
|
+
else
|
27
|
+
shadow_updated = "#{ls_left} #{ls_top} #{ls_blur} rgba(#{red}, #{green}, #{blue}, #{alpha}) #{direction}"
|
28
|
+
class_content = <<STR
|
29
|
+
.#{id_found} {
|
30
|
+
box-shadow: #{shadow_updated};
|
31
|
+
}
|
32
|
+
STR
|
33
|
+
end
|
34
|
+
|
35
|
+
atomic_style = BrowserHelper.browser_document['#atomic_style']
|
36
|
+
|
37
|
+
return unless atomic_style
|
38
|
+
|
39
|
+
if atomic_style.text.include?(".#{id_found}")
|
40
|
+
# if the class exist , update it's content with the new class
|
41
|
+
# alert "before :#{atomic_style.text}"
|
42
|
+
regex = /(\.#{id_found}\s*{)([\s\S]*?)(})/m
|
43
|
+
atomic_style.text = atomic_style.text.gsub(regex, class_content)
|
44
|
+
# alert "after :#{atomic_style.text}"
|
45
|
+
else
|
46
|
+
# if the class doesn't exist, add it to the end of the tag <style>
|
47
|
+
atomic_style.text += class_content
|
48
|
+
end
|
49
|
+
|
50
|
+
# alert atomic_style.text
|
18
51
|
end
|
19
52
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
blue = (atome[:blue]) * 255
|
27
|
-
direction = atome[:direction]
|
28
|
-
alpha = atome[:alpha]
|
53
|
+
# .shadow2 {
|
54
|
+
# box-shadow: 3px 9px 9px rgba(0, 0, 0, 1) inset;
|
55
|
+
# }
|
56
|
+
# .shadow2 {
|
57
|
+
# box-shadow: 3px 9px 9px rgba(0, 0, 0, 1) inset)
|
58
|
+
# }
|
29
59
|
|
30
|
-
|
31
|
-
|
60
|
+
def self.browser_top_shadow(value, _browser_object, atome)
|
61
|
+
# rs_left = "#{atome[:left]}px"
|
62
|
+
# rs_top = "#{atome[:top] = value}px"
|
63
|
+
# rs_blur = "#{atome[:blur]}px"
|
64
|
+
# red = atome[:red] * 255
|
65
|
+
# green = atome[:green] * 255
|
66
|
+
# blue = (atome[:blue]) * 255
|
67
|
+
# direction = atome[:direction]
|
68
|
+
# alpha = atome[:alpha]
|
69
|
+
#
|
70
|
+
# shadow_updated = "#{rs_left}px #{rs_top}px #{rs_blur}px rgba(#{red}, #{green}, #{blue}, #{alpha}) #{direction}"
|
71
|
+
# `document.getElementById(#{atome[:id]}).sheet.cssRules[0].style.boxShadow = #{shadow_updated}`
|
72
|
+
#
|
32
73
|
end
|
33
74
|
end
|
@@ -2,20 +2,19 @@
|
|
2
2
|
|
3
3
|
generator = Genesis.generator
|
4
4
|
|
5
|
-
generator.build_render(:browser_id) do |params|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
end
|
5
|
+
# generator.build_render(:browser_id) do |params|
|
6
|
+
# if @browser_type == :style
|
7
|
+
# prev_content = @browser_object.inner_html
|
8
|
+
# new_content = prev_content.sub(@browser_object.id, params)
|
9
|
+
# @browser_object.inner_html = new_content
|
10
|
+
# end
|
11
|
+
# browser_object.id = params if @atome[:id] != params
|
12
|
+
# end
|
13
13
|
|
14
14
|
generator.build_render(:browser_type) do |params|
|
15
15
|
send("browser_#{params}", user_proc)
|
16
16
|
end
|
17
17
|
|
18
|
-
|
19
18
|
generator.build_render(:browser_attach) do |parents_found|
|
20
19
|
# puts "parents_found : #{parents_found}, #{parents_found.class}"
|
21
20
|
parents_found.each do |parent_found|
|
@@ -26,7 +25,8 @@ end
|
|
26
25
|
|
27
26
|
generator.build_render(:browser_attached) do |children_found|
|
28
27
|
children_found.each do |child_found|
|
29
|
-
# puts ">>>>> modeled: browser_type #{@browser_type}
|
28
|
+
# puts ">>>>> modeled: browser_type #{@browser_type} parents_fo
|
29
|
+
# und #{children_found} , @browser_object, #{@browser_object}, self : #{self.id}"
|
30
30
|
children_browser_type = grab(child_found).instance_variable_get('@browser_type')
|
31
31
|
BrowserHelper.send("browser_attached_#{children_browser_type}", children_found, @browser_object, @atome)
|
32
32
|
end
|
@@ -38,6 +38,21 @@ generator.build_render(:browser_detached) do |values, _user_proc|
|
|
38
38
|
value = value.value if value.instance_of? Atome
|
39
39
|
if grab(value).instance_variable_get('@browser_type') == :style
|
40
40
|
@browser_object.remove_class(value)
|
41
|
+
if definition
|
42
|
+
`
|
43
|
+
let parser = new DOMParser();
|
44
|
+
var divElement = document.querySelector('#'+#{self.id});
|
45
|
+
// divElement.style.removeProperty('background-color');
|
46
|
+
//divElement.style.backgroundColor = 'transparent';
|
47
|
+
// select the first svg tag inside the div
|
48
|
+
let foundSVG = divElement.querySelector('svg');
|
49
|
+
let elements = foundSVG.getElementsByTagName("path");
|
50
|
+
Array.from(elements).forEach(el => {
|
51
|
+
el.classList.remove(#{value});
|
52
|
+
});
|
53
|
+
`
|
54
|
+
end
|
55
|
+
|
41
56
|
else
|
42
57
|
BrowserHelper.browser_document[value]&.remove
|
43
58
|
end
|
@@ -3,46 +3,46 @@
|
|
3
3
|
generator = Genesis.generator
|
4
4
|
|
5
5
|
generator.build_render(:red) do |value|
|
6
|
-
red = (
|
7
|
-
green = @atome[:green]
|
8
|
-
blue = @atome[:blue]
|
6
|
+
red = (@atome[:red] = value)
|
7
|
+
green = @atome[:green]
|
8
|
+
blue = @atome[:blue]
|
9
9
|
alpha = @atome[:alpha]
|
10
|
-
color_updated = "rgba(#{red}, #{green}, #{blue}, #{alpha})"
|
11
|
-
BrowserHelper.send("browser_colorize_#{@atome[:type]}",
|
10
|
+
# color_updated = "rgba(#{red}, #{green}, #{blue}, #{alpha})"
|
11
|
+
BrowserHelper.send("browser_colorize_#{@atome[:type]}", red, green, blue, alpha, @atome)
|
12
12
|
# we return self to allow syntax of the type : a.color(:black).red(1).green(0.3)
|
13
13
|
self
|
14
14
|
end
|
15
15
|
|
16
16
|
generator.build_render(:green) do |value|
|
17
17
|
# we return self to allow syntax of the type : a.color(:black).red(1).green(0.3)
|
18
|
-
red = @atome[:red]
|
19
|
-
green = (@atome[:green] = value)
|
20
|
-
blue = @atome[:blue]
|
18
|
+
red = @atome[:red]
|
19
|
+
green = (@atome[:green] = value)
|
20
|
+
blue = @atome[:blue]
|
21
21
|
alpha = @atome[:alpha]
|
22
|
-
color_updated = "rgba(#{red}, #{green}, #{blue}, #{alpha})"
|
23
|
-
BrowserHelper.send("browser_colorize_#{@atome[:type]}",
|
22
|
+
# color_updated = "rgba(#{red}, #{green}, #{blue}, #{alpha})"
|
23
|
+
BrowserHelper.send("browser_colorize_#{@atome[:type]}", red, green, blue, alpha, @atome)
|
24
24
|
# we return self to allow syntax of the type : a.color(:black).red(1).green(0.3)
|
25
25
|
self
|
26
26
|
end
|
27
27
|
|
28
28
|
generator.build_render(:blue) do |value|
|
29
|
-
red = @atome[:red]
|
30
|
-
green = @atome[:green]
|
31
|
-
blue = (@atome[:blue] = value)
|
29
|
+
red = @atome[:red]
|
30
|
+
green = @atome[:green]
|
31
|
+
blue = (@atome[:blue] = value)
|
32
32
|
alpha = @atome[:alpha]
|
33
|
-
color_updated = "rgba(#{red}, #{green}, #{blue}, #{alpha})"
|
34
|
-
BrowserHelper.send("browser_colorize_#{@atome[:type]}",
|
33
|
+
# color_updated = "rgba(#{red}, #{green}, #{blue}, #{alpha})"
|
34
|
+
BrowserHelper.send("browser_colorize_#{@atome[:type]}", red, green, blue, alpha, @atome)
|
35
35
|
# we return self to allow syntax of the type : a.color(:black).red(1).green(0.3)
|
36
36
|
self
|
37
37
|
end
|
38
38
|
|
39
39
|
generator.build_render(:alpha) do |value|
|
40
|
-
red = @atome[:red]
|
41
|
-
green = @atome[:green]
|
42
|
-
blue = @atome[:blue]
|
40
|
+
red = @atome[:red]
|
41
|
+
green = @atome[:green]
|
42
|
+
blue = @atome[:blue]
|
43
43
|
alpha = (@atome[:alpha] = value)
|
44
|
-
color_updated = "rgba(#{red}, #{green}, #{blue}, #{alpha})"
|
45
|
-
BrowserHelper.send("browser_colorize_#{@atome[:type]}",
|
44
|
+
# color_updated = "rgba(#{red}, #{green}, #{blue}, #{alpha})"
|
45
|
+
BrowserHelper.send("browser_colorize_#{@atome[:type]}", red, green, blue, alpha, @atome)
|
46
46
|
# we return self to allow syntax of the type : a.color(:black).red(1).green(0.3)
|
47
47
|
self
|
48
48
|
end
|
@@ -89,7 +89,7 @@ new ({ browser: :opacity }) do |value|
|
|
89
89
|
end
|
90
90
|
|
91
91
|
new ({ browser: :definition }) do |value|
|
92
|
-
target=id
|
92
|
+
target = id
|
93
93
|
`
|
94
94
|
|
95
95
|
var divElement = document.querySelector('#'+#{target});;
|
@@ -106,6 +106,8 @@ if (svgElement) {
|
|
106
106
|
|
107
107
|
let svg_content='<svg style="width: 1em; height: 1em;vertical-align: middle;fill: currentColor;overflow: hidden;" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg">'+#{value}+'</svg>'
|
108
108
|
let svgContainer = document.getElementById(#{target});
|
109
|
+
svgContainer.style.removeProperty('background-color');
|
110
|
+
svgContainer.style.backgroundColor = 'transparent';
|
109
111
|
let parser = new DOMParser();
|
110
112
|
let svgDoc = parser.parseFromString(svg_content, "image/svg+xml");
|
111
113
|
let importedSVG = svgDoc.getElementsByTagName("svg")[0];
|
@@ -116,4 +118,4 @@ if (svgElement) {
|
|
116
118
|
svgContainer.appendChild(importedSVG);
|
117
119
|
|
118
120
|
`
|
119
|
-
end
|
121
|
+
end
|
@@ -1,31 +1,32 @@
|
|
1
|
-
def add_new_class(class_name, tag_name, tag_content)
|
1
|
+
# def add_new_class(class_name, tag_name, tag_content)
|
2
|
+
#
|
3
|
+
# `
|
4
|
+
# var styleTag = document.getElementById("atomic_style");
|
5
|
+
# styleTag.innerHTML += "\n."+#{class_name}+'{\n '+#{tag_name}+': '+#{tag_content}+';\n}\n\n\n\n';
|
6
|
+
# `
|
7
|
+
# end
|
8
|
+
#
|
9
|
+
# add_new_class('new_class', 'background-color','yellow')
|
10
|
+
# add_new_class('other_class', 'color','red')
|
2
11
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
12
|
+
# def update_css_tag(tag_name, var_name, value)
|
13
|
+
# alert "this code doesn't work with chrome"
|
14
|
+
# `
|
15
|
+
# var rules = null;
|
16
|
+
# var cssRules = document.styleSheets[0].cssRules;
|
17
|
+
# for (var i = 0; i < cssRules.length; i++) {
|
18
|
+
# var rule = cssRules[i];
|
19
|
+
# if (rule.selectorText === '.'+#{tag_name}) {
|
20
|
+
# rules = rule;
|
21
|
+
# break;
|
22
|
+
# }
|
23
|
+
# }
|
24
|
+
#
|
25
|
+
# if (rules) {
|
26
|
+
#
|
27
|
+
# rules.style.setProperty(#{var_name}, #{value});
|
28
|
+
# }
|
29
|
+
# `
|
30
|
+
# end
|
8
31
|
|
9
|
-
|
10
|
-
add_new_class('other_class', 'color','red')
|
11
|
-
|
12
|
-
def update_css_tag(tag_name, var_name, value)
|
13
|
-
`
|
14
|
-
var rules = null;
|
15
|
-
var cssRules = document.styleSheets[0].cssRules;
|
16
|
-
for (var i = 0; i < cssRules.length; i++) {
|
17
|
-
var rule = cssRules[i];
|
18
|
-
if (rule.selectorText === '.'+#{tag_name}) {
|
19
|
-
rules = rule;
|
20
|
-
break;
|
21
|
-
}
|
22
|
-
}
|
23
|
-
|
24
|
-
if (rules) {
|
25
|
-
|
26
|
-
rules.style.setProperty(#{var_name}, #{value});
|
27
|
-
}
|
28
|
-
`
|
29
|
-
end
|
30
|
-
|
31
|
-
update_css_tag('other_class', '--end-color', 'blue')
|
32
|
+
# update_css_tag('other_class', '--end-color', 'blue')
|
data/lib/atome/version.rb
CHANGED
@@ -1,37 +1,84 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
# TODO : make this work : b.shadow({color: :red})
|
4
|
+
|
3
5
|
b = box({ id: :the_box, left: 99, top: 99 })
|
4
6
|
|
5
7
|
|
6
8
|
|
7
9
|
|
8
|
-
s = b.shadow({ renderers: [:browser], id: :shadow2, type: :shadow,
|
9
|
-
left: 3, top: 9, blur:
|
10
|
+
s = b.shadow({ renderers: [:browser], id: :shadow2, type: :shadow,
|
11
|
+
left: 3, top: 9, blur: 9, direction: :inset,
|
10
12
|
red: 0, green: 0, blue: 0, alpha: 1
|
11
13
|
})
|
12
14
|
|
15
|
+
s.left(16)
|
16
|
+
|
17
|
+
# s.color(:red)
|
18
|
+
# wait 1 do
|
19
|
+
# s.attach([:the_box])
|
20
|
+
# # or
|
21
|
+
# # b.children([:shadow2])
|
22
|
+
# wait 1 do
|
23
|
+
# s.blur(9)
|
24
|
+
# wait 1 do
|
25
|
+
# wait 2 do
|
26
|
+
# s.direction('')
|
27
|
+
# s.green(0.007)
|
28
|
+
# s.left(14)
|
29
|
+
# wait 1 do
|
30
|
+
# s.delete(true)
|
31
|
+
# end
|
32
|
+
# end
|
33
|
+
# s.left(44)
|
34
|
+
# s.green(0.7)
|
35
|
+
# end
|
36
|
+
# end
|
37
|
+
# end
|
38
|
+
#
|
39
|
+
# wait 3 do
|
40
|
+
# b.shadow({ blur: 33 })
|
41
|
+
# wait 2 do
|
42
|
+
# b.shadow({ blur: 3 })
|
43
|
+
# end
|
44
|
+
# end
|
45
|
+
|
46
|
+
wait 2 do
|
47
|
+
s.red(1)
|
48
|
+
end
|
49
|
+
|
50
|
+
wait 4 do
|
13
51
|
|
14
|
-
|
15
|
-
|
16
|
-
#
|
17
|
-
# b.
|
18
|
-
wait 1 do
|
19
|
-
s.blur(9)
|
20
|
-
wait 1 do
|
21
|
-
wait 2 do
|
22
|
-
s.direction('')
|
23
|
-
s.green(0)
|
24
|
-
s.left(14)
|
25
|
-
wait 1 do
|
26
|
-
s.delete(true)
|
27
|
-
end
|
28
|
-
end
|
29
|
-
s.left(44)
|
30
|
-
s.green(0.7)
|
31
|
-
end
|
32
|
-
end
|
52
|
+
puts "-----------> now!!!!!!"
|
53
|
+
b.shadow({ green: 1 })
|
54
|
+
# c2=color(:red)
|
55
|
+
# b.shadow.attach(c2.id)
|
33
56
|
end
|
34
57
|
|
35
|
-
|
36
|
-
|
58
|
+
|
59
|
+
edition = <<~STR
|
60
|
+
<path id="p1" d="M257.7 752c2 0 4-0.2 6-0.5L431.9 722c2-0.4 3.9-1.3 5.3-2.8l423.9-423.9c3.9-3.9 3.9-10.2 0-14.1L694.9 114.9c-1.9-1.9-4.4-2.9-7.1-2.9s-5.2 1-7.1 2.9L256.8 538.8c-1.5 1.5-2.4 3.3-2.8 5.3l-29.5 168.2c-1.9 11.1 1.5 21.9 9.4 29.8 6.6 6.4 14.9 9.9 23.8 9.9z m67.4-174.4L687.8 215l73.3 73.3-362.7 362.6-88.9 15.7 15.6-89zM880 836H144c-17.7 0-32 14.3-32 32v36c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-36c0-17.7-14.3-32-32-32z"/>
|
61
|
+
STR
|
62
|
+
v=vector({left: 300, width: 300, height: 300, definition: edition})
|
63
|
+
# v.color(:red)
|
64
|
+
v.shadow({ renderers: [:browser], id: :shadow7, type: :shadow,
|
65
|
+
left: 3, top: 9, blur: 9, direction: :inset,
|
66
|
+
red: 0, green: 0, blue: 0, alpha: 1
|
67
|
+
})
|
68
|
+
|
69
|
+
v.shadow({ renderers: [:browser], id: :shadow8, type: :shadow, real: true,
|
70
|
+
left: 3, top: 9, blur: 9, direction: :inset,
|
71
|
+
red: 0, green: 0, blue: 0, alpha: 1
|
72
|
+
})
|
73
|
+
b=box({top: 300})
|
74
|
+
|
75
|
+
wait 4 do
|
76
|
+
b.attached(:shadow7)
|
77
|
+
v.attached(:shadow7)
|
78
|
+
end
|
79
|
+
|
80
|
+
|
81
|
+
wait 6 do
|
82
|
+
b.attached(:shadow8)
|
83
|
+
v.attached(:shadow8)
|
37
84
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: atome
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.4.1.
|
4
|
+
version: 0.5.4.1.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jean-Eric Godard
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-05-
|
11
|
+
date: 2023-05-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: arduino_firmata
|