www.state-it.info

Gran base de respuestas a las preguntas de los desarrolladores
Header decor

Como hacer зацикленную la animación con el gradiente?

tupoi 2018-06-27 14:36:53

Buenas tardes, no saben como hacer зацикленную la animación, para el degradado?
ejecuto el siguiente código en el final de la animación se reproduce 1 vez y todo

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

tupoi 2018-06-27 15:31:39

ha Comprendido, debe poner la repetición de animación, en este caso, el grupo animaciones, y no el de cada animación por separado -_-
[animationGroup setRepeatCount:INFINITY];


Total answers: 1

briahas 2018-07-05 10:55:18

Como en la cuenta de - poner setRepeatCount para CAAnimationGroup?

Preguntas relacionadas:

Footer decor

© www.state-it.info | Base of answers to questions for developers and programmers.