我想创建一个包含几个关键帧的动画.我希望我的Layer(在这种情况下是一个按钮)可以扩展到1.5然后降低到0.5然后升级到1.2然后降低到0.8然后降低到1.0.
我还想要每个关键帧的EaseIn和EaseOut.
你可以想象,这会在现场产生一个Springy/Bounce效果.
在我的应用程序的其他部分,我一直在使用CAKeyframeAnimation(见下面的代码).这会产生类似的弹性动画,但是对于x和y位置.
我可以调整以下代码来影响比例而不是位置吗?
先感谢您!
- (CAAnimation*)monInAnimation {
CGMutablePathRef path = CGPathCreateMutable();
CGPathMoveToPoint(path,NULL,113,320);
CGPathAddLineToPoint(path, NULL, 113.5, 283);
CGPathAddLineToPoint(path, NULL, 113.5, 179);
CGPathAddLineToPoint(path, NULL, 113.5, 207);
CGPathAddLineToPoint(path, NULL, 113.5, 187);
CGPathAddLineToPoint(path, NULL, 113.5, 199);
CGPathAddLineToPoint(path, NULL, 113.5, 193);
CGPathAddLineToPoint(path, NULL, 113.5, 195);
CGPathAddLineToPoint(path, NULL, 113.5, 194);
CAKeyframeAnimation *
animation = [CAKeyframeAnimation
animationWithKeyPath:@"position"];
[animation setPath:path];
[animation setDuration:1.5];
[animation setCalculationMode:kCAAnimationLinear];
NSArray *arr = [NSArray arrayWithObjects:[NSNumber numberWithFloat:0.0],
[NSNumber numberWithFloat:0.12],
[NSNumber numberWithFloat:0.24],
[NSNumber numberWithFloat:0.36],
[NSNumber numberWithFloat:0.48],
[NSNumber numberWithFloat:0.60],
[NSNumber numberWithFloat:0.72],
[NSNumber numberWithFloat:0.84],
[NSNumber numberWithFloat:1.0],nil]; …Run Code Online (Sandbox Code Playgroud) 我有一个基于小型的iPhone应用程序.我需要为每个级别加载和释放声音文件.除了释放声音之外,我的openAL SoundManager一切正常.
首先,当我移除声音时,它似乎做了它应该做的事情 - 除去声音,除非我重新加载,否则我无法再次访问它.但是,当我用'仪器'测试我的应用程序dealloc时,它没有显示任何释放.它似乎没有释放内存.因此,当您从一个级别移动到另一个级别时,内存耗尽并且应用程序崩溃不会花费很长时间.
我在控制台中收到此错误:
程序接收信号:"0".警告:check_safe_call:无法恢复当前帧kill quit
这是我加载声音的方式 -
- (void)loadSoundWithKey:(NSString*)aSoundKey fileName:(NSString*)aFileName fileExt:(NSString*)aFileExt {
// Check to make sure that a sound with the same key does not already exist
NSNumber *numVal = [soundLibrary objectForKey:aSoundKey];
// If the key is found log it and finish
if(numVal != nil) {
NSLog(@"WARNING - SoundManager: Sound key '%@' already exists.", aSoundKey);
return;
}
NSUInteger bufferID;
// Generate a buffer within OpenAL for this sound
alGenBuffers(1, &bufferID);
// Set up the variables which …Run Code Online (Sandbox Code Playgroud) 我注意到,当使用IB将PNG图像放入视图和/或将这些图像设置为视图周围的不同位置时,图像有时会出现轻微模糊.
在大多数情况下,我可以通过在图像位置添加.5像素来弥补模糊.
[lbLiteButton.layer setPosition:CGPointMake(140.5,159.5)];
Run Code Online (Sandbox Code Playgroud)
有时我必须像上面那样调整x和y.有时我只需要调整x 或 y.
我记得在某处读到这与图像的大小以及核心动画的工作原理以及与半像素的关系有关......但我无法在任何地方找到这篇文章!?
".5像素"解决方案的问题在于每个PNG图像的大小不同,因此您无法重复使用自定义动画,因为您必须为每个不同的图像自定义它.
谢谢!
我的iPhone应用程序上有一个OpenAl声音引擎.当我播放我加载的声音时,我可以控制它的音高.
在OpenAl中,设置为1.0的音高无效.如果你把它加倍到2.0,它会弹奏1个八度的音符(12个半音).如果你把它减半,到0.5,它将是一个八度音程(12个半音).
所以,我原来的样品被打C.我认为,如果我把1×12(个半音)我可以得到在八度音程的各个音符的音高.但事实似乎并非如此.这让我们认为半音不是平等的价值观.真的吗?
有谁知道如何计算八度音中单个音符的openAl音高值?
谢谢
当我安装测试版时,我会将自定义安装到最新版本的单独文件夹中.我有几个旧的测试版安装.
如何卸载Xcode的旧自定义版本?
我可以把文件夹丢弃吗?
我需要使用终端吗?
发行说明建议使用此:
$ sudo/Library/uninstall-devtools --mode = all
但这只是卸载我原来的官方发布版本3.2吗?
谢谢.
我来自2D动画背景,所以当我使用动画序列时,我更喜欢使用一系列图像.对我而言,这很有意义,因为您可以轻松地从合成/编辑软件导出图像序列,并轻松定义方面.
我是游戏开发的新手,对使用精灵表感到好奇.有什么优点和缺点.文件大小是个问题吗? - 对我来说,似乎一堆小图像与一个大图像相同.此外,定义精灵的每个单独区域似乎时间繁琐.
基本上,我不明白为什么你会使用精灵表 - 请赐教.
谢谢
我有一个UIImageView,它有一个png图像序列加载到它.
我的问题是 - 你知道我能用什么方式"打乒乓"动画片段吗?因此它从1-24向前播放然后从24-1向后播放并循环播放.
(技术上应该是:1-24然后23-1然后2-24然后23-1 ......等)
- (void) loadAnim01 {
mon01 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"mon01_01.png"]];
mon01.center = CGPointMake(258,69);
NSMutableArray *array = [NSMutableArray array];
for (int i = 1; i <= 24; i++)
[array addObject:[UIImage imageNamed:[NSString stringWithFormat:@"mon01_%02d.png",i]]];
mon01.animationImages = array;
mon01.animationDuration = 1.0;
mon01.animationRepeatCount = 0;
[self.view addSubview:mon01];
[mon01 release];
Run Code Online (Sandbox Code Playgroud)
}
非常感谢!