atome 0.5.1.4 → 0.5.1.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +4 -0
- data/lib/atome/atome.rb +7 -6
- data/lib/atome/genesis/generators/event.rb +11 -0
- data/lib/atome/genesis/generators/identity.rb +0 -2
- data/lib/atome/helpers/callbacks.rb +68 -0
- data/lib/atome/helpers/essentials.rb +5 -3
- data/lib/atome/presets/atome.rb +1 -1
- data/lib/atome/renderers/browser/atome.rb +1 -12
- data/lib/atome/renderers/browser/browser.rb +12 -210
- data/lib/atome/renderers/browser/event.rb +30 -3
- data/lib/atome/renderers/browser/helpers/animation_helper.rb +0 -0
- data/lib/atome/renderers/browser/helpers/browser_helper.rb +18 -0
- data/lib/atome/renderers/browser/helpers/color_helper.rb +35 -0
- data/lib/atome/renderers/browser/helpers/drag_helper.rb +39 -0
- data/lib/atome/renderers/browser/helpers/effect_helper.rb +22 -0
- data/lib/atome/renderers/browser/helpers/image_helper.rb +27 -0
- data/lib/atome/renderers/browser/helpers/shadow_helper.rb +33 -0
- data/lib/atome/renderers/browser/helpers/shape_helper.rb +22 -0
- data/lib/atome/renderers/browser/helpers/text_helper.rb +26 -0
- data/lib/atome/renderers/browser/helpers/video_helper.rb +43 -0
- data/lib/atome/renderers/browser/helpers/web_helper.rb +30 -0
- data/lib/atome/renderers/browser/utility.rb +3 -3
- data/lib/atome/renderers/html/html.rb +1 -1
- data/lib/atome/version.rb +1 -1
- data/lib/atome.rb +0 -1
- data/sig/atome.rbs +1 -0
- data/vendor/assets/build/css/style.css +2 -1
- data/vendor/assets/build/index.html +8 -1
- data/vendor/assets/build/js/atome/atome.js +150 -145
- data/vendor/assets/build/js/atome/atome_helpers/atome_animate.js +65 -0
- data/vendor/assets/build/js/atome/atome_helpers/atome_drag.js +85 -0
- data/vendor/assets/build/js/atome/atome_helpers/atome_file.js +7 -0
- data/vendor/assets/build/js/atome/atome_helpers/atome_sort.js +20 -0
- data/vendor/assets/build/js/atome/atome_helpers/atome_time.js +10 -0
- data/vendor/assets/build/js/atome/atome_helpers/atome_video.js +12 -0
- data/vendor/assets/build/js/third_parties/popmotion.min.js +1 -1
- data/vendor/assets/build/js/third_parties/sortable.min.js +2 -0
- data/vendor/assets/build/medias/rubies/examples/_2_solve.rb +23 -0
- data/vendor/assets/build/medias/rubies/examples/_animation.rb +46 -0
- data/vendor/assets/build/medias/rubies/examples/at.rb +17 -0
- data/vendor/assets/build/medias/rubies/examples/drag.rb +38 -0
- data/vendor/assets/build/medias/rubies/examples/mute.rb +22 -0
- data/vendor/assets/build/medias/rubies/examples/on.rb +7 -1
- data/vendor/assets/build/medias/rubies/examples/{parent.rb → parents.rb} +6 -6
- data/vendor/assets/build/medias/rubies/examples/pause.rb +15 -0
- data/vendor/assets/build/medias/rubies/examples/play.rb +15 -0
- data/vendor/assets/build/medias/rubies/examples/schedule.rb +2 -2
- data/vendor/assets/build/medias/rubies/examples/sort.rb +16 -0
- data/vendor/assets/build/medias/rubies/examples/time.rb +14 -0
- metadata +28 -5
- data/lib/atome/processors/utilities.rb +0 -10
- data/vendor/assets/build/medias/rubies/examples/_drag.rb +0 -44
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# for browser rendering
|
4
|
+
module BrowserHelper
|
5
|
+
# image
|
6
|
+
def self.browser_left_image(value, browser_object, _atome)
|
7
|
+
browser_object.style[:left] = "#{value}px"
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.browser_right_image(value, browser_object, _atome)
|
11
|
+
browser_object.style[:right] = "#{value}px"
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.browser_top_image(value, browser_object, _atome)
|
15
|
+
browser_object.style[:top] = "#{value}px"
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.browser_bottom_image(value, browser_object, _atome)
|
19
|
+
browser_object.style[:bottom] = "#{value}px"
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.browser_path_image(value, browser_object, _atome)
|
23
|
+
browser_object[:src] = value
|
24
|
+
end
|
25
|
+
|
26
|
+
|
27
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# for browser rendering
|
4
|
+
module BrowserHelper
|
5
|
+
# shadow
|
6
|
+
def self.browser_left_shadow(value, _browser_object, atome)
|
7
|
+
ls_left = "#{atome[:left] = value}px"
|
8
|
+
ls_top = "#{atome[:top]}px"
|
9
|
+
ls_blur = "#{atome[:blur]}px"
|
10
|
+
red = atome[:red] * 255
|
11
|
+
green = atome[:green] * 255
|
12
|
+
blue = (atome[:blue]) * 255
|
13
|
+
direction = atome[:direction]
|
14
|
+
alpha = atome[:alpha]
|
15
|
+
|
16
|
+
shadow_updated = "#{ls_left} #{ls_top} #{ls_blur} rgba(#{red}, #{green}, #{blue}, #{alpha}) #{direction}"
|
17
|
+
`document.getElementById(#{atome[:id]}).sheet.cssRules[0].style.boxShadow = #{shadow_updated}`
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.browser_top_shadow(value, _browser_object, atome)
|
21
|
+
rs_left = "#{atome[:left]}px"
|
22
|
+
rs_top = "#{atome[:top] = value}px"
|
23
|
+
rs_blur = "#{atome[:blur]}px"
|
24
|
+
red = atome[:red] * 255
|
25
|
+
green = atome[:green] * 255
|
26
|
+
blue = (atome[:blue]) * 255
|
27
|
+
direction = atome[:direction]
|
28
|
+
alpha = atome[:alpha]
|
29
|
+
|
30
|
+
shadow_updated = "#{rs_left}px #{rs_top}px #{rs_blur}px rgba(#{red}, #{green}, #{blue}, #{alpha}) #{direction}"
|
31
|
+
`document.getElementById(#{atome[:id]}).sheet.cssRules[0].style.boxShadow = #{shadow_updated}`
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# for browser rendering
|
4
|
+
module BrowserHelper
|
5
|
+
|
6
|
+
def self.browser_left_shape(value, browser_object, _atome)
|
7
|
+
browser_object.style[:left] = "#{value}px"
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.browser_right_shape(value, browser_object, _atome)
|
11
|
+
browser_object.style[:right] = "#{value}px"
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.browser_top_shape(value, browser_object, _atome)
|
15
|
+
browser_object.style[:top] = "#{value}px"
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.browser_bottom_shape(value, browser_object, _atome)
|
19
|
+
browser_object.style[:bottom] = "#{value}px"
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# for browser rendering
|
4
|
+
module BrowserHelper
|
5
|
+
# text
|
6
|
+
def self.browser_left_text(value, browser_object, _atome)
|
7
|
+
browser_object.style[:left] = "#{value}px"
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.browser_right_text(value, browser_object, _atome)
|
11
|
+
browser_object.style[:right] = "#{value}px"
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.browser_top_text(value, browser_object, _atome)
|
15
|
+
browser_object.style[:top] = "#{value}px"
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.browser_bottom_text(value, browser_object, _atome)
|
19
|
+
browser_object.style[:bottom] = "#{value}px"
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.browser_data_text(value,atome_send)
|
23
|
+
atome_send.browser_object.text = value
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# for browser rendering
|
4
|
+
module BrowserHelper
|
5
|
+
# video
|
6
|
+
def self.browser_left_video(value, browser_object, _atome)
|
7
|
+
browser_object.style[:left] = "#{value}px"
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.browser_right_videob(value, browser_object, _atome)
|
11
|
+
browser_object.style[:right] = "#{value}px"
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.browser_top_video(value, browser_object, _atome)
|
15
|
+
browser_object.style[:top] = "#{value}px"
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.browser_bottom_video(value, browser_object, _atome)
|
19
|
+
browser_object.style[:bottom] = "#{value}px"
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.browser_path_video(value, browser_object, _atome)
|
23
|
+
browser_object[:src] = value
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.browser_play_video(_value, browser_object_found, atome_hash, atome_object, proc)
|
27
|
+
browser_object_found.play
|
28
|
+
# TODO : change timeupdate for when possible requestVideoFrameCallback
|
29
|
+
# (opal-browser/opal/browser/event.rb line 36)
|
30
|
+
video_callback = atome_hash[:code] # this is the video callback not the play callback
|
31
|
+
play_callback = proc # this is the video callback not the play callback
|
32
|
+
browser_object_found.on(:timeupdate) do |e|
|
33
|
+
current_time = browser_object_found.currentTime
|
34
|
+
# we update the time particle
|
35
|
+
atome_object.time_callback(current_time)
|
36
|
+
e.prevent # Prevent the default action (eg. form submission)
|
37
|
+
# You can also use `e.stop` to stop propagating the event to other handlers.
|
38
|
+
|
39
|
+
atome_object.instance_exec(current_time, &video_callback) if video_callback.is_a?(Proc)
|
40
|
+
atome_object.instance_exec(current_time, &play_callback) if play_callback.is_a?(Proc)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# for browser rendering
|
4
|
+
module BrowserHelper
|
5
|
+
# web
|
6
|
+
def self.browser_left_web(value, browser_object, _atome)
|
7
|
+
browser_object.style[:left] = "#{value}px"
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.browser_right_web(value, browser_object, _atome)
|
11
|
+
browser_object.style[:right] = "#{value}px"
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.browser_top_web(value, browser_object, _atome)
|
15
|
+
browser_object.style[:top] = "#{value}px"
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.browser_bottom_web(value, browser_object, _atome)
|
19
|
+
browser_object.style[:bottom] = "#{value}px"
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.browser_path_web(value, browser_object, _atome)
|
23
|
+
browser_object[:src] = value
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.browser_attach_web(parents, html_object, _atome)
|
27
|
+
html_object.append_to(browser_document[parents])
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
@@ -21,7 +21,7 @@ end
|
|
21
21
|
generator.build_render_method(:browser_data) do |data|
|
22
22
|
# according to the type we send the data to different operator
|
23
23
|
type_found = @atome[:type]
|
24
|
-
send("browser_data_#{type_found}", data)
|
24
|
+
BrowserHelper.send("browser_data_#{type_found}", data, self)
|
25
25
|
end
|
26
26
|
|
27
27
|
generator.build_render_method(:browser_schedule) do |format_date, proc|
|
@@ -31,9 +31,9 @@ generator.build_render_method(:browser_schedule) do |format_date, proc|
|
|
31
31
|
hours = format_date[3]
|
32
32
|
minutes = format_date[4]
|
33
33
|
seconds = format_date[5]
|
34
|
-
|
34
|
+
AtomeJS.JS.schedule(years, months, days, hours,minutes, seconds, self, proc)
|
35
35
|
end
|
36
36
|
|
37
37
|
generator.build_render_method(:browser_reader) do |file, proc|
|
38
|
-
|
38
|
+
AtomeJS.JS.reader(file, self, proc)
|
39
39
|
end
|
data/lib/atome/version.rb
CHANGED
data/lib/atome.rb
CHANGED
@@ -9,7 +9,6 @@ require 'atome/helpers/essentials'
|
|
9
9
|
require 'atome/renderers/renderer'
|
10
10
|
require 'atome/helpers/color_helper/color'
|
11
11
|
require 'atome/atome'
|
12
|
-
require 'atome/processors/utilities'
|
13
12
|
require 'atome/helpers/utilities'
|
14
13
|
require 'atome/helpers/callbacks'
|
15
14
|
require 'atome/genesis/generators/atome'
|
data/sig/atome.rbs
CHANGED
@@ -8,9 +8,10 @@
|
|
8
8
|
<link type="text/css" rel="stylesheet" href="css/style.css">
|
9
9
|
<script type="text/javascript" src="js/third_parties/interact.min.js"></script>
|
10
10
|
<script type="text/javascript" src="js/third_parties/popmotion.min.js"></script>
|
11
|
+
<script type="text/javascript" src="js/third_parties/sortable.min.js"></script>
|
11
12
|
<script type="text/javascript" src="js/third_parties/sha256.min.js"></script>
|
12
13
|
<script type="text/javascript" src="js/third_parties/ping.min.js"></script>
|
13
|
-
<script src='js/third_parties/w3color.js'></script
|
14
|
+
<!-- <script src='js/third_parties/w3color.js'></script>-->
|
14
15
|
<script src='js/opal/opal.js'></script>
|
15
16
|
<script src='js/opal/opal_browser.js'></script>
|
16
17
|
<!-- TODO: we line below is commented when using stand alone mode and loaded on demand when using server mode-->
|
@@ -18,6 +19,12 @@
|
|
18
19
|
<!-- <script type="text/javascript" src="js/third_parties/three.min.js"></script>-->
|
19
20
|
<!-- <script src='js/opal/opal_parser.js'></script>-->
|
20
21
|
<script src='js/aui.js'></script>
|
22
|
+
<script src='js/atome/atome_helpers/atome_animate.js' defer></script>
|
23
|
+
<script src='js/atome/atome_helpers/atome_drag.js' defer></script>
|
24
|
+
<script src='js/atome/atome_helpers/atome_file.js' defer></script>
|
25
|
+
<script src='js/atome/atome_helpers/atome_sort.js' defer></script>
|
26
|
+
<script src='js/atome/atome_helpers/atome_time.js' defer></script>
|
27
|
+
<script src='js/atome/atome_helpers/atome_video.js' defer></script>
|
21
28
|
<script src='js/atome/atome.js' defer></script>
|
22
29
|
<script src='js/atome/kernel.js' defer></script>
|
23
30
|
<script src='js/opal/atome_opal_extensions.js'></script>
|
@@ -1,155 +1,160 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
//
|
1
|
+
const atomeJS = Object.assign(atomeAnimate,atomeDrag,atomeFile,atomeSort, atomeTime, atomeVideo);
|
2
|
+
|
3
|
+
// // class AtomeDrag {
|
4
|
+
// // constructor() {
|
5
|
+
// // }
|
6
|
+
// //
|
7
|
+
// // drag(atome_drag_id) {
|
8
|
+
// // // target elements with the "draggable" class
|
9
|
+
// // self.current_obj = Opal.Utilities.$grab(atome_drag_id)
|
10
|
+
// // interact('.'+atome_drag_id)
|
11
|
+
// // .draggable({
|
12
|
+
// // // enable inertial throwing
|
13
|
+
// // startAxis: 'x',
|
14
|
+
// // lockAxis: 'x',
|
15
|
+
// // // lockAxis: ''+lock_axis,
|
16
|
+
// // inertia: true,
|
17
|
+
// // // keep the element within the area of it's parent
|
18
|
+
// // modifiers: [
|
19
|
+
// // interact.modifiers.restrictRect({
|
20
|
+
// // restriction: 'parent',
|
21
|
+
// // endOnly: true
|
22
|
+
// // })
|
23
|
+
// // ],
|
24
|
+
// // // enable autoScroll
|
25
|
+
// // autoScroll: true,
|
26
|
+
// //
|
27
|
+
// // listeners: {
|
28
|
+
// // // call this function on every dragmove event
|
29
|
+
// //
|
30
|
+
// // move: dragMoveListener,
|
31
|
+
// // start(event) {
|
32
|
+
// // //TODO: optimise this passing the proc to the drag callback
|
33
|
+
// // // lets get the current atome Object
|
34
|
+
// // // self.current_obj = Opal.Utilities.$grab(atome_drag_id)
|
35
|
+
// // // now get the grab proc
|
36
|
+
// // self.proc_meth = current_obj.bloc
|
37
|
+
// // },
|
38
|
+
// // // call this function on every dragend event
|
39
|
+
// // end(event) {
|
40
|
+
// // }
|
41
|
+
// // }
|
42
|
+
// // })
|
43
|
+
// //
|
44
|
+
// // function dragMoveListener(event) {
|
45
|
+
// // const target = event.target
|
46
|
+
// // // the code below can be conditioned to receive the drag event without moving the object
|
47
|
+
// // // keep the dragged position in the data-x/data-y attributes
|
48
|
+
// // const x = (parseFloat(target.getAttribute('data-x')) || 0) + event.dx;
|
49
|
+
// // const y = (parseFloat(target.getAttribute('data-y')) || 0) + event.dy
|
50
|
+
// // // translate the element
|
51
|
+
// // target.style.transform = 'translate(' + x + 'px, ' + y + 'px)'
|
52
|
+
// // // update the position attributes
|
53
|
+
// // target.setAttribute('data-x', x)
|
54
|
+
// // target.setAttribute('data-y', y)
|
55
|
+
// // // CallBack here
|
56
|
+
// // self.current_obj.$dragCallback(event.pageX, event.pageY, event.rect.left, event.rect.top, self.current_obj, self.proc_meth);
|
57
|
+
// // }
|
58
|
+
// // }
|
59
|
+
// //
|
60
|
+
// // }
|
61
|
+
//
|
62
|
+
// // Usage:
|
63
|
+
// // let atomeDrag = new AtomeDrag();
|
64
|
+
// // atomeDrag.drag('atome_id', 'options');
|
65
|
+
// // const Atomeanimation = {}
|
66
|
+
//
|
67
|
+
//
|
68
|
+
//
|
69
|
+
// // TODO: put in a class
|
70
|
+
//
|
4
71
|
//
|
5
|
-
//
|
6
|
-
//
|
7
|
-
//
|
8
|
-
//
|
9
|
-
//
|
10
|
-
//
|
11
|
-
//
|
12
|
-
//
|
13
|
-
//
|
14
|
-
//
|
15
|
-
//
|
16
|
-
//
|
17
|
-
//
|
18
|
-
//
|
19
|
-
//
|
20
|
-
//
|
21
|
-
//
|
22
|
-
//
|
23
|
-
//
|
24
|
-
//
|
25
|
-
//
|
26
|
-
//
|
27
|
-
//
|
28
|
-
// move: dragMoveListener,
|
29
|
-
// start(event) {
|
30
|
-
// //TODO: optimise this passing the proc to the drag callback
|
31
|
-
// // lets get the current atome Object
|
32
|
-
// // self.current_obj = Opal.Utilities.$grab(atome_drag_id)
|
33
|
-
// // now get the grab proc
|
34
|
-
// self.proc_meth = current_obj.bloc
|
35
|
-
// },
|
36
|
-
// // call this function on every dragend event
|
37
|
-
// end(event) {
|
38
|
-
// }
|
39
|
-
// }
|
40
|
-
// })
|
41
|
-
//
|
42
|
-
// function dragMoveListener(event) {
|
43
|
-
// const target = event.target
|
44
|
-
// // the code below can be conditioned to receive the drag event without moving the object
|
45
|
-
// // keep the dragged position in the data-x/data-y attributes
|
46
|
-
// const x = (parseFloat(target.getAttribute('data-x')) || 0) + event.dx;
|
47
|
-
// const y = (parseFloat(target.getAttribute('data-y')) || 0) + event.dy
|
48
|
-
// // translate the element
|
49
|
-
// target.style.transform = 'translate(' + x + 'px, ' + y + 'px)'
|
50
|
-
// // update the position attributes
|
51
|
-
// target.setAttribute('data-x', x)
|
52
|
-
// target.setAttribute('data-y', y)
|
53
|
-
// // CallBack here
|
54
|
-
// self.current_obj.$dragCallback(event.pageX, event.pageY, event.rect.left, event.rect.top, self.current_obj, self.proc_meth);
|
72
|
+
// const atome = {
|
73
|
+
// jsSchedule: function (years, months, days, hours, minutes, seconds, atome, proc) {
|
74
|
+
// const now = new Date();
|
75
|
+
// const formatDate = new Date(years, months - 1, days, hours, minutes, seconds);
|
76
|
+
// const diffTime = Math.abs(formatDate - now);
|
77
|
+
// setTimeout(function () {
|
78
|
+
// atome.$schedule_callback(proc);
|
79
|
+
// }, diffTime);
|
80
|
+
// },
|
81
|
+
// jsReader: function (file, atome, proc) {
|
82
|
+
// fetch('medias/' + file)
|
83
|
+
// .then(response => response.text())
|
84
|
+
// .then(text => atome.$read_callback(text, proc))
|
85
|
+
// },
|
86
|
+
// js_Fullscreen: function (atome_id){
|
87
|
+
// let elem = document.getElementById(atome_id)
|
88
|
+
// if (elem.requestFullscreen) {
|
89
|
+
// elem.requestFullscreen();
|
90
|
+
// } else if (elem.webkitRequestFullscreen) { /* Safari */
|
91
|
+
// elem.webkitEnterFullscreen();
|
92
|
+
// } else if (elem.msRequestFullscreen) { /* IE11 */
|
93
|
+
// elem.msRequestFullscreen();
|
55
94
|
// }
|
95
|
+
//
|
56
96
|
// }
|
57
97
|
//
|
58
98
|
// }
|
59
99
|
|
60
|
-
// Usage:
|
61
|
-
// let atomeDrag = new AtomeDrag();
|
62
|
-
// atomeDrag.drag('atome_id', 'options');
|
63
|
-
const Atomeanimation = {}
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
// TODO: put in a class
|
68
|
-
|
69
|
-
|
70
|
-
const atome = {
|
71
|
-
jsSchedule: function (years, months, days, hours, minutes, seconds, atome, proc) {
|
72
|
-
const now = new Date();
|
73
|
-
const formatDate = new Date(years, months - 1, days, hours, minutes, seconds);
|
74
|
-
const diffTime = Math.abs(formatDate - now);
|
75
|
-
setTimeout(function () {
|
76
|
-
atome.$schedule_callback(proc);
|
77
|
-
}, diffTime);
|
78
|
-
},
|
79
|
-
jsReader: function (file, atome, proc) {
|
80
|
-
fetch('medias/' + file)
|
81
|
-
.then(response => response.text())
|
82
|
-
.then(text => atome.$read_callback(text, proc))
|
83
|
-
},
|
84
|
-
js_Fullscreen: function (atome_id){
|
85
|
-
let elem = document.getElementById(atome_id)
|
86
|
-
if (elem.requestFullscreen) {
|
87
|
-
elem.requestFullscreen();
|
88
|
-
} else if (elem.webkitRequestFullscreen) { /* Safari */
|
89
|
-
elem.webkitEnterFullscreen();
|
90
|
-
} else if (elem.msRequestFullscreen) { /* IE11 */
|
91
|
-
elem.msRequestFullscreen();
|
92
|
-
}
|
93
|
-
|
94
|
-
}
|
95
|
-
|
96
|
-
}
|
97
|
-
|
98
|
-
|
99
|
-
// example ruby equivalent in js //
|
100
|
-
Opal.queue(function (Opal) {/* Generated by Opal 1.6.0 */
|
101
|
-
const $klass = Opal.klass, $defs = Opal.defs, $def = Opal.def;
|
102
|
-
// The line below create the AtomicJS cons to simplify access to js object from ruby
|
103
|
-
|
104
|
-
// var $const_set = Opal.const_set, $nesting = [], nil = Opal.nil;
|
105
|
-
// return $const_set($nesting[0], 'AtomicJS', atome)
|
106
|
-
|
107
|
-
(function ($base, $super) {
|
108
|
-
const self = $klass($base, $super, 'Atome_html');
|
109
|
-
$def(self, '$initialize', function $$initialize(val) {
|
110
|
-
// Init code below
|
111
|
-
}, 1);
|
112
|
-
|
113
|
-
$defs(self, '$check_this', function $$check_this(val) {
|
114
|
-
// getter code below
|
115
|
-
return (val);
|
116
|
-
}, 0);
|
117
|
-
|
118
|
-
$def(self, '$way', function $way() {
|
119
|
-
// getter code below
|
120
|
-
return (self.my_var);
|
121
|
-
}, 0);
|
122
|
-
|
123
|
-
return $def(self, '$way=', function $way(val) {
|
124
|
-
//self method example
|
125
|
-
return (self.my_var = val);
|
126
|
-
}, 0);
|
127
100
|
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
101
|
+
///////////////////////////////////////////////////////////
|
102
|
+
// //// example ruby equivalent in js ///
|
103
|
+
// Opal.queue(function (Opal) {/* Generated by Opal 1.6.0 */
|
104
|
+
// const $klass = Opal.klass, $defs = Opal.defs, $def = Opal.def;
|
105
|
+
// // The line below create the AtomicJS cons to simplify access to js object from ruby
|
106
|
+
//
|
107
|
+
// // var $const_set = Opal.const_set, $nesting = [], nil = Opal.nil;
|
108
|
+
// // return $const_set($nesting[0], 'AtomicJS', atome)
|
109
|
+
//
|
110
|
+
// (function ($base, $super) {
|
111
|
+
// const self = $klass($base, $super, 'AtomeJS');
|
112
|
+
// $def(self, '$initialize', function $$initialize(val) {
|
113
|
+
// // Init code below
|
114
|
+
// }, 1);
|
115
|
+
//
|
116
|
+
// $defs(self, '$check_this', function $$check_this(val) {
|
117
|
+
// // getter code below
|
118
|
+
// // alert ('Suoer cool!!'+val)
|
119
|
+
// // alert(atomeJS)
|
120
|
+
// return (val);
|
121
|
+
// }, 0);
|
122
|
+
//
|
123
|
+
// $def(self, '$way', function $way() {
|
124
|
+
// // getter code below
|
125
|
+
// return (self.my_var);
|
126
|
+
// }, 0);
|
127
|
+
//
|
128
|
+
// return $def(self, '$way=', function $way(val) {
|
129
|
+
// //self method example
|
130
|
+
// return (self.my_var = val);
|
131
|
+
// }, 0);
|
132
|
+
//
|
133
|
+
//
|
134
|
+
// })();
|
135
|
+
//
|
136
|
+
// // new class below
|
137
|
+
// return (function ($base, $super) {
|
138
|
+
// const self = $klass($base, $super, 'Atome');
|
139
|
+
//
|
140
|
+
// $defs(self, '$verif', function $$verif(val) {
|
141
|
+
// //self method example
|
142
|
+
// return (val);
|
143
|
+
// }, 0);
|
144
|
+
//
|
145
|
+
// $def(self, '$new_method', function $way() {
|
146
|
+
// // getter code below
|
147
|
+
// return (self.new_method);
|
148
|
+
// }, 0);
|
149
|
+
//
|
150
|
+
//
|
151
|
+
// return $def(self, '$new_method=', function $way(val) {
|
152
|
+
// //setter code below
|
153
|
+
// return (self.atome = val);
|
154
|
+
// }, 0);
|
155
|
+
//
|
156
|
+
// })();
|
157
|
+
// });
|
153
158
|
|
154
159
|
|
155
160
|
|
@@ -0,0 +1,65 @@
|
|
1
|
+
const atomeAnimate = {
|
2
|
+
|
3
|
+
animate: function(particle_found, duration,damping_ratio,ease, mass, repeat,stiffness, velocity,
|
4
|
+
start_value, end_value, atome_id, atome_found,atome_hash,original_particle,animation_atome) {
|
5
|
+
// console.log(start_value)
|
6
|
+
|
7
|
+
const {easing, styler, animate} = window.popmotion;
|
8
|
+
|
9
|
+
const target_div = document.querySelector('#'+atome_id);
|
10
|
+
|
11
|
+
// var myHash = Opal.hash({postion: target_div.style.transform});
|
12
|
+
|
13
|
+
// let particle_to_process= myHash.$fetch('postion','');
|
14
|
+
|
15
|
+
animate({
|
16
|
+
type: ease,
|
17
|
+
from: start_value,
|
18
|
+
to: end_value,
|
19
|
+
duration: duration,
|
20
|
+
// mass: mass,
|
21
|
+
// velocity: velocity,
|
22
|
+
// dampingRatio: damping_ratio,
|
23
|
+
// stiffness: stiffness,
|
24
|
+
// repeat: repeat,
|
25
|
+
onPlay: (value) => {
|
26
|
+
animation_atome.$play_start_callback(particle_found, start_value,atome_hash,original_particle,atome_found)
|
27
|
+
},
|
28
|
+
onUpdate: (value) => {
|
29
|
+
atome_found.$browser_animate_callback(particle_found, value,atome_hash,original_particle,animation_atome)
|
30
|
+
},
|
31
|
+
onComplete: (value) => {
|
32
|
+
animation_atome.$play_stop_callback(particle_found, end_value,atome_hash,original_particle,atome_found)
|
33
|
+
}
|
34
|
+
});
|
35
|
+
|
36
|
+
|
37
|
+
///////////////////////////
|
38
|
+
|
39
|
+
|
40
|
+
|
41
|
+
// const target_1 = document.querySelector('#box2');
|
42
|
+
// animate({
|
43
|
+
// // from: 0,
|
44
|
+
// // to: 100,
|
45
|
+
// // from: "#fff",
|
46
|
+
// // to: "#000",
|
47
|
+
// // from: "0px 0px 0px rgba(0, 0, 0, 0)",
|
48
|
+
// // to: "10px 10px 0px rgba(0, 0, 0, 0.2)",
|
49
|
+
// from: "rgba(0, 0, 0, 0)",
|
50
|
+
// to: "rgba(0, 0, 0, 0.2)",
|
51
|
+
// duration: 1000,
|
52
|
+
// onUpdate: latest => {
|
53
|
+
// console.log(latest)
|
54
|
+
// // target_1.style.transform = `translateX(${latest}px)`;
|
55
|
+
// target_1.style.background= latest
|
56
|
+
// },
|
57
|
+
// repeat: 6
|
58
|
+
// })
|
59
|
+
// let element = document.getElementById(atome_id)
|
60
|
+
|
61
|
+
|
62
|
+
}
|
63
|
+
|
64
|
+
|
65
|
+
}
|