PluginProbe
Elementor Website Builder – more than just a page builder / 3.18.2
Elementor Website Builder – more than just a page builder v3.18.2
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.18.2, at includes/controls/animation.php

180 lines 4.7 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 $additional_animations = [];
118
119 /**
120 * Entrance animations.
121 *
122 * Filters the animations list displayed in the animations control.
123 *
124 * This hook can be used to register animations in addition to the
125 * basic Elementor animations.
126 *
127 * @since 2.4.0
128 *
129 * @param array $additional_animations Additional animations array.
130 */
131 $additional_animations = apply_filters( 'elementor/controls/animations/additional_animations', $additional_animations );
132
133 return array_merge( $animations, $additional_animations );
134 }
135
136 /**
137 * Render animations control template.
138 *
139 * Used to generate the control HTML in the editor using Underscore JS
140 * template. The variables for the class are available using `data` JS
141 * object.
142 *
143 * @since 1.0.0
144 * @access public
145 */
146 public function content_template() {
147 ?>
148 <div class="elementor-control-field">
149 <label for="<?php $this->print_control_uid(); ?>" class="elementor-control-title">{{{ data.label }}}</label>
150 <div class="elementor-control-input-wrapper">
151 <select id="<?php $this->print_control_uid(); ?>" data-setting="{{ data.name }}">
152 <option value=""><?php echo esc_html__( 'Default', 'elementor' ); ?></option>
153 <option value="none"><?php echo esc_html__( 'None', 'elementor' ); ?></option>
154 <?php foreach ( static::get_animations() as $animations_group_name => $animations_group ) : ?>
155 <optgroup label="<?php echo esc_attr( $animations_group_name ); ?>">
156 <?php foreach ( $animations_group as $animation_name => $animation_title ) : ?>
157 <option value="<?php echo esc_attr( $animation_name ); ?>"><?php echo esc_html( $animation_title ); ?></option>
158 <?php endforeach; ?>
159 </optgroup>
160 <?php endforeach; ?>
161 </select>
162 </div>
163 </div>
164 <# if ( data.description ) { #>
165 <div class="elementor-control-field-description">{{{ data.description }}}</div>
166 <# } #>
167 <?php
168 }
169
170 public static function get_assets( $setting ) {
171 if ( ! $setting || 'none' === $setting ) {
172 return [];
173 }
174
175 return [
176 'styles' => [ 'e-animations' ],
177 ];
178 }
179 }
180