// ============================================================================
// Poster
// ============================================================================

////
/// 
/// Blink Animations Mixin Module
/// ===========================================================================
/// 
/// This module ...
/// 
/// 
/// @group Animations
/// @author Scape Agency
/// @link https://move.gl
/// @since 0.1.0 initial release
/// @todo None
/// @access public
/// 
////


// ============================================================================
// Use
// ============================================================================

@use "../dev" as *;
@use "../variables" as *;
@use "../keyframes" as *;
@use "base" as *;


// ============================================================================
// Mixins
// ============================================================================


///
/// Blink Animation
/// Creates a blink animation where the element alternates between visible and
/// invisible states.
/// 
/// @name animate_blink
/// @param {Number|String} $duration [$animate_base_duration] - The duration of the blink animation.
/// @param {String} $timing_function [step-end] - The timing function for the blink animation.
/// @param {Number|String} $iteration_count [$animate_base_iteration_count] - The number of iterations the animation will run.
/// @param {Number} $start_opacity [1] - The opacity of the element at the start and end of the animation.
/// @param {Number} $blink_opacity [0] - The opacity of the element during the blink.
///
@mixin animate_blink(
    $duration: $animate_base_duration,
    $timing_function: step-end, 
    $iteration_count: $animate_base_iteration_count,
    $start_opacity: 1,
    $blink_opacity: 0
) {
    @include animate_base(
        animate_blink,
        $duration,
        $timing_function,
        $iteration_count
    );
    @keyframes animate_blink {
        0%, 100% { opacity: $start-opacity; }
        50% { opacity: $blink-opacity; }
    }
}


///
/// Rapid Blink Animation
/// Creates a rapid blink animation where the element blinks quickly between
/// visible and invisible states.
/// 
/// @name animate_blink_rapid
/// @param {Number|String} $duration [$animate_base_duration_fast] - The duration of the rapid blink animation.
/// @param {String} $timing_function [steps(2, end)] - The timing function for the rapid blink animation.
/// @param {Number|String} $iteration_count [$animate_base_iteration_count] - The number of iterations the animation will run.
///
@mixin animate_blink_rapid(
    $duration: $animate_base_duration_fast,
    $timing_function: steps(2, end),
    $iteration_count: $animate_base_iteration_count
) {
    @include animate_base(
        animate_blink_rapid,
        $duration,
        $timing_function,
        $iteration_count
    );
    @keyframes animate_blink_rapid {
        0%, 100% { opacity: 1; }
        50% { opacity: 0; }
    }
}


///
/// Soft Blink Animation
/// Creates a soft blink animation with a smooth transition in and out of
/// visibility.
/// 
/// @name animate_blink_soft
/// @param {Number|String} $duration [$animate_base_duration_slow] - The duration of the soft blink animation.
/// @param {String} $timing_function [ease-in-out] - The timing function for the soft blink animation.
/// @param {Number|String} $iteration_count [$animate_base_iteration_count] - The number of iterations the animation will run.
///
@mixin animate_blink_soft(
    $duration: $animate_base_duration_slow,
    $timing_function: ease-in-out,
    $iteration_count: $animate_base_iteration_count
) {
    @include animate_base(
        animate_blink_soft,
        $duration,
        $timing_function,
        $iteration_count
    );
    @keyframes animate_blink_soft {
        0%, 100% { opacity: 1; }
        50% { opacity: 0.3; }
    }
}


///
/// Alternating Blink Animation
/// Creates an alternating blink animation where the element blinks at regular
/// intervals.
/// 
/// @name animate_blink_alternate
/// @param {Number|String} $duration [$animate_base_duration] - The duration of the alternating blink animation.
/// @param {String} $timing_function [linear] - The timing function for the alternating blink animation.
/// @param {Number|String} $iteration_count [$animate_base_iteration_count] - The number of iterations the animation will run.
///
@mixin animate_blink_alternate(
    $duration: $animate_base_duration,
    $timing_function: linear,
    $iteration_count: $animate_base_iteration_count
) {
    @include animate_base(
        animate_blink_alternate,
        $duration,
        $timing_function,
        $iteration_count
    );
    @keyframes animate_blink_alternate {
        0%, 100% { opacity: 1; }
        25%, 75% { opacity: 0; }
    }
}
