2012-03-23 10 views
5

Otro problema con la animación en una capa para que sea la escala y muestran como el crecimiento de la parte inferior izquierda, algo similar a la figura:CALayer animación escala de tamaño de la capa a partir de la parte inferior izquierda a la superior derecha

---------------  
|    | 
|---------- | 
|   | | 
|   | | 
|----- | | 
| | | | 
--------------- 

tengo intenté algunas animaciones pero no pude lograrlo exactamente de la manera que quiero. Por favor sugiera. Actualmente utilizando el siguiente código para escalar:

layer.anchorPoint = CGPointMake(1, 1); 
CABasicAnimation *scale = [CABasicAnimation animationWithKeyPath:@"transform.scale"]; 
[scale setFromValue:[NSNumber numberWithFloat:0.0f]]; 
[scale setToValue:[NSNumber numberWithFloat:1.0f]]; 
[scale setDuration:1.0f]; 
[scale setRemovedOnCompletion:NO]; 
[scale setFillMode:kCAFillModeForwards]; 
+1

acaba de editar mi pregunta. – Amit

Respuesta

6

Debe establecer un punto de anclaje diferente para lograr ese efecto.

layer.anchorPoint = CGPointMake(0.0f, 1.0f); 
1

Todo esto no funciona para mí. Los métodos que marcos de fijación y puntos

- (CGRect) fixRect:(CGRect)rect inRect:(CGRect)container 
{ 
    CGRect frame = rect; 
    frame.origin.y = container.size.height - frame.origin.y - frame.size.height; 
    return frame; 
} 
- (CGPoint) fixPoint:(CGPoint)point fromPoint:(CGSize)containerSize 
{ 
    CGPoint frame = point; 
    frame.y = size.height - frame.y; 
    return frame; 
} 
1

espero que esto le puede ayudar a:

let frame = pathView.frame 
let anchorPoint = CGPointMake(0, 1) //Set the animation direction 
let position = CGPointMake(frame.origin.x + anchorPoint.x * frame.size.width, frame.origin.y + anchorPoint.y * frame.size.height) 
pathView.layer.anchorPoint = anchorPoint 
pathView.layer.position = position 
UIView.animateWithDuration(0.8){() -> Void in 
    pathView.layer.transform = CATransform3DMakeScale(0.5, 0.5, 1) 
} 
Cuestiones relacionadas