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

182 lines 4.8 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 $additional_animations = [];
63
64 /**
65 * Entrance animations.
66 *
67 * Filters the animations list displayed in the animations control.
68 *
69 * This hook can be used to register animations in addition to the
70 * basic Elementor animations.
71 *
72 * @since 2.4.0
73 *
74 * @param array $additional_animations Additional animations array.
75 */
76 $additional_animations = apply_filters( 'elementor/controls/animations/additional_animations', $additional_animations );
77
78 return array_merge( static::get_default_animations(), $additional_animations );
79 }
80
81 public static function get_default_animations() {
82 return [
83 'Fading' => [
84 'fadeIn' => 'Fade In',
85 'fadeInDown' => 'Fade In Down',
86 'fadeInLeft' => 'Fade In Left',
87 'fadeInRight' => 'Fade In Right',
88 'fadeInUp' => 'Fade In Up',
89 ],
90 'Zooming' => [
91 'zoomIn' => 'Zoom In',
92 'zoomInDown' => 'Zoom In Down',
93 'zoomInLeft' => 'Zoom In Left',
94 'zoomInRight' => 'Zoom In Right',
95 'zoomInUp' => 'Zoom In Up',
96 ],
97 'Bouncing' => [
98 'bounceIn' => 'Bounce In',
99 'bounceInDown' => 'Bounce In Down',
100 'bounceInLeft' => 'Bounce In Left',
101 'bounceInRight' => 'Bounce In Right',
102 'bounceInUp' => 'Bounce In Up',
103 ],
104 'Sliding' => [
105 'slideInDown' => 'Slide In Down',
106 'slideInLeft' => 'Slide In Left',
107 'slideInRight' => 'Slide In Right',
108 'slideInUp' => 'Slide In Up',
109 ],
110 'Rotating' => [
111 'rotateIn' => 'Rotate In',
112 'rotateInDownLeft' => 'Rotate In Down Left',
113 'rotateInDownRight' => 'Rotate In Down Right',
114 'rotateInUpLeft' => 'Rotate In Up Left',
115 'rotateInUpRight' => 'Rotate In Up Right',
116 ],
117 'Attention Seekers' => [
118 'bounce' => 'Bounce',
119 'flash' => 'Flash',
120 'pulse' => 'Pulse',
121 'rubberBand' => 'Rubber Band',
122 'shake' => 'Shake',
123 'headShake' => 'Head Shake',
124 'swing' => 'Swing',
125 'tada' => 'Tada',
126 'wobble' => 'Wobble',
127 'jello' => 'Jello',
128 ],
129 'Light Speed' => [
130 'lightSpeedIn' => 'Light Speed In',
131 ],
132 'Specials' => [
133 'rollIn' => 'Roll In',
134 ],
135 ];
136 }
137
138 /**
139 * Render animations control template.
140 *
141 * Used to generate the control HTML in the editor using Underscore JS
142 * template. The variables for the class are available using `data` JS
143 * object.
144 *
145 * @since 1.0.0
146 * @access public
147 */
148 public function content_template() {
149 ?>
150 <div class="elementor-control-field">
151 <label for="<?php $this->print_control_uid(); ?>" class="elementor-control-title">{{{ data.label }}}</label>
152 <div class="elementor-control-input-wrapper">
153 <select id="<?php $this->print_control_uid(); ?>" data-setting="{{ data.name }}">
154 <option value=""><?php echo esc_html__( 'Default', 'elementor' ); ?></option>
155 <option value="none"><?php echo esc_html__( 'None', 'elementor' ); ?></option>
156 <?php foreach ( static::get_animations() as $animations_group_name => $animations_group ) : ?>
157 <optgroup label="<?php echo esc_attr( $animations_group_name ); ?>">
158 <?php foreach ( $animations_group as $animation_name => $animation_title ) : ?>
159 <option value="<?php echo esc_attr( $animation_name ); ?>"><?php echo esc_html( $animation_title ); ?></option>
160 <?php endforeach; ?>
161 </optgroup>
162 <?php endforeach; ?>
163 </select>
164 </div>
165 </div>
166 <# if ( data.description ) { #>
167 <div class="elementor-control-field-description">{{{ data.description }}}</div>
168 <# } #>
169 <?php
170 }
171
172 public static function get_assets( $setting ) {
173 if ( ! $setting || 'none' === $setting ) {
174 return [];
175 }
176
177 return [
178 'styles' => [ 'e-animation-' . $setting ],
179 ];
180 }
181 }
182