Core Animation no funciona con el valor "alpha"


Antes de este código, mi película pic alpha se establece en 0,

CABasicAnimation* fadein= [CABasicAnimation animationWithKeyPath:@"alpha"];
    [fadein setToValue:[NSNumber numberWithFloat:1.0]];
    [fadein setDuration:0.5];
    [[moviepic layer]addAnimation:fadein forKey:@"alpha"];

No pasó nada, si establezco alfa a 0.5 de antemano en su lugar, el alfa permanece en 0.5 y no se anima a 1.

He visto un código usando UIView beginAnimations:, pero estoy enseñando core animation, así que me pregunté por qué CABasicAnimation no puede hacer una tarea simple como esta.

Author: 5argon, 2011-09-23

2 answers

[CABasicAnimation animationWithKeyPath:@"opacity"];

UIView expone esto como alpha donde as CALayer expone esto como opacity.

 93
Author: ohho,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2011-09-23 04:24:23

@ohho responde la pregunta publicada. El mío será un poco más genérico. Para obtener una lista de lo que se puede y cómo se puede animar con CABasicAnimation, consulte La documentación de Apple

 0
Author: Julian Król,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-10-28 10:57:44