AVISO: Cualquier pregunta que no cumpla ninguno de estos criterios podrá ser borrada sin previo aviso.

Hola,

Estoy intentando hacer una doble animación con imagenes.

La primera simplemente consiste en ir pasando las imagenes una detrás de otra y eso ya lo he conseguido de la siguiente manera.

//load all the frames of our animation

imagenesFondo.animationImages = [NSArray arrayWithObjects:  
                                [UIImage imageNamed:@"wallpaper-592277.jpg"],
                                [UIImage imageNamed:@"wallpaper-948312.jpg"],
                                [UIImage imageNamed:@"wallpaper-1011621.jpg"],
                                [UIImage imageNamed:@"wallpaper-1011849.jpg"],
                                 nil];

// all frames will execute in 5 seconds
imagenesFondo.animationDuration = 15;
// repeat the annimation forever
imagenesFondo.animationRepeatCount = 0;
// start animating
[imagenesFondo startAnimating];

// add the animation view to the main window 
[self.view addSubview:imagenesFondo];

Pero la segunda parte que es que las imagenes cuando aparezcan tengan zoom y se vaya alejando hasta que pase a la siguiente imagen no soy capaz de conseguirlo. Alguien sabe como puedo hacerlo????? Algún ejemplo, tutorial de este tipo de animación????

Muchas gracias de antemano!

preguntado 14 Jun '11, 13:35

Bosspopuli84's gravatar image

Bosspopuli84
1457

editó 14 Jun '11, 13:36


Hola,

Investiga sobre CGAffineTransform a ver si te sirve para hacer lo que quieres. En la web de Erica Sadun tienes ejemplos para descargar que puede que te ayuden.

Saludos y suerte!

enlace permanente

respondido 14 Jun '11, 21:29

Saro's gravatar image

Saro
5591510

editó 14 Jun '11, 21:30

Hola,

yo para el hacer un zoom de varios objetos algunos uiimageview con animación. Utilizo el código que adjunto al final del post, mira si lo puedes adaptar a tus necesidades o si te sirve como ejemplo.

creo q lo saque de aquí, pero no estoy seguro http://cocoadevblog.com/iphone-tutorial-uiimage-with-zooming-tapping-rotation

suerte

Òscar



#define ZOOM_VIEW_TAG 100
#define ZOOM_STEP 10
#define ZOOM_MAX 100.0
#define ZOOM_MIN 1.0
#define ZOOM_TIME 2.5

@interface JungleViewController (UtilityMethods)
- (CGRect)zoomRectForScale:(float)scale withCenter:(CGPoint)center;
@end

- (IBAction)ZoomIn:(id)sender{

float newScale = [MainScrollView zoomScale] * ZOOM_STEP;

CGPoint newCenter = [sender center]; //centra el zoom en el btn

[UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:ZOOM_TIME];
    CGRect zoomRect = [self zoomRectForScale:newScale withCenter:newCenter];

[UIView setAnimationCurve:UIViewAnimationCurveEaseOut];
    [MainScrollView zoomToRect:zoomRect animated:NO];

[UIView commitAnimations];

…..

}

- (void)BuildZoomIn:(id)sender{

// set the tag para todos los objects q te interese hacer el zoom (solo se hace zoom a los objetos con el mismo tag q la mainScrollView)

[myboton setTag:ZOOM_VIEW_TAG];
    [myuiimageview setTag:ZOOM_VIEW_TAG];       
    /…

}
- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView {
    return [MainScrollView viewWithTag:100];

}

#pragma mark Utility methods
- (CGRect)zoomRectForScale:(float)scale withCenter:(CGPoint)center {

CGRect zoomRect;

// the zoom rect is in the content view's coordinates. 
    //    At a zoom scale of 1.0, it would be the size of the imageScrollView's bounds.
    //    As the zoom scale decreases, so more content is visible, the size of the rect grows.
    zoomRect.size.height = [MainScrollView frame].size.height / scale;
    zoomRect.size.width  = [MainScrollView frame].size.width  / scale;

// choose an origin so as to get the right center.
    zoomRect.origin.x    = center.x - (zoomRect.size.width  / 2.0);
    zoomRect.origin.y    = center.y - (zoomRect.size.height / 2.0);
    return zoomRect;
}
enlace permanente

respondido 15 Jun '11, 14:05

oscar's gravatar image

oscar
2161110

Tu respuesta:
Activar/desactivar vista previa

Sobre esta pregunta

Etiquetas de la pregunta:

×205
×37
×3

Pregunta realizada el: 14 Jun '11, 13:35

Pregunta visitada: 1,042 veces

Última modificación: 15 Jun '11, 14:05

Seguir esta pregunta

Por Email:

Una vez que entres podrás suscribirte desde aquí para recibir actualizaciones

Por RSS:

Respuestas

Respuestas y Comentarios

Realizar Donación