PluginProbe
Ultimate Post Kit – Elementor Post Grid, Post Carousel, Post Slider & Blog Layout Widgets / 4.5.4
Ultimate Post Kit – Elementor Post Grid, Post Carousel, Post Slider & Blog Layout Widgets v4.5.4
4.5.4 4.2.1 4.2.2 4.2.3 4.5.0 4.5.2 4.5.3 4.2.0 4.1.18 4.1.17 4.1.16 4.1.15 4.1.14 4.1.13 4.1.12 4.1.11 4.1.10 4.1.9 4.1.8 4.0.9 4.1.0 4.1.1 4.1.2 4.1.3 4.1.4 All 146 releases
ultimate-post-kit / modules / animations / module.php

module.php in Ultimate Post Kit – Elementor Post Grid, Post Carousel, Post Slider & Blog Layout Widgets 4.5.4, at modules/animations/module.php

503 lines 11.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace UltimatePostKit\Modules\Animations;
3
4 use Elementor\Controls_Manager;
5 use UltimatePostKit\Base\Ultimate_Post_Kit_Module_Base;
6
7 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
8
9 class Module extends Ultimate_Post_Kit_Module_Base {
10
11 public function get_name() {
12 return 'animations';
13 }
14
15 public function __construct() {
16 parent::__construct();
17 $this->add_actions();
18
19 }
20
21 public function register_section($element) {
22
23
24
25 $element->start_controls_section(
26 'section_upk_in_animation_controls',
27 [
28 'tab' => Controls_Manager::TAB_CONTENT,
29 'label' => esc_html__('Entrance Animation', 'ultimate-post-kit'),
30 ]
31 );
32
33 $element->end_controls_section();
34 }
35
36
37 public function register_controls( $widget, $args ) {
38
39 $widget->add_control(
40 'upk_in_animation_show',
41 [
42 'label' => esc_html__( 'Entrance Animation', 'ultimate-post-kit' ),
43 'type' => Controls_Manager::SWITCHER,
44 'render_type' => 'template',
45 'frontend_available' => true,
46 ]
47 );
48
49 $widget->add_control(
50 'upk_in_animation_perspective',
51 [
52 'label' => esc_html__('Perspective', 'ultimate-post-kit'),
53 'type' => Controls_Manager::SLIDER,
54 'range' => [
55 'px' => [
56 'min' => 50,
57 'max' => 1000,
58 ],
59 ],
60 'selectors' => [
61 '{{WRAPPER}}' => '--upk-perspective: {{SIZE}}px;'
62 ],
63 'condition' => [
64 'upk_in_animation_show' => 'yes',
65 ],
66 'separator' => 'before',
67 'render_type' => 'template',
68 'classes' => BDTUPK_IS_PC
69 ]
70 );
71
72 $widget->add_control(
73 'upk_in_animation_delay',
74 [
75 'label' => esc_html__('Delay(ms)', 'ultimate-post-kit'),
76 'type' => Controls_Manager::SLIDER,
77 'range' => [
78 'px' => [
79 'min' => 0,
80 'step' => 10,
81 'max' => 1000,
82 ],
83 ],
84 'condition' => [
85 'upk_in_animation_show' => 'yes',
86 ],
87 'render_type' => 'template',
88 'classes' => BDTUPK_IS_PC
89 ]
90 );
91
92 $widget->add_control(
93 'upk_in_animation_transition_duration',
94 [
95 'label' => esc_html__('Transition Duration(ms)', 'ultimate-post-kit'),
96 'type' => Controls_Manager::SLIDER,
97 'range' => [
98 'px' => [
99 'min' => 10,
100 'step' => 10,
101 'max' => 2000,
102 ],
103 ],
104 'condition' => [
105 'upk_in_animation_show' => 'yes',
106 ],
107 'selectors' => [
108 '{{WRAPPER}}' => '--upk-transition-duration: {{SIZE}}ms;'
109 ],
110 'render_type' => 'template',
111 'classes' => BDTUPK_IS_PC
112 ]
113 );
114
115 $widget->add_control(
116 'upk_in_animation_transform_origin',
117 [
118 'label' => esc_html__('Transform Origin', 'ultimate-post-kit'),
119 'type' => Controls_Manager::TEXT,
120 'default' => 'center top',
121 'condition' => [
122 'upk_in_animation_show' => 'yes',
123 ],
124 'selectors' => [
125 '{{WRAPPER}}' => '--upk-transform-origin: {{VALUE}};'
126 ],
127 'render_type' => 'template',
128 'classes' => BDTUPK_IS_PC
129 ]
130 );
131
132 $widget->add_control(
133 'upk_in_animation_transform_heading',
134 [
135 'label' => __( 'TRANSFORM', 'ultimate-post-kit' ),
136 'type' => Controls_Manager::HEADING,
137 'separator' => 'before',
138 'condition' => [
139 'upk_in_animation_show' => 'yes',
140 ],
141 ]
142 );
143
144 $widget->add_control(
145 'upk_in_animation_translate_toggle',
146 [
147 'label' => __( 'Translate', 'ultimate-post-kit' ),
148 'type' => Controls_Manager::POPOVER_TOGGLE,
149 'return_value' => 'yes',
150 'condition' => [
151 'upk_in_animation_show' => 'yes',
152 ],
153 'render_type' => 'template',
154 'classes' => BDTUPK_IS_PC
155 ]
156 );
157
158 $widget->start_popover();
159
160 $widget->add_responsive_control(
161 'upk_in_animation_translate_x',
162 [
163 'label' => esc_html__( 'Translate X', 'ultimate-post-kit' ),
164 'type' => Controls_Manager::SLIDER,
165 'size_units' => ['px', '%'],
166 'default' => [
167 'unit' => '%',
168 ],
169 'range' => [
170 'px' => [
171 'min' => -100,
172 'max' => 100,
173 ],
174 '%' => [
175 'min' => 0,
176 'max' => 100,
177 ],
178 ],
179 'condition' => [
180 'upk_in_animation_translate_toggle' => 'yes',
181 'upk_in_animation_show' => 'yes',
182 ],
183 'selectors' => [
184 '{{WRAPPER}}' => '--upk-translate-x: {{SIZE}}{{UNIT}};'
185 ],
186 'render_type' => 'template',
187 ]
188 );
189
190 $widget->add_responsive_control(
191 'upk_in_animation_translate_y',
192 [
193 'label' => esc_html__( 'Translate Y', 'ultimate-post-kit' ),
194 'type' => Controls_Manager::SLIDER,
195 'size_units' => ['px', '%'],
196 'default' => [
197 'unit' => '%',
198 'size' => 100,
199 ],
200 'range' => [
201 'px' => [
202 'min' => -100,
203 'max' => 100,
204 ],
205 '%' => [
206 'min' => 0,
207 'max' => 100,
208 ],
209 ],
210 'selectors' => [
211 '{{WRAPPER}}' => '--upk-translate-y: {{SIZE}}{{UNIT}};'
212 ],
213 'condition' => [
214 'upk_in_animation_translate_toggle' => 'yes',
215 'upk_in_animation_show' => 'yes',
216 ],
217 'render_type' => 'template',
218 ]
219 );
220
221
222 $widget->end_popover();
223
224 $widget->add_control(
225 'upk_in_animation_rotate_toggle',
226 [
227 'label' => __( 'Rotate', 'ultimate-post-kit' ),
228 'type' => Controls_Manager::POPOVER_TOGGLE,
229 'return_value' => 'yes',
230 'condition' => [
231 'upk_in_animation_show' => 'yes',
232 ],
233 'render_type' => 'template',
234 'classes' => BDTUPK_IS_PC
235 ]
236 );
237
238 $widget->start_popover();
239
240
241 $widget->add_responsive_control(
242 'upk_in_animation_rotate_x',
243 [
244 'label' => esc_html__( 'Rotate X', 'ultimate-post-kit' ),
245 'type' => Controls_Manager::SLIDER,
246 'size_units' => ['px'],
247 'default' => [
248 'size' => -80,
249 ],
250 'range' => [
251 'px' => [
252 'min' => -180,
253 'max' => 180,
254 ],
255 ],
256 'condition' => [
257 'upk_in_animation_rotate_toggle' => 'yes',
258 'upk_in_animation_show' => 'yes',
259 ],
260 'selectors' => [
261 '{{WRAPPER}}' => '--upk-rotate-x: {{SIZE||0}}deg;'
262 ],
263 'render_type' => 'template',
264 ]
265 );
266
267 $widget->add_responsive_control(
268 'upk_in_animation_rotate_y',
269 [
270 'label' => esc_html__( 'Rotate Y', 'ultimate-post-kit' ),
271 'type' => Controls_Manager::SLIDER,
272 'size_units' => ['px'],
273 'range' => [
274 'px' => [
275 'min' => -180,
276 'max' => 180,
277 ],
278 ],
279 'condition' => [
280 'upk_in_animation_rotate_toggle' => 'yes',
281 'upk_in_animation_show' => 'yes',
282 ],
283 'selectors' => [
284 '{{WRAPPER}}' => '--upk-rotate-y: {{SIZE||0}}deg;'
285 ],
286 'render_type' => 'template',
287 ]
288 );
289
290
291 $widget->add_responsive_control(
292 'upk_in_animation_rotate_z',
293 [
294 'label' => __( 'Rotate Z', 'ultimate-post-kit' ),
295 'type' => Controls_Manager::SLIDER,
296 'size_units' => ['px'],
297 'range' => [
298 'px' => [
299 'min' => -180,
300 'max' => 180,
301 ],
302 ],
303 'selectors' => [
304 '{{WRAPPER}}' => '--upk-rotate-z: {{SIZE||0}}deg;'
305 ],
306 'condition' => [
307 'upk_in_animation_rotate_toggle' => 'yes',
308 'upk_in_animation_show' => 'yes',
309 ],
310 'render_type' => 'template',
311 ]
312 );
313
314 $widget->end_popover();
315
316
317 $widget->add_control(
318 'upk_in_animation_scale',
319 [
320 'label' => __( 'Scale', 'ultimate-post-kit' ),
321 'type' => Controls_Manager::POPOVER_TOGGLE,
322 'return_value' => 'yes',
323 'condition' => [
324 'upk_in_animation_show' => 'yes',
325 ],
326 'render_type' => 'template',
327 'classes' => BDTUPK_IS_PC
328 ]
329 );
330
331 $widget->start_popover();
332
333 $widget->add_responsive_control(
334 'upk_in_animation_scale_x',
335 [
336 'label' => esc_html__( 'Scale X', 'ultimate-post-kit' ),
337 'type' => Controls_Manager::SLIDER,
338 'size_units' => ['px'],
339 'range' => [
340 'px' => [
341 'min' => 0,
342 'max' => 5,
343 'step' => 0.1
344 ],
345 ],
346 'condition' => [
347 'upk_in_animation_scale' => 'yes',
348 'upk_in_animation_show' => 'yes',
349 ],
350 'selectors' => [
351 '{{WRAPPER}}' => '--upk-scale-x: {{SIZE}};'
352 ],
353 'render_type' => 'template',
354 ]
355 );
356
357 $widget->add_responsive_control(
358 'upk_in_animation_scale_y',
359 [
360 'label' => esc_html__( 'Scale Y', 'ultimate-post-kit' ),
361 'type' => Controls_Manager::SLIDER,
362 'size_units' => ['px'],
363 'range' => [
364 'px' => [
365 'min' => 0,
366 'max' => 5,
367 'step' => 0.1
368 ],
369 ],
370 'condition' => [
371 'upk_in_animation_scale' => 'yes',
372 'upk_in_animation_show' => 'yes',
373 ],
374 'selectors' => [
375 '{{WRAPPER}}' => '--upk-scale-y: {{SIZE}};'
376 ],
377 'render_type' => 'template',
378 ]
379 );
380
381 $widget->end_popover();
382
383 $widget->add_control(
384 'upk_in_animation_skew',
385 [
386 'label' => __( 'Skew', 'ultimate-post-kit' ),
387 'type' => Controls_Manager::POPOVER_TOGGLE,
388 'return_value' => 'yes',
389 'condition' => [
390 'upk_in_animation_show' => 'yes',
391 ],
392 'render_type' => 'template',
393 'classes' => BDTUPK_IS_PC
394 ]
395 );
396
397 $widget->start_popover();
398
399 $widget->add_responsive_control(
400 'upk_in_animation_skew_x',
401 [
402 'label' => esc_html__( 'Skew X', 'ultimate-post-kit' ),
403 'type' => Controls_Manager::SLIDER,
404 'size_units' => ['px'],
405 'range' => [
406 'px' => [
407 'min' => -180,
408 'max' => 180,
409 ],
410 ],
411 'condition' => [
412 'upk_in_animation_skew' => 'yes',
413 'upk_in_animation_show' => 'yes',
414 ],
415 'selectors' => [
416 '{{WRAPPER}}' => '--upk-skew-x: {{SIZE}}deg;'
417 ],
418 'render_type' => 'template',
419 ]
420 );
421
422 $widget->add_responsive_control(
423 'upk_in_animation_skew_y',
424 [
425 'label' => esc_html__( 'Skew Y', 'ultimate-post-kit' ),
426 'type' => Controls_Manager::SLIDER,
427 'size_units' => ['px'],
428 'range' => [
429 'px' => [
430 'min' => -180,
431 'max' => 180,
432 ],
433 ],
434 'condition' => [
435 'upk_in_animation_skew' => 'yes',
436 'upk_in_animation_show' => 'yes',
437 ],
438 'selectors' => [
439 '{{WRAPPER}}' => '--upk-skew-y: {{SIZE}}deg;'
440 ],
441 'render_type' => 'template',
442 ]
443 );
444
445 $widget->end_popover();
446
447 }
448
449 public function in_animation_before_render( $widget ) {
450 $settings = $widget->get_settings_for_display();
451
452
453 if ( isset($settings['upk_in_animation_show']) and $settings['upk_in_animation_show'] == 'yes' ) {
454 wp_enqueue_script( 'upk-animations' );
455 }
456 }
457
458 protected function add_actions() {
459
460 $widgets = [
461 'upk-alex-grid',
462 'upk-alice-grid',
463 'upk-alter-grid',
464 'upk-amox-grid',
465 'upk-buzz-list',
466 'upk-classic-list',
467 'upk-elite-grid',
468 'upk-fanel-list',
469 'upk-featured-list',
470 'upk-harold-list',
471 'upk-hazel-grid',
472 'upk-kalon-grid',
473 'upk-maple-grid',
474 // 'upk-pixina-grid',
475 'upk-ramble-grid',
476 'upk-recent-comments',
477 'upk-scott-list',
478 'upk-tiny-list',
479 'upk-welsh-list',
480 'upk-wixer-grid',
481 ];
482
483 foreach ( $widgets as $widget) {
484 add_action(
485 'elementor/element/' .$widget. '/upk_section_style/before_section_start', [
486 $this,
487 'register_section'
488 ] );
489
490 add_action(
491 'elementor/element/' .$widget. '/section_upk_in_animation_controls/before_section_end', [
492 $this,
493 'register_controls'
494 ], 10, 2 );
495
496 add_action( 'elementor/frontend/widget/before_render', [
497 $this,
498 'in_animation_before_render'
499 ], 10, 1 );
500 }
501 }
502 }
503