//
// ViewController.m
// 汤姆猫
//
// Created by lanou on 16/7/12.
// Copyright © 2016年 lanou. All rights reserved.
//
#import "ViewController.h"
@interface ViewController ()
@property (weak, nonatomic) IBOutlet UIImageView *tomCatView;
@end
@implementation ViewController
/*
*/
- (void)viewDidLoad {
[super viewDidLoad];
//UIImageView *imageView = [UIImageView new];
//序列帧动画要播放的图片数组
//imageView.animationImages
//动画时长
//imageView.animationDuration
//动画重复次数
//imageView.animationRepeatCount
//开始动画
//[imageView startAnimating];
//结束动画
//[imageView stopAnimating];
//是否正在执行动画
//[imageView isAnimating];
}
- (IBAction)FootLeftAction:(UIButton *)sender {
//创建可变数组images,负责存放要播放的图片数组
NSMutableArray *images = [NSMutableArray array];
for (NSInteger i = 0;i < 30;i++) {
//根据i来加载图片,然后添加到可变数组images里面
NSString *imageName = [NSString stringWithFormat:@"FootLeft_%02ld.jpg",i];
//根据格式化的图片名加载图片image
UIImage *image = [UIImage imageNamed:imageName];
//将图片image添加到数组images中
[images addObject:image];
}
//设置动画图片数组
self.tomCatView.animationImages = images;
//设置动画时长
self.tomCatView.animationDuration = 30*0.075;
//设置动画重复次数
self.tomCatView.animationRepeatCount = 1;
//开始动画
[self.tomCatView startAnimating];
}
- (IBAction)footRightAction:(UIButton *)sender {
//创建可变数组images,负责存放要播放的图片数组
NSMutableArray *images = [NSMutableArray array];
for (NSInteger i = 0;i < 30;i++) {
//根据i来加载图片,然后添加到可变数组images里面
NSString *imageName = [NSString stringWithFormat:@"footRight_%02ld.jpg",i];
//根据格式化的图片名加载图片image
UIImage *image = [UIImage imageNamed:imageName];
//将图片image添加到数组images中
[images addObject:image];
}
//设置动画图片数组
self.tomCatView.animationImages = images;
//设置动画时长
self.tomCatView.animationDuration = 30*0.075;
//设置动画重复次数
self.tomCatView.animationRepeatCount = 1;
//开始动画
[self.tomCatView startAnimating];
}
- (IBAction)eatBirdAction:(UIButton *)sender {
//创建可变数组images,负责存放要播放的图片数组
NSMutableArray *images = [NSMutableArray array];
for (NSInteger i = 0;i < 40;i++) {
//根据i来加载图片,然后添加到可变数组images里面
NSString *imageName = [NSString stringWithFormat:@"eat_%02ld.jpg",i];
//根据格式化的图片名加载图片image
UIImage *image = [UIImage imageNamed:imageName];
//将图片image添加到数组images中
[images addObject:image];
}
//设置动画图片数组
self.tomCatView.animationImages = images;
//设置动画时长
self.tomCatView.animationDuration = 40*0.075;
//设置动画重复次数
self.tomCatView.animationRepeatCount = 1;
//开始动画
[self.tomCatView startAnimating];
}
- (IBAction)pieAction:(UIButton *)sender {
//创建可变数组images,负责存放要播放的图片数组
NSMutableArray *images = [NSMutableArray array];
for (NSInteger i = 0;i < 24;i++) {
//根据i来加载图片,然后添加到可变数组images里面
NSString *imageName = [NSString stringWithFormat:@"pie_%02ld.jpg",i];
//根据格式化的图片名加载图片image
UIImage *image = [UIImage imageNamed:imageName];
//将图片image添加到数组images中
[images addObject:image];
}
//设置动画图片数组
self.tomCatView.animationImages = images;
//设置动画时长
self.tomCatView.animationDuration = 24*0.075;
//设置动画重复次数
self.tomCatView.animationRepeatCount = 1;
//开始动画
[self.tomCatView startAnimating];
}
- (IBAction)stomachAction:(UIButton *)sender {
//创建可变数组images,负责存放要播放的图片数组
NSMutableArray *images = [NSMutableArray array];
for (NSInteger i = 0;i < 34;i++) {
//根据i来加载图片,然后添加到可变数组images里面
NSString *imageName = [NSString stringWithFormat:@"stomach_%02ld.jpg",i];
//根据格式化的图片名加载图片image
UIImage *image = [UIImage imageNamed:imageName];
//将图片image添加到数组images中
[images addObject:image];
}
//设置动画图片数组
self.tomCatView.animationImages = images;
//设置动画时长
self.tomCatView.animationDuration = 34*0.075;
//设置动画重复次数
self.tomCatView.animationRepeatCount = 1;
//开始动画
[self.tomCatView startAnimating];
}
- (IBAction)knockoutAction:(UIButton *)sender {
//创建可变数组images,负责存放要播放的图片数组
NSMutableArray *images = [NSMutableArray array];
for (NSInteger i = 0;i < 81;i++) {
//根据i来加载图片,然后添加到可变数组images里面
NSString *imageName = [NSString stringWithFormat:@"knockout_%02ld.jpg",i];
//根据格式化的图片名加载图片image
UIImage *image = [UIImage imageNamed:imageName];
//将图片image添加到数组images中
[images addObject:image];
}
//设置动画图片数组
self.tomCatView.animationImages = images;
//设置动画时长
self.tomCatView.animationDuration = 81*0.075;
//设置动画重复次数
self.tomCatView.animationRepeatCount = 1;
//开始动画
[self.tomCatView startAnimating];
}
- (IBAction)angryAction:(UIButton *)sender {
//创建可变数组images,负责存放要播放的图片数组
NSMutableArray *images = [NSMutableArray array];
for (NSInteger i = 0;i < 26;i++) {
//根据i来加载图片,然后添加到可变数组images里面
NSString *imageName = [NSString stringWithFormat:@"angry_%02ld.jpg",i];
//根据格式化的图片名加载图片image
UIImage *image = [UIImage imageNamed:imageName];
//将图片image添加到数组images中
[images addObject:image];
}
//设置动画图片数组
self.tomCatView.animationImages = images;
//设置动画时长
self.tomCatView.animationDuration = 26*0.075;
//设置动画重复次数
self.tomCatView.animationRepeatCount = 1;
//开始动画
[self.tomCatView startAnimating];
}
- (IBAction)scratchAction:(UIButton *)sender {
//创建可变数组images,负责存放要播放的图片数组
NSMutableArray *images = [NSMutableArray array];
for (NSInteger i = 0;i < 56;i++) {
//根据i来加载图片,然后添加到可变数组images里面
NSString *imageName = [NSString stringWithFormat:@"scratch_%02ld.jpg",i];
//根据格式化的图片名加载图片image
UIImage *image = [UIImage imageNamed:imageName];
//将图片image添加到数组images中
[images addObject:image];
}
//设置动画图片数组
self.tomCatView.animationImages = images;
//设置动画时长
self.tomCatView.animationDuration = 56*0.075;
//设置动画重复次数
self.tomCatView.animationRepeatCount = 1;
//开始动画
[self.tomCatView startAnimating];
}
- (IBAction)cymbalAction:(UIButton *)sender {
//创建可变数组images,负责存放要播放的图片数组
NSMutableArray *images = [NSMutableArray array];
for (NSInteger i = 0;i < 13;i++) {
//根据i来加载图片,然后添加到可变数组images里面
NSString *imageName = [NSString stringWithFormat:@"cymbal_%02ld.jpg",i];
//根据格式化的图片名加载图片image
UIImage *image = [UIImage imageNamed:imageName];
//将图片image添加到数组images中
[images addObject:image];
}
//设置动画图片数组
self.tomCatView.animationImages = images;
//设置动画时长
self.tomCatView.animationDuration = 13*0.075;
//设置动画重复次数
self.tomCatView.animationRepeatCount = 1;
//开始动画
[self.tomCatView startAnimating];
}
- (IBAction)fartAction:(UIButton *)sender {
//创建可变数组images,负责存放要播放的图片数组
NSMutableArray *images = [NSMutableArray array];
for (NSInteger i = 0;i < 28;i++) {
//根据i来加载图片,然后添加到可变数组images里面
NSString *imageName = [NSString stringWithFormat:@"fart_%02ld.jpg",i];
//根据格式化的图片名加载图片image
UIImage *image = [UIImage imageNamed:imageName];
//将图片image添加到数组images中
[images addObject:image];
}
//设置动画图片数组
self.tomCatView.animationImages = images;
//设置动画时长
self.tomCatView.animationDuration = 28*0.075;
//设置动画重复次数
self.tomCatView.animationRepeatCount = 1;
//开始动画
[self.tomCatView startAnimating];
}
- (IBAction)drinkMilkAction:(UIButton *)sender {
//创建可变数组images,负责存放要播放的图片数组
NSMutableArray *images = [NSMutableArray array];
for (NSInteger i = 0;i < 81;i++) {
//根据i来加载图片,然后添加到可变数组images里面
NSString *imageName = [NSString stringWithFormat:@"drink_%02ld.jpg",i];
//根据格式化的图片名加载图片image
UIImage *image = [UIImage imageNamed:imageName];
//将图片image添加到数组images中
[images addObject:image];
}
//设置动画图片数组
self.tomCatView.animationImages = images;
//设置动画时长
self.tomCatView.animationDuration = 81*0.075;
//设置动画重复次数
self.tomCatView.animationRepeatCount = 1;
//开始动画
[self.tomCatView startAnimating];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end