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

173 lines 4.5 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 ?>
141 <div class="elementor-control-field">
142 <label for="<?php $this->print_control_uid(); ?>" class="elementor-control-title">{{{ data.label }}}</label>
143 <div class="elementor-control-input-wrapper">
144 <select id="<?php $this->print_control_uid(); ?>" data-setting="{{ data.name }}">
145 <option value=""><?php echo esc_html__( 'Default', 'elementor' ); ?></option>
146 <option value="none"><?php echo esc_html__( 'None', 'elementor' ); ?></option>
147 <?php foreach ( static::get_animations() as $animations_group_name => $animations_group ) : ?>
148 <optgroup label="<?php echo esc_attr( $animations_group_name ); ?>">
149 <?php foreach ( $animations_group as $animation_name => $animation_title ) : ?>
150 <option value="<?php echo esc_attr( $animation_name ); ?>"><?php echo esc_html( $animation_title ); ?></option>
151 <?php endforeach; ?>
152 </optgroup>
153 <?php endforeach; ?>
154 </select>
155 </div>
156 </div>
157 <# if ( data.description ) { #>
158 <div class="elementor-control-field-description">{{{ data.description }}}</div>
159 <# } #>
160 <?php
161 }
162
163 public static function get_assets( $setting ) {
164 if ( ! $setting || 'none' === $setting ) {
165 return [];
166 }
167
168 return [
169 'styles' => [ 'e-animations' ],
170 ];
171 }
172 }
173