SCNMaterialProperty.contents
のドキュメントでは、アニメーション可能なプロパティであり、実際には2つの色の間のクロスフェードを実行できます。しかし、私は2つの画像をクロスフェードできません。SceneKit - クロスフェードマテリアルプロパティテクスチャ
だから私はこれがまったく可能か、これに対してカスタムシェーダを作成する必要があるのだろうかと思っています。何もしない
node.geometry.firstMaterial.diffuse.contents = [UIImage imageNamed:@"before"];
[SCNTransaction begin];
[SCNTransaction setAnimationDuration:5];
node.geometry.firstMaterial.diffuse.contents = [UIImage imageNamed:@"after"];
[SCNTransaction commit];
明示的なアニメーション、::
CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"contents"];
animation.fromValue = (__bridge id)[UIImage imageNamed:@"before"].CGImage;
animation.toValue = (__bridge id)[UIImage imageNamed:@"after"].CGImage;
animation.duration = 5;
[node.geometry.firstMaterial.diffuse addAnimation:animation forKey:nil];
私はそれがすぐにイメージ '後' を示し、その場合には、暗黙的なアニメーションを、試してみた
CALayer
は、何もしません。
CALayer *textureLayer = [CALayer layer];
textureLayer.frame = CGRectMake(0, 0, 793, 1006);
textureLayer.contents = (__bridge id)[UIImage imageNamed:@"before"].CGImage;
node.geometry.firstMaterial.diffuse.contents = textureLayer;
CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"contents"];
animation.fromValue = (__bridge id)[UIImage imageNamed:@"before"].CGImage;
animation.toValue = (__bridge id)[UIImage imageNamed:@"after"].CGImage;
animation.duration = 5;
[textureLayer addAnimation:animation forKey:nil];
同じマテリアルプロパティの2つの内容値の間ではなく、2つのマテリアル間で変更をアニメーション化しようとしましたか? – rickster