12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- //
- // JXNewPackRainVc.m
- // shiku_im
- //
- // Created by 123 on 2020/6/13.
- // Copyright © 2020 Reese. All rights reserved.
- //
- #import "JXNewPackRainVc.h"
- #import "LNNumberScrollAnimatedView.h"
- #import <AVFoundation/AVFoundation.h>
- @interface JXNewPackRainVc ()<AVAudioPlayerDelegate>
- @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<UITouch *> *)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
|