Files
featherVoice/QXLive/Tools/Category/UIView+FloatingAnimation.h
2026-01-08 18:31:27 +08:00

46 lines
1.3 KiB
Objective-C
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//
// UIView+FloatingAnimation.h
// QXLive
//
// Created by 启星 on 2026/1/5.
//
#import <UIKit/UIKit.h>
typedef NS_ENUM(NSInteger, FloatingDirection) {
FloatingDirectionUpDown, // 上下漂浮
FloatingDirectionLeftRight // 左右漂浮
};
@interface UIView (FloatingAnimation)
/// 开始无限漂浮动画
/// @param distance 漂浮距离(单位:点)
/// @param duration 单次动画持续时间(秒)
/// @param direction 漂浮方向
/// @param autoStart 是否自动开始YES立即开始NO需要手动调用startFloating
- (void)startInfiniteFloatingAnimationWithDistance:(CGFloat)distance
duration:(NSTimeInterval)duration
direction:(FloatingDirection)direction
autoStart:(BOOL)autoStart;
/// 开始上下漂浮动画(默认自动开始)
- (void)startUpDownFloatingWithDistance:(CGFloat)distance duration:(NSTimeInterval)duration;
/// 手动开始漂浮动画如果设置了autoStart为NO需要调用此方法
- (void)startFloating;
/// 停止漂浮动画
- (void)stopFloatingAnimation;
/// 暂停漂浮动画
- (void)pauseFloatingAnimation;
/// 恢复漂浮动画
- (void)resumeFloatingAnimation;
/// 检查是否正在漂浮
- (BOOL)isFloatingAnimating;
@end