exit-animation.php (2517B)
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 $animations = [ 45 'Fading' => [ 46 'fadeIn' => 'Fade Out', 47 'fadeInDown' => 'Fade Out Up', 48 'fadeInLeft' => 'Fade Out Left', 49 'fadeInRight' => 'Fade Out Right', 50 'fadeInUp' => 'Fade Out Down', 51 ], 52 'Zooming' => [ 53 'zoomIn' => 'Zoom Out', 54 'zoomInDown' => 'Zoom Out Up', 55 'zoomInLeft' => 'Zoom Out Left', 56 'zoomInRight' => 'Zoom Out Right', 57 'zoomInUp' => 'Zoom Out Down', 58 ], 59 'Sliding' => [ 60 'slideInDown' => 'Slide Out Up', 61 'slideInLeft' => 'Slide Out Left', 62 'slideInRight' => 'Slide Out Right', 63 'slideInUp' => 'Slide Out Down', 64 ], 65 'Rotating' => [ 66 'rotateIn' => 'Rotate Out', 67 'rotateInDownLeft' => 'Rotate Out Up Left', 68 'rotateInDownRight' => 'Rotate Out Up Right', 69 'rotateInUpRight' => 'Rotate Out Down Left', 70 'rotateInUpLeft' => 'Rotate Out Down Right', 71 ], 72 'Light Speed' => [ 73 'lightSpeedIn' => 'Light Speed Out', 74 ], 75 'Specials' => [ 76 'rollIn' => 'Roll Out', 77 ], 78 ]; 79 80 $additional_animations = []; 81 82 /** 83 * Exit animations. 84 * 85 * Filters the animations list displayed in the exit animations control. 86 * 87 * This hook can be used to register new animations in addition to the 88 * basic Elementor exit animations. 89 * 90 * @since 2.5.0 91 * 92 * @param array $additional_animations Additional animations array. 93 */ 94 $additional_animations = apply_filters( 'elementor/controls/exit-animations/additional_animations', $additional_animations ); 95 96 return array_merge( $animations, $additional_animations ); 97 } 98 99 public static function get_assets( $setting ) { 100 if ( ! $setting || 'none' === $setting ) { 101 return []; 102 } 103 104 return [ 105 'styles' => [ 'e-animations' ], 106 ]; 107 } 108 }