PluginProbe
Elementor Website Builder – more than just a page builder / 3.0.12
Elementor Website Builder – more than just a page builder v3.0.12
4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 4.1.0-beta2 4.1.0-dev2 4.0.8 4.1.0-beta1 4.1.0-dev1 4.0.7 All 451 releases
elementor / includes / controls / animation.php

animation.php in Elementor Website Builder – more than just a page builder 3.0.12, at includes/controls/animation.php

164 lines 4.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace Elementor;
3
4 if ( ! defined( 'ABSPATH' ) ) {
5 exit; // Exit if accessed directly.
6 }
7
8 /**
9 * Elementor animation control.
10 *
11 * A base control for creating entrance animation control. Displays a select box
12 * with the available entrance animation effects @see Control_Animation::get_animations() .
13 *
14 * @since 1.0.0
15 */
16 class Control_Animation extends Base_Data_Control {
17
18 /**
19 * Get control type.
20 *
21 * Retrieve the animation control type.
22 *
23 * @since 1.0.0
24 * @access public
25 *
26 * @return string Control type.
27 */
28 public function get_type() {
29 return 'animation';
30 }
31
32 /**
33 * Retrieve default control settings.
34 *
35 * Get the default settings of the control. Used to return the default
36 * settings while initializing the control.
37 *
38 * @since 2.5.0
39 * @access protected
40 *
41 * @return array Control default settings.
42 */
43 protected function get_default_settings() {
44 $default_settings['label_block'] = true;
45 $default_settings['render_type'] = 'none';
46
47 return $default_settings;
48 }
49
50 /**
51 * Get animations list.
52 *
53 * Retrieve the list of all the available animations.
54 *
55 * @since 1.0.0
56 * @access public
57 * @static
58 *
59 * @return array Control type.
60 */
61 public static function get_animations() {
62 $animations = [
63 'Fading' => [
64 'fadeIn' => 'Fade In',
65 'fadeInDown' => 'Fade In Down',
66 'fadeInLeft' => 'Fade In Left',
67 'fadeInRight' => 'Fade In Right',
68 'fadeInUp' => 'Fade In Up',
69 ],
70 'Zooming' => [
71 'zoomIn' => 'Zoom In',
72 'zoomInDown' => 'Zoom In Down',
73 'zoomInLeft' => 'Zoom In Left',
74 'zoomInRight' => 'Zoom In Right',
75 'zoomInUp' => 'Zoom In Up',
76 ],
77 'Bouncing' => [
78 'bounceIn' => 'Bounce In',
79 'bounceInDown' => 'Bounce In Down',
80 'bounceInLeft' => 'Bounce In Left',
81 'bounceInRight' => 'Bounce In Right',
82 'bounceInUp' => 'Bounce In Up',
83 ],
84 'Sliding' => [
85 'slideInDown' => 'Slide In Down',
86 'slideInLeft' => 'Slide In Left',
87 'slideInRight' => 'Slide In Right',
88 'slideInUp' => 'Slide In Up',
89 ],
90 'Rotating' => [
91 'rotateIn' => 'Rotate In',
92 'rotateInDownLeft' => 'Rotate In Down Left',
93 'rotateInDownRight' => 'Rotate In Down Right',
94 'rotateInUpLeft' => 'Rotate In Up Left',
95 'rotateInUpRight' => 'Rotate In Up Right',
96 ],
97 'Attention Seekers' => [
98 'bounce' => 'Bounce',
99 'flash' => 'Flash',
100 'pulse' => 'Pulse',
101 'rubberBand' => 'Rubber Band',
102 'shake' => 'Shake',
103 'headShake' => 'Head Shake',
104 'swing' => 'Swing',
105 'tada' => 'Tada',
106 'wobble' => 'Wobble',
107 'jello' => 'Jello',
108 ],
109 'Light Speed' => [
110 'lightSpeedIn' => 'Light Speed In',
111 ],
112 'Specials' => [
113 'rollIn' => 'Roll In',
114 ],
115 ];
116
117 /**
118 * Element appearance animations list.
119 *
120 * @since 2.4.0
121 *
122 * @param array $additional_animations Additional Animations array.
123 */
124 $additional_animations = apply_filters( 'elementor/controls/animations/additional_animations', [] );
125
126 return array_merge( $animations, $additional_animations );
127 }
128
129 /**
130 * Render animations control template.
131 *
132 * Used to generate the control HTML in the editor using Underscore JS
133 * template. The variables for the class are available using `data` JS
134 * object.
135 *
136 * @since 1.0.0
137 * @access public
138 */
139 public function content_template() {
140 $control_uid = $this->get_control_uid();
141 ?>
142 <div class="elementor-control-field">
143 <label for="<?php echo $control_uid; ?>" class="elementor-control-title">{{{ data.label }}}</label>
144 <div class="elementor-control-input-wrapper">
145 <select id="<?php echo $control_uid; ?>" data-setting="{{ data.name }}">
146 <option value=""><?php echo __( 'Default', 'elementor' ); ?></option>
147 <option value="none"><?php echo __( 'None', 'elementor' ); ?></option>
148 <?php foreach ( static::get_animations() as $animations_group_name => $animations_group ) : ?>
149 <optgroup label="<?php echo $animations_group_name; ?>">
150 <?php foreach ( $animations_group as $animation_name => $animation_title ) : ?>
151 <option value="<?php echo $animation_name; ?>"><?php echo $animation_title; ?></option>
152 <?php endforeach; ?>
153 </optgroup>
154 <?php endforeach; ?>
155 </select>
156 </div>
157 </div>
158 <# if ( data.description ) { #>
159 <div class="elementor-control-field-description">{{{ data.description }}}</div>
160 <# } #>
161 <?php
162 }
163 }
164