77 lines
2.6 KiB
Dart
77 lines
2.6 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
/// 애니메이션 컨트롤러 관리를 위한 헬퍼 클래스
|
|
class AnimationControllerHelper {
|
|
/// 모든 애니메이션 컨트롤러를 초기화하는 메서드
|
|
static void initControllers({
|
|
required TickerProvider vsync,
|
|
required AnimationController fadeController,
|
|
required AnimationController scaleController,
|
|
required AnimationController rotateController,
|
|
required AnimationController slideController,
|
|
required AnimationController pulseController,
|
|
required AnimationController waveController,
|
|
}) {
|
|
// 페이드 컨트롤러 초기화
|
|
fadeController.duration = const Duration(milliseconds: 600);
|
|
fadeController.forward();
|
|
|
|
// 스케일 컨트롤러 초기화
|
|
scaleController.duration = const Duration(milliseconds: 600);
|
|
scaleController.forward();
|
|
|
|
// 회전 컨트롤러 초기화
|
|
rotateController.duration = const Duration(seconds: 10);
|
|
rotateController.repeat();
|
|
|
|
// 슬라이드 컨트롤러 초기화
|
|
slideController.duration = const Duration(milliseconds: 600);
|
|
slideController.forward();
|
|
|
|
// 펄스 컨트롤러 초기화
|
|
pulseController.duration = const Duration(milliseconds: 1500);
|
|
pulseController.repeat(reverse: true);
|
|
|
|
// 웨이브 컨트롤러 초기화: 반복으로 부드럽게 루프
|
|
waveController.duration = const Duration(milliseconds: 8000);
|
|
waveController.repeat();
|
|
}
|
|
|
|
/// 모든 애니메이션 컨트롤러를 재설정하는 메서드
|
|
static void resetAnimations({
|
|
required AnimationController fadeController,
|
|
required AnimationController scaleController,
|
|
required AnimationController slideController,
|
|
required AnimationController pulseController,
|
|
required AnimationController waveController,
|
|
}) {
|
|
fadeController.reset();
|
|
scaleController.reset();
|
|
slideController.reset();
|
|
|
|
pulseController.repeat(reverse: true);
|
|
waveController.repeat();
|
|
|
|
fadeController.forward();
|
|
scaleController.forward();
|
|
slideController.forward();
|
|
}
|
|
|
|
/// 모든 애니메이션 컨트롤러를 해제하는 메서드
|
|
static void disposeControllers({
|
|
required AnimationController fadeController,
|
|
required AnimationController scaleController,
|
|
required AnimationController rotateController,
|
|
required AnimationController slideController,
|
|
required AnimationController pulseController,
|
|
required AnimationController waveController,
|
|
}) {
|
|
fadeController.dispose();
|
|
scaleController.dispose();
|
|
rotateController.dispose();
|
|
slideController.dispose();
|
|
pulseController.dispose();
|
|
waveController.dispose();
|
|
}
|
|
}
|