// // JXNewPackRainVc.m // shiku_im // // Created by 123 on 2020/6/13. // Copyright © 2020 Reese. All rights reserved. // #import "JXNewPackRainVc.h" #import "LNNumberScrollAnimatedView.h" #import @interface JXNewPackRainVc () @property (nonatomic ,strong) LNNumberScrollAnimatedView *socreTensDigitAnimation; @property (nonatomic ,strong) LNNumberScrollAnimatedView *socreDigitAnimation; @property (nonatomic ,strong) LNNumberScrollAnimatedView *socreAnimation; @property (nonatomic, strong) NSMutableArray *playerArr; @property (nonatomic, strong) AVAudioPlayer *numberPlayer; @property (weak, nonatomic) IBOutlet NSLayoutConstraint *topViewLineHH; @property (weak, nonatomic) IBOutlet NSLayoutConstraint *imageHHH; @end @implementation JXNewPackRainVc - (NSMutableArray *)playerArr { if (_playerArr == nil) { _playerArr = [[NSMutableArray alloc] init]; } return _playerArr; } - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. self.view.backgroundColor = [UIColor whiteColor]; [self defineNavBar:@"红包雨" andRinghtBtnImg:@""]; UIImageView *topIMG = [[UIImageView alloc]initWithFrame:CGRectMake(0, JX_SCREEN_TOP,JX_SCREEN_WIDTH, JX_SCREEN_WIDTH)]; topIMG.image=[UIImage imageNamed:@"mm_Lh"]; [self.view addSubview:topIMG]; //个位十位单独设置,可分别设定各自速度 //WithFrame:CGRectMake(100, 100, 152 , 172) LNNumberScrollAnimatedView *socreTensDigitAnimation = [[LNNumberScrollAnimatedView alloc] initWithFrame:CGRectMake((JX_SCREEN_WIDTH)/2-152/4, (JX_SCREEN_WIDTH)/2-172/4, 152/2 , 172/2)]; [topIMG addSubview:socreTensDigitAnimation]; socreTensDigitAnimation.density = 7; socreTensDigitAnimation.duration = 1.9; socreTensDigitAnimation.minLength = 1; [socreTensDigitAnimation setValue:@9]; [socreTensDigitAnimation sizeToFit]; socreTensDigitAnimation.isAscending = YES; socreTensDigitAnimation.durationOffset = 0.1; self.socreTensDigitAnimation = socreTensDigitAnimation; } - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { for (int i = 0; i<19; i++) { [self performSelector:@selector(playSound) withObject:nil afterDelay:0.1]; } [self.socreTensDigitAnimation setValue:[NSNumber numberWithInt:2]]; [self.socreTensDigitAnimation startAnimation]; [self.socreAnimation startAnimation]; } #pragma mark - 播放音效 - (void)playSound { NSURL *url = [[NSBundle mainBundle] URLForResource:@"number.wav" withExtension:nil]; SystemSoundID soundID = 0; AudioServicesCreateSystemSoundID((__bridge CFURLRef)(url) , &soundID); AudioServicesPlayAlertSound (soundID); } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } @end