非常酷的像素化动画的 UIView 的子类:CRPixellatedView
jopen
10年前
CRPixellatedView 是自定义的 UIView 子类,拥有非常酷的像素化动画,灵感来源于 非死book 的 Slinghot 应用。
An example of making a CRPixellatedView:
CRPixellatedView *pixellatedView = [[CRPixellatedView alloc] initWithFrame:CGRectMake(0, 0, 320, 320)]; pixellatedView.image = [UIImage imageNamed:@"Image"]; [self.view addSubview:pixellatedView]; // Add to your view [pixellatedView animate];
You can configure this settings, customizable example:
CRPixellatedView *pixellatedView = [[CRPixellatedView alloc] initWithFrame:CGRectMake(0, 0, 320, 320)]; pixellatedView.image = [UIImage imageNamed:@"Image"]; pixellatedView.pixelScale = 20.0f; pixellatedView.animationDuration = 0.8f; [self.view addSubview:pixellatedView]; // Add to your view [pixellatedView animateWithCompletion:^(BOOL finished) { NSLog(@"completed"); }];
Also, you can customize the animation effect using the reverse
property:
CRPixellatedView *pixellatedView = [[CRPixellatedView alloc] initWithFrame:CGRectMake(0, 0, 320, 320)]; pixellatedView.image = [UIImage imageNamed:@"Image"]; pixellatedView.pixelScale = 20.0f; pixellatedView.animationDuration = 0.8f; pixellatedView.reverse = YES; // Reverse effect [self.view addSubview:pixellatedView]; // Add to your view [pixellatedView animateWithCompletion:^(BOOL finished) { NSLog(@"completed"); }];