-initWithKeyframeValues:times:
INDEX>Sprite Kit>SKKeyframeSequence
- (instancetype)initWithKeyframeValues:(NSArray *)values times:(NSArray *)times
解説
返り値
引数
フレームワーク
Sprite Kit
クラス
SKKeyframeSequence
使用可能
iOS 7.0以降
定義
SKKeyframeSequence.h
参照
例文
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { /* Called when a touch begins */ for (UITouch *touch in touches) { //位置設定 CGPoint location = [touch locationInNode:self]; //パーティクルファイルのURL NSURL *particleURL = [[NSBundle mainBundle] URLForResource:@"FireParticle" withExtension:@"sks"]; //パーティクルのデータを読み込み NSData *aData = [NSData dataWithContentsOfURL: particleURL ]; //パーティクル作成 SKEmitterNode *fireParticle = [NSKeyedUnarchiver unarchiveObjectWithData: aData ]; fireParticle.position = location; fireParticle.numParticlesToEmit = 100; //シーンにパーティクルを追加 [self addChild:fireParticle]; SKKeyframeSequence * scaleSequence = [[SKKeyframeSequence alloc] initWithKeyframeValues:@[@0.2,@0.7,@0.1] times:@[@0.0,@0.550,@0.75]]; fireParticle.particleScaleSequence = scaleSequence; } }