Alterar a cor da CALayer enquanto anima

ABORDAGEM 1

CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"strokeStart"];
 [CATransaction begin];
    {
        [CATransaction setAnimationDuration:15];//Dynamic Duration
        [CATransaction setCompletionBlock:^{

        }];

        animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];
        animation.autoreverses = NO;
        animation.removedOnCompletion = NO;
        animation.fromValue = @0;
        animation.toValue = @1;
        animation.timeOffset = 0;
        animation.fillMode = kCAFillModeForwards;
        [self.pathLayer addAnimation:animation forKey:animationKey];

    }
    [CATransaction commit];

Eu adicionei CAShapeLayer (pathLayer) na minha opinião e eu quero animar em torno da visão com efeito de traço, o código acima faz o trabalho, mas o meu problema é mudar de cor em 3 proporções iguais. Então, o que eu estou supondo é repetir o código acima 3 vezes e alterar as linhas a seguir na ordem respectiva.

para o 1º

    animation.fromValue = @0;
    animation.toValue = @(1/3);
    animation.timeOffset = 0;

para o 2º

    animation.fromValue = @(1/3);
    animation.toValue = @(2/3);
    animation.timeOffset = 0;// I don't know how to exactly set this  active local 
time since the duration which is currently 15 is dynamic can be 30 or 10.

para o 3º

    animation.fromValue = @(2/3);
    animation.toValue = @(3);
    animation.timeOffset = 0;// Active local time- Not sure how and which value to set 

ABORDAGEM 2

Em vez de 3 transações com técnica de offset, vamos iniciar a 2ª transação quando a 1ª for concluída e a 3ª a 2ª. Mas a fração de tempo que é levada para iniciar a nova animação quando uma é concluída, um lag / jerk é visível.

ABORDAGEM 3

SubClass CAShapeLayer

Ao fazer SubClass, o método drawInContext é chamado apenas uma vez, e se alguma propriedade extra for adicionada e for alterada, o método drawInContext será chamado repetidamente e, dessa forma, a cor da camada poderá ser alterada após um período específico de progresso. Mas substituir o método drawInContext não serve ao propósito.

Alguma sugestão ? Eu não quero implementar o NSTimer separadamente.

questionAnswers(1)

yourAnswerToTheQuestion