PluginProbe
Master Addons for Elementor – Elementor Addons, Widgets, Mega Menu Builder, Popup Builder, Widget Builder & Template Kits / 3.0.9
Master Addons for Elementor – Elementor Addons, Widgets, Mega Menu Builder, Popup Builder, Widget Builder & Template Kits v3.0.9
3.2.2 3.2.3 3.2.1 3.2.0 3.1.9 3.1.8 3.1.7 3.1.6 3.1.5 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 3.0.9 trunk 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.1.3 1.1.4 1.1.5 All 174 releases
master-addons / inc / modules / animation / morphing-effects / morphing-effects.php

morphing-effects.php in Master Addons for Elementor – Elementor Addons, Widgets, Mega Menu Builder, Popup Builder, Widget Builder & Template Kits 3.0.9, at inc/modules/animation/morphing-effects/morphing-effects.php

496 lines 13.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace MasterAddons\Modules;
4
5 use \Elementor\Controls_Manager;
6 use \Elementor\Group_Control_Css_Filter;
7 use \Elementor\Group_Control_Background;
8
9 use \MasterAddons\Inc\Classes\Extension_Prototype;
10 use MasterAddons\Inc\Controls\Group\JLTMA_Transition;
11
12 // Exit if accessed directly.
13 if (!defined('ABSPATH')) {
14 exit;
15 };
16
17
18 /**
19 * Author Name: Liton Arefin
20 * Author URL: https://jeweltheme.com
21 * Date: 17/09/2020
22 */
23
24
25 /**
26 * Blob - Morphing Animation
27 */
28
29 if (!class_exists('MasterAddons\Modules\Morphing_Effects')) {
30 class Morphing_Effects extends Extension_Prototype
31 {
32
33 private static $instance = null;
34 public $name = 'Morphing Effects';
35 public $has_controls = true;
36 public $common_sections_actions = array(
37 array(
38 'element' => 'common',
39 'action' => '_section_style',
40 ),
41
42 array(
43 'element' => 'column',
44 'action' => 'section_advanced',
45 ),
46 );
47
48
49 // public function get_script_depends() {
50 // return [
51 // 'jltma-floating-effects',
52 // 'master-addons-scripts'
53 // ];
54 // }
55
56
57
58 private function add_controls($element, $args)
59 {
60
61 $element_type = $element->get_type();
62
63 $element->add_control(
64 'jltma_morphing_effects_switch',
65 [
66 'label' => __('Morphing Effects', 'master-addons' ),
67 'type' => Controls_Manager::SWITCHER,
68 'default' => '',
69 'label_on' => __('Yes', 'master-addons' ),
70 'label_off' => __('No', 'master-addons' ),
71 'return_value' => 'yes',
72 'frontend_available' => true,
73 'prefix_class' => 'jltma-morphing-fx-',
74 ]
75 );
76
77
78 $element->add_control(
79 'jltma_morphing_blob_animation',
80 [
81 'label' => esc_html__('Blob Animation', 'master-addons' ),
82 'type' => Controls_Manager::SELECT,
83 'options' => [
84 'jltma_blob_anim_01' => esc_html__('Effect One', 'master-addons' ),
85 'animation_svg_02' => esc_html__('Effect Two', 'master-addons' ),
86 'animation_svg_03' => esc_html__('Effect Three', 'master-addons' ),
87 'animation_svg_04' => esc_html__('Effect Four', 'master-addons' ),
88 'animation_svg_05' => esc_html__('Effect Five', 'master-addons' ),
89 ],
90 'default' => 'animation_svg_02',
91 'frontend_available' => true,
92 'prefix_class' => '',
93 'condition' => [
94 'jltma_morphing_effects_switch' => 'yes'
95 ]
96 ]
97 );
98
99
100 $element->add_control(
101 'jltma_morphing_blob_type',
102 [
103 'label' => esc_html__('Blob Type', 'master-addons' ),
104 'type' => Controls_Manager::SELECT,
105 'options' => [
106 'color' => esc_html__('Color', 'master-addons' ),
107 'gradient' => esc_html__('Gradient', 'master-addons' ),
108 'lottie' => esc_html__('Lottie', 'master-addons' )
109 ],
110 'default' => 'gradient',
111 'condition' => [
112 'jltma_morphing_effects_switch' => 'yes'
113 ]
114 ]
115 );
116
117
118
119
120 $element->start_controls_tabs('jltma_morphing_effects_tabs');
121
122 $element->start_controls_tab(
123 'jltma_morphing_effects_normal',
124 [
125 'label' => esc_html__('Normal', 'master-addons' ),
126 'condition' => [
127 'jltma_morphing_effects_switch' => 'yes'
128 ]
129
130 ]
131 );
132
133
134 $element->add_control(
135 'ma_el_dual_heading_icon_color',
136 [
137 'label' => esc_html__('Background Color', 'master-addons' ),
138 'type' => Controls_Manager::COLOR,
139 'default' => '#4b00e7',
140 'selectors' => [
141 '{{WRAPPER}}.jltma_blob_anim_01,
142 {{WRAPPER}}.animation_svg_02,
143 {{WRAPPER}}.animation_svg_03,
144 {{WRAPPER}}.animation_svg_04' => 'background: {{VALUE}};',
145 ],
146 'condition' => [
147 'jltma_morphing_blob_type' => 'color',
148 'jltma_morphing_effects_switch' => 'yes'
149 ],
150 ]
151 );
152
153
154 $element->add_group_control(
155 Group_Control_Background::get_type(),
156 [
157 'name' => 'jltma_morphing_effects_background',
158 'types' => ['gradient'],
159 'frontend_available' => true,
160 'selectors' => [
161 '{{WRAPPER}}.jltma_blob_anim_01',
162 '{{WRAPPER}}.animation_svg_02',
163 '{{WRAPPER}}.animation_svg_03',
164 '{{WRAPPER}}.animation_svg_04',
165 ],
166 'condition' => [
167 'jltma_morphing_blob_type' => 'gradient',
168 'jltma_morphing_effects_switch' => 'yes'
169 ],
170 ]
171 );
172
173 $element->add_control(
174 'jltma_morphing_blob_blend_mode',
175 [
176 'label' => esc_html__('Blend Mode', 'master-addons' ),
177 'type' => Controls_Manager::SELECT,
178 'options' => [
179 'normal' => 'Normal',
180 'color' => 'Color',
181 'multiply' => 'Multiply',
182 'screen' => 'Screen',
183 'overlay' => 'Overlay',
184 'darken' => 'Darken',
185 'lighten' => 'Lighten',
186 'color-dodge' => 'Color Dodge',
187 'color-burn' => 'Color Burn',
188 'hard-light' => 'Hard Light',
189 'soft-light' => 'Soft Light',
190 'difference' => 'Difference',
191 'exclusion' => 'Exclusion',
192 'hue' => 'Hue',
193 'saturation' => 'Saturation',
194 'luminosity' => 'Luminosity',
195 ],
196 'default' => 'multiply',
197 'frontend_available' => true,
198 'separator' => 'before',
199 'selectors' => [
200 '{{WRAPPER}}' => 'mix-blend-mode: {{VALUE}};',
201 ],
202 'condition' => [
203 'jltma_morphing_effects_switch' => 'yes'
204 ]
205 ]
206 );
207
208
209 $element->add_responsive_control(
210 'jltma_morphing_effects_width',
211 [
212 'label' => esc_html__('Width', 'master-addons' ),
213 'type' => Controls_Manager::SLIDER,
214 // 'default' => [
215 // 'size' => '100',
216 // ],
217 'range' => [
218 'px' => [
219 'min' => 100,
220 'max' => 2000,
221 'step' => 2,
222 ],
223 ],
224 'selectors' => [
225 '{{WRAPPER}}.jltma_blob_anim_01,
226 {{WRAPPER}}.animation_svg_02,
227 {{WRAPPER}}.animation_svg_03,
228 {{WRAPPER}}.animation_svg_04' => 'width: {{SIZE}}{{UNIT}} !important;',
229 ],
230 'condition' => [
231 'jltma_morphing_effects_switch' => 'yes'
232 ]
233 ]
234 );
235
236 $element->add_responsive_control(
237 'jltma_morphing_effects_height',
238 [
239 'label' => esc_html__('Height', 'master-addons' ),
240 'type' => Controls_Manager::SLIDER,
241 'range' => [
242 'px' => [
243 'min' => 100,
244 'max' => 1000,
245 'step' => 2,
246 ],
247 ],
248 'selectors' => [
249 '{{WRAPPER}}.jltma_blob_anim_01,
250 {{WRAPPER}}.animation_svg_02,
251 {{WRAPPER}}.animation_svg_03,
252 {{WRAPPER}}.animation_svg_04' => 'height: {{SIZE}}{{UNIT}} !important;'
253 ],
254 'condition' => [
255 'jltma_morphing_effects_switch' => 'yes'
256 ]
257 ]
258 );
259
260
261 $element->add_group_control(
262 Group_Control_Css_Filter::get_type(),
263 [
264 'name' => 'jltma_morphing_effects_filters',
265 'selector' => '{{WRAPPER}}',
266 'condition' => [
267 'jltma_morphing_effects_switch' => 'yes'
268 ]
269 ]
270 );
271
272
273 $element->add_group_control(
274 JLTMA_Transition::get_type(),
275 [
276 'name' => 'jltma_morphing_effects_transition',
277 'selector' => '{{WRAPPER}}',
278 'condition' => [
279 'jltma_morphing_effects_switch' => 'yes'
280 ]
281 ]
282 );
283
284
285 // $element->add_control(
286 // 'jltma_morphing_effects_transition_duration',
287 // [
288 // 'label' => esc_html__( 'Transition Duration', 'master-addons' ),
289 // 'type' => Controls_Manager::SLIDER,
290 // 'range' => [
291 // 'px' => [
292 // 'step' => 100,
293 // 'min' => 0,
294 // 'max' => 10000,
295 // ],
296 // ],
297 // 'default' => [
298 // 'size' => '400',
299 // ],
300 // 'selectors' => [
301 // '{{WRAPPER}} .elementor-widget' => 'transition: all {{SIZE}}ms;',
302 // ],
303 // ]
304 // );
305
306 $element->end_controls_tab();
307
308
309
310 $element->start_controls_tab(
311 'jltma_morphing_effects_hover',
312 [
313 'label' => esc_html__('Hover', 'master-addons' ),
314 'condition' => [
315 'jltma_morphing_effects_switch' => 'yes'
316 ]
317 ]
318 );
319
320
321 $element->add_group_control(
322 Group_Control_Css_Filter::get_type(),
323 [
324 'name' => 'jltma_morphing_effects_filters_hover',
325 'selector' => '{{WRAPPER}}:hover',
326 'condition' => [
327 'jltma_morphing_effects_switch' => 'yes'
328 ]
329 ]
330 );
331
332
333 $element->add_group_control(
334 JLTMA_Transition::get_type(),
335 [
336 'name' => 'jltma_morphing_effects_hover_transition',
337 'selector' => '{{WRAPPER}}',
338 ]
339 );
340
341
342
343 // $element->add_control(
344 // 'jltma_morphing_effects_transition_hover_duration',
345 // [
346 // 'label' => esc_html__( 'Transition Duration', 'master-addons' ),
347 // 'type' => Controls_Manager::SLIDER,
348 // 'range' => [
349 // 'px' => [
350 // 'step' => 100,
351 // 'min' => 0,
352 // 'max' => 10000,
353 // ],
354 // ],
355 // 'default' => [
356 // 'size' => '400',
357 // ],
358 // 'selectors' => [
359 // '{{WRAPPER}}:hover' => 'transition: all {{SIZE}}ms;',
360 // ],
361 // ]
362 // );
363
364 $element->end_controls_tab();
365
366 $element->end_controls_tabs();
367 }
368
369
370
371 protected function add_actions()
372 {
373
374 // Activate controls for widgets
375 add_action('elementor/element/common/jltma_section_morphing_effects_advanced/before_section_end', function ($element, $args) {
376 $this->add_controls($element, $args);
377 }, 10, 2);
378
379 // add_filter('elementor/widget/print_template', array($this, 'jltma_morphing_print_template'), 11, 2);
380 add_action('elementor/widget/render_content', array($this, 'jltma_morphing_render_template'), 11, 2);
381 }
382
383
384 public function jltma_morphing_print_template($content, $widget)
385 {
386 if (!$content)
387 return '';
388
389 $settings = $widget->get_settings_for_display();
390
391 $id_item = $widget->get_id();
392
393 $svg_shape = "";
394 if ($settings['jltma_morphing_blob_animation'] == "animation_svg_05") {
395 $svg_shape = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 747.2 726.7">
396 <path d="M539.8 137.6c98.3 69 183.5 124 203 198.4 19.3 74.4-27.1 168.2-93.8 245-66.8 76.8-153.8 136.6-254.2 144.9-100.6 8.2-214.7-35.1-292.7-122.5S-18.1 384.1 7.4 259.8C33 135.6 126.3 19 228.5 2.2c102.1-16.8 213.2 66.3 311.3 135.4z"/>
397 </svg>';
398 }
399
400
401 // $content = "<# if ( '' !== settings.jltma_morphing_effects_switch ) { #><div id=\"rellax-{{id}}\" class=\"rellax\" data-rellax-percentage=\"{{ settings.percentage_rellax.size }}\" data-rellax-zindex=\"{{ settings.zindex_rellax }}\">" . $content . "</div><# } else { #>" . $content . "<# } #>";
402 $content = "<# if ( '' !== settings.jltma_morphing_effects_switch ) { #><div class='jltma-blob' style='--time: 20s; --amount: 5; --fill: #56cbb9;'>" . $svg_shape . '<div class="jltma-morphing-content"> ' . $content . "</div></div><# } else { #>" . $content . "<# } #>";
403 return $content;
404 }
405
406
407 public function jltma_morphing_render_template($content, $widget)
408 {
409 $settings = $widget->get_settings_for_display();
410
411 if (isset($settings['jltma_morphing_effects_switch']) && $settings['jltma_morphing_effects_switch'] == 'yes') {
412
413 $this->_enqueue_alles();
414
415 if (\Elementor\Plugin::$instance->editor->is_edit_mode()) {
416 }
417
418 $item_id = $widget->get_id();
419
420 // $svg_shape = "";
421 // $svg_shape_end = "";
422
423 // if($settings['jltma_morphing_blob_animation'] == "animation_svg_05"){
424 // $svg_shape .= '';
425 // }
426
427 if ($settings['jltma_morphing_blob_animation'] == "animation_svg_05") {
428 // $svg_shape_end .= "</svg>";
429
430
431 // $content = '<div class="jltma-blob" style="--time: 20s; --amount: 5; --fill: #56cbb9;" data-blob-path="M539.8 137.6c98.3 69 183.5 124 203 198.4 19.3 74.4-27.1 168.2-93.8 245-66.8 76.8-153.8 136.6-254.2 144.9-100.6 8.2-214.7-35.1-292.7-122.5S-18.1 384.1 7.4 259.8C33 135.6 126.3 19 228.5 2.2c102.1-16.8 213.2 66.3 311.3 135.4z">
432 // <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 747.2 726.7">
433 // <clipPath id="clipShape'. $id_item .'">
434 // <path d="M539.8 137.6c98.3 69 183.5 124 203 198.4 19.3 74.4-27.1 168.2-93.8 245-66.8 76.8-153.8 136.6-254.2 144.9-100.6 8.2-214.7-35.1-292.7-122.5S-18.1 384.1 7.4 259.8C33 135.6 126.3 19 228.5 2.2c102.1-16.8 213.2 66.3 311.3 135.4z"/>
435 // </path>
436 // </clipPath>
437
438 // <g clip-path="url(#clipShape)" >
439 // <rect width="500" height="500"></rect>
440 // <foreignObject width="500" height="500">
441 // <p class="statement">'. $content .'</p>
442 // </foreignObject> </g></svg></div>';
443
444
445 // $content = '<div style="width:600px; height:500px; -webkit-clip-path: url(#maskRect' . $item_id . ');">' . $content . '</div>';
446 // $content .= '<div class="jltma-blob" style="--time: 2s; --amount: 5; --fill: #56cbb9;">
447 // <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 319.2 356.7">
448 // <clipPath id="maskRect' . $item_id . '" >
449 // <path d="M271.9 50.3c30.6 29.3 51.3 75.5 46.6 123.9-4.6 48.4-34.6 99-86.5 136.3s-125.6 61.4-168.3 35.3S9.4 243.5 3.4 177.3C-2.7 111.2-3.1 55.2 24 26.7 51.1-1.9 105.9-2.9 153.4 2.8c47.6 5.8 88 18.2 118.5 47.5z"></path>
450 // </clipPath>
451 // </svg>
452 // </div>';
453
454
455
456 // }
457
458
459
460 $content = '<div style="width:650px; height:500px; -webkit-clip-path: url(#maskRect' . $item_id . ');">' . $content . '</div>';
461 $content .= '<div class="jltma-blob" style="--time: 12s; --amount: 5; --fill: #56cbb9;">
462 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 319.2 356.7">
463
464 <path d="M271.9 50.3c30.6 29.3 51.3 75.5 46.6 123.9-4.6 48.4-34.6 99-86.5 136.3s-125.6 61.4-168.3 35.3S9.4 243.5 3.4 177.3C-2.7 111.2-3.1 55.2 24 26.7 51.1-1.9 105.9-2.9 153.4 2.8c47.6 5.8 88 18.2 118.5 47.5z"></path>
465
466 <foreignObject style="width:350px; height:300px;">
467 <p class="statement">' . $content . '</p>
468 </foreignObject>
469
470
471 </svg>
472 </div>';
473 }
474
475
476 // <div class="tk-blob" style="--fill: #ff4b82;">
477 // <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 319.2 356.7">
478 // <path d="M271.9 50.3c30.6 29.3 51.3 75.5 46.6 123.9-4.6 48.4-34.6 99-86.5 136.3s-125.6 61.4-168.3 35.3S9.4 243.5 3.4 177.3C-2.7 111.2-3.1 55.2 24 26.7 51.1-1.9 105.9-2.9 153.4 2.8c47.6 5.8 88 18.2 118.5 47.5z"></path>
479 // </svg>
480 // </div>
481
482
483 }
484 return $content;
485 }
486
487 public static function get_instance()
488 {
489 if (!self::$instance) {
490 self::$instance = new self;
491 }
492 return self::$instance;
493 }
494 }
495 }
496