tupoi
@tupoi

Как сделать зацикленную анимацию с градиентом?

Добрый день, не подскажете как сделать зацикленную анимацию, для градиента?
выполняю следующий код, в итоге анимация проигрывается 1 раз и все

CAAnimationGroup *animationGroup = [CAAnimationGroup animation];
            [animationGroup setDuration:0.4];
            CABasicAnimation *firstAnimationLayer;
            CABasicAnimation *secondAnimationLayer;
            firstAnimationLayer = [CABasicAnimation animationWithKeyPath:@"startPoint"];
            firstAnimationLayer.autoreverses = YES;
            [firstAnimationLayer setRepeatCount: INFINITY];
            [firstAnimationLayer setRepeatDuration:0.3];
            [firstAnimationLayer setFromValue: [NSValue valueWithCGPoint:CGPointMake(0, 0)]];
            [firstAnimationLayer setToValue: [NSValue valueWithCGPoint:CGPointMake(0.5, 0)]];
            [firstAnimationLayer setDuration: 0.4];
            [firstAnimationLayer setBeginTime:0.0];
            
            secondAnimationLayer = [CABasicAnimation animationWithKeyPath:@"endPoint"];
            secondAnimationLayer.autoreverses = YES;
            [secondAnimationLayer setRepeatCount: INFINITY];
            [secondAnimationLayer setRepeatDuration:0.3];
            [secondAnimationLayer setFromValue: [NSValue valueWithCGPoint:CGPointMake(0.5, 0)]];
            [secondAnimationLayer setToValue: [NSValue valueWithCGPoint:CGPointMake(0.5, 1)]];
            [secondAnimationLayer setDuration: 0.4];
            [secondAnimationLayer setBeginTime:0.0];
            [animationGroup setAnimations:[NSArray arrayWithObjects:firstAnimationLayer, secondAnimationLayer, nil]];
           [self.gradient addAnimation: animationGroup forKey:nil];
  • Вопрос задан
  • 207 просмотров
Пригласить эксперта
Ответы на вопрос 1
briahas
@briahas
ObjC, Swift, Python
Как на счет - выставить setRepeatCount для CAAnimationGroup?
Ответ написан
Комментировать
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы