| 1234567891011121314151617181920212223242526272829 |
- import 'package:flutter/animation.dart';
- import 'package:get/get.dart';
- class ShowPositionController extends GetxController with GetSingleTickerProviderStateMixin{
- AnimationController? controller;
- Animation<double>? animation;
- final alpha = 0.obs;
- ShowPositionController(){
- controller = AnimationController(
- duration: const Duration(milliseconds: 5000), vsync: this);
- final sequence = TweenSequence<double>([
- TweenSequenceItem(tween: ConstantTween(255), weight: 3),
- TweenSequenceItem(tween: Tween(begin: 255, end: 0), weight: 2)
- ]);
- animation = sequence.animate(controller!)
- ..addListener(() { alpha.value = animation!.value.toInt(); });
- }
- show(){
- controller?.reset();
- controller?.forward();
- }
- }
|