Mimicking UIAlertView’s animated transition

For various reasons I ended up writing a UIView that mostly mimics the behavior of UIAlertView. UIAlertView appears on screen with pleasant animated fade in and rubber-band-like bounce of its dimensions. After struggling to reproduce this through trial and error, I gave up and just recorded video of a UIAlertView appearing. I then measured its dimensions over time. It goes through several steps, so to save anyone future effort doing the same thing, here are the phases it goes through (of course I could be a bit off, these are all hand measurements:

Before the animation starts, the view transform is 0.6, 0.6
Then a duration 0.2 animation takes us up to 1.1, 1.1
then a duration 1/15. animation down to 0.9, 0.9
then a duration 1/7.5 animation back to identity.

Here it all is wrapped in a simple method:

float pulsesteps[3] = { 0.2, 1/15., 1/7.5 };
- (void) pulse {
    self.transform = CGAffineTransformMakeScale(0.6, 0.6);
    [UIView beginAnimations:nil context:nil];
    [UIView setAnimationDuration:pulsesteps[0]];
    [UIView setAnimationDelegate:self];
    [UIView setAnimationDidStopSelector:@selector(pulseGrowAnimationDidStop:finished:context:)];
    self.transform = CGAffineTransformMakeScale(1.1, 1.1);
    [UIView commitAnimations];
}

- (void)pulseGrowAnimationDidStop:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context {  
    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:pulsesteps[1]];
    [UIView setAnimationDelegate:self];
    [UIView setAnimationDidStopSelector:@selector(pulseShrinkAnimationDidStop:finished:context:)];
    self.transform = CGAffineTransformMakeScale(0.9, 0.9);
    [UIView commitAnimations];
}

- (void)pulseShrinkAnimationDidStop:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context {
    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:pulsesteps[2]];
    self.transform = CGAffineTransformIdentity;
    [UIView commitAnimations];
}

Fanny and Alexander

Sitting through watching Fanny and Alexander for the first time, I couldn’t deal with the whole thing at once just before going to sleep, so I stopped it about half way through when it started getting really dark.

Going through the remainder, I’m glad that I waited.  But before even finishing it I was amazed by a scene enough to stop watching and start thinking.  The film dialog makes mention that the events take place in 1907 (in Sweden).  Grandmother is sitting at a table sifting through a photo album, and her son jokes about how she is sifting through thousands of photographs.  In 1907.  To think that in that era with the great effort that went into taking even a single photo, and someone is already depicted overwhelmed by the mountain of memories:

all these moments

And I know people today who have been taking digital photos vigorously for at least 10 years now, who have stacks of DVDs each of which contains hundreds of photos.  My own collection, assembled mostly since 2004, taken with what I thought was some critical eye to avoiding taking unnecessary shots, is well over 8000 photos.

Thinking about the meaning or lack and weight of all of those images.  Glancing over in the room as I type this I can see the three physical photographs that I brought home with me after my Grandmother died: one of her as a child in her mother’s arms, one of her father standing proudly by a car in pre-war Cuba.  One of her future husband standing on a ship at sea.