椭圆运动
来源:互联网 发布:java mvc模式的理解 编辑:程序博客网 时间:2024/04/29 12:37
//// YGJViewController.m//#define PX 160#define PY 240#define TUOYUAN_A 100#define TUOYUAN_B 100#define TUOYUAN_A1 50#define TUOYUAN_B1 50#define JIAODU_2_HUDU(x) (x)/180.0*M_PI)#define ZIZHUANJIAODU_2_HUDU _angel1/180.0*M_PI#import "YGJViewController.h"#import "YGJTianQiViewController.h"#import "YGJAppDelegate.h"@interface YGJViewController (){ int _angel; NSTimer *_timer; int _count;}@property (weak, nonatomic) IBOutlet UIButton *btn1;@property (weak, nonatomic) IBOutlet UIButton *btn2;@property (weak, nonatomic) IBOutlet UIButton *btn3;@property (weak, nonatomic) IBOutlet UIButton *btn4;@end@implementation YGJViewController- (void)viewDidLoad{ [super viewDidLoad];// Do any additional setup after loading the view, typically from a nib.}- (IBAction)btn1Click:(id)sender { YGJTianQiViewController *vc=[[YGJTianQiViewController alloc]init]; YGJAppDelegate *app=[UIApplication sharedApplication].delegate; UIWindow *window=app.window; window.rootViewController=vc; _timer=[NSTimer scheduledTimerWithTimeInterval:0.01 target:self selector:@selector(gongZhuan) userInfo:nil repeats:YES]; }- (IBAction)btn2Click:(id)sender { _timer=[NSTimer scheduledTimerWithTimeInterval:0.01 target:self selector:@selector(gongZhuan) userInfo:nil repeats:YES]; }- (IBAction)btn3Click:(id)sender { _timer=[NSTimer scheduledTimerWithTimeInterval:0.01 target:self selector:@selector(gongZhuan) userInfo:nil repeats:YES]; }- (IBAction)btn4Click:(id)sender { _timer=[NSTimer scheduledTimerWithTimeInterval:0.01 target:self selector:@selector(gongZhuan) userInfo:nil repeats:YES]; }- (IBAction)yuanZhouyunDong:(id)sender { }-(void)gongZhuan{ /*椭圆的标准方程:x^2/a^2 + y^2/b^2 = 1
*/
_angel++; if (_angel%90==0) { [_timer invalidate]; } float x=PX + TUOYUAN_A*cos(JIAODU_2_HUDU(_angel-90); float y=PY + TUOYUAN_B*sin(JIAODU_2_HUDU(_angel-90); _btn1.center=CGPointMake(x, y); float x4=PX + TUOYUAN_A*cos(JIAODU_2_HUDU(_angel); float y4=PY + TUOYUAN_B*sin(JIAODU_2_HUDU(_angel); _btn4.center=CGPointMake(x4, y4); float x3=PX + TUOYUAN_A*cos(JIAODU_2_HUDU(_angel+90); float y3=PY + TUOYUAN_B*sin(JIAODU_2_HUDU(_angel+90); _btn3.center=CGPointMake(x3, y3); float x2=PX + TUOYUAN_A*cos(JIAODU_2_HUDU(_angel+180); float y2=PY + TUOYUAN_B*sin(JIAODU_2_HUDU(_angel+180); _btn2.center=CGPointMake(x2, y2); }- (void)didReceiveMemoryWarning{ [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated.}@end
0 0
- 椭圆运动
- 圆运动和椭圆运动公式
- javascript实现椭圆运动轨迹
- cocos2d-x 3.2 椭圆运动
- 进程和线程.View椭圆运动
- java实现椭圆运动(太阳系)
- java实现类的封装(物体实现椭圆运动)
- 椭圆
- cocos2d-x2.2实现椭圆运动,参数为中心点坐标和长半轴、短半轴
- Java通过数学函数(抛物线、正弦曲线、椭圆等)控制游戏中物体的运动
- 让精灵按照自己设定的运动轨迹行动(曲线移动)。(以椭圆轨迹为例)。
- 让精灵按照自己设定的运动轨迹行动(曲线移动)。(以椭圆轨迹为例)。
- 运动
- 运动
- cocos2d-x学习笔记(三)让精灵按照自己设定的运动轨迹行动(曲线移动)。(以椭圆轨迹为例)。
- cocos2d-x学习笔记(三)让精灵按照自己设定的运动轨迹行动(曲线移动)。(以椭圆轨迹为例)。
- (转)cocos2d-x学习笔记(三)让精灵按照自己设定的运动轨迹行动(曲线移动)。(以椭圆轨迹为例)
- cocos2d-x学习笔记(三)让精灵按照自己设定的运动轨迹行动(曲线移动)。(以椭圆轨迹为例)。
- Linux指令集
- 51nod 1264 线段相交
- (转)让用VS2012/VS2013编写的程序在XP中顺利运行
- 触发器
- 作用域
- 椭圆运动
- 图像中颜色空间简介
- Spring文件上传工具类,拿过去直接用就行了
- [leetcode:python]70.Climing Stairs
- KMP算法详解
- CodeForces
- zoj 3954 Seven-Segment Display(暴力枚举)
- PHP学习笔记———制作回调函数;
- 作用域层级和继承