Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- - (void) scaleFrom: (float) s_old
- to: (float) s_new
- time: (float) t
- {
- CABasicAnimation * scaleAnimation = [CABasicAnimation animationWithKeyPath: @"transform.scale"];
- [scaleAnimation setDuration: t ];
- [scaleAnimation setFromValue: (id) [NSNumber numberWithDouble: s_old] ];
- [scaleAnimation setToValue: (id) [NSNumber numberWithDouble: s_new] ];
- [scaleAnimation setTimingFunction: [CAMediaTimingFunction functionWithName: kCAMediaTimingFunctionEaseOut] ];
- [scaleAnimation setFillMode: kCAFillModeForwards];
- scaleAnimation.removedOnCompletion = NO;
- [self.contentsLayer addAnimation: scaleAnimation
- forKey: @"transform.scale"];
- if (self.displayShadow && self.shadowLayer)
- [self.shadowLayer addAnimation: scaleAnimation
- forKey: @"transform.scale"];
- size = s_new;
- }
- // - - -
- - (void) resize: (float) newSize
- {
- [self scaleFrom: size
- to: newSize
- time: 1.];
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement