macOS/iOS API解説

iOS , Mac アプリケーション開発のために使われる主要フレームワークの日本語情報です。2010年代に書かれた内容です。今後更新はありません。

目次

-initWithKeyframeValues:times:

INDEX>Sprite Kit>SKKeyframeSequence

apple

- (instancetype)initWithKeyframeValues:(NSArray *)values times:(NSArray *)times

解説

返り値


引数

クラス

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;
                                                              
    }
}

編集時のバージョン

OS X 10.9
iOS 7.0