| 1 |
<?php |
| 2 |
namespace Elementor; |
| 3 |
|
| 4 |
if ( ! defined( 'ABSPATH' ) ) { |
| 5 |
exit; // Exit if accessed directly. |
| 6 |
} |
| 7 |
|
| 8 |
/** |
| 9 |
* Elementor exit animation control. |
| 10 |
* |
| 11 |
* A control for creating exit animation. Displays a select box |
| 12 |
* with the available exit animation effects @see Control_Exit_Animation::get_animations() . |
| 13 |
* |
| 14 |
* @since 2.5.0 |
| 15 |
*/ |
| 16 |
class Control_Exit_Animation extends Control_Animation { |
| 17 |
|
| 18 |
/** |
| 19 |
* Get control type. |
| 20 |
* |
| 21 |
* Retrieve the animation control type. |
| 22 |
* |
| 23 |
* @since 2.5.0 |
| 24 |
* @access public |
| 25 |
* |
| 26 |
* @return string Control type. |
| 27 |
*/ |
| 28 |
public function get_type() { |
| 29 |
return 'exit_animation'; |
| 30 |
} |
| 31 |
|
| 32 |
/** |
| 33 |
* Get animations list. |
| 34 |
* |
| 35 |
* Retrieve the list of all the available animations. |
| 36 |
* |
| 37 |
* @since 1.0.0 |
| 38 |
* @access public |
| 39 |
* @static |
| 40 |
* |
| 41 |
* @return array Control type. |
| 42 |
*/ |
| 43 |
public static function get_animations() { |
| 44 |
$additional_animations = []; |
| 45 |
|
| 46 |
/** |
| 47 |
* Exit animations. |
| 48 |
* |
| 49 |
* Filters the animations list displayed in the exit animations control. |
| 50 |
* |
| 51 |
* This hook can be used to register new animations in addition to the |
| 52 |
* basic Elementor exit animations. |
| 53 |
* |
| 54 |
* @since 2.5.0 |
| 55 |
* |
| 56 |
* @param array $additional_animations Additional animations array. |
| 57 |
*/ |
| 58 |
$additional_animations = apply_filters( 'elementor/controls/exit-animations/additional_animations', $additional_animations ); |
| 59 |
|
| 60 |
return array_merge( static::get_default_animations(), $additional_animations ); |
| 61 |
} |
| 62 |
|
| 63 |
public static function get_default_animations(): array { |
| 64 |
return [ |
| 65 |
'Fading' => [ |
| 66 |
'fadeIn' => 'Fade Out', |
| 67 |
'fadeInDown' => 'Fade Out Up', |
| 68 |
'fadeInLeft' => 'Fade Out Left', |
| 69 |
'fadeInRight' => 'Fade Out Right', |
| 70 |
'fadeInUp' => 'Fade Out Down', |
| 71 |
], |
| 72 |
'Zooming' => [ |
| 73 |
'zoomIn' => 'Zoom Out', |
| 74 |
'zoomInDown' => 'Zoom Out Up', |
| 75 |
'zoomInLeft' => 'Zoom Out Left', |
| 76 |
'zoomInRight' => 'Zoom Out Right', |
| 77 |
'zoomInUp' => 'Zoom Out Down', |
| 78 |
], |
| 79 |
'Sliding' => [ |
| 80 |
'slideInDown' => 'Slide Out Up', |
| 81 |
'slideInLeft' => 'Slide Out Left', |
| 82 |
'slideInRight' => 'Slide Out Right', |
| 83 |
'slideInUp' => 'Slide Out Down', |
| 84 |
], |
| 85 |
'Rotating' => [ |
| 86 |
'rotateIn' => 'Rotate Out', |
| 87 |
'rotateInDownLeft' => 'Rotate Out Up Left', |
| 88 |
'rotateInDownRight' => 'Rotate Out Up Right', |
| 89 |
'rotateInUpRight' => 'Rotate Out Down Left', |
| 90 |
'rotateInUpLeft' => 'Rotate Out Down Right', |
| 91 |
], |
| 92 |
'Light Speed' => [ |
| 93 |
'lightSpeedIn' => 'Light Speed Out', |
| 94 |
], |
| 95 |
'Specials' => [ |
| 96 |
'rollIn' => 'Roll Out', |
| 97 |
], |
| 98 |
]; |
| 99 |
} |
| 100 |
|
| 101 |
public static function get_assets( $setting ) { |
| 102 |
if ( ! $setting || 'none' === $setting ) { |
| 103 |
return []; |
| 104 |
} |
| 105 |
|
| 106 |
return [ |
| 107 |
'styles' => [ 'e-animation-' . $setting ], |
| 108 |
]; |
| 109 |
} |
| 110 |
} |
| 111 |
|