objective c - iPhone shine animation -


i'm trying view nice shining animation catch user's eyes. ideas how implement this?

here's have far:

[uiview beginanimations:@"viewshine" context:self.view]; [uiview setanimationrepeatautoreverses:no]; [uiview setanimationrepeatcount:0]; [uiview setanimationduration:2]; [uiview setanimationdelegate:self]; //do nice shining animation here [uiview commitanimations]; 

by shine mean happens "slide unlock" text when open iphone, or that's easy , looks nice.

figured out.

here's code in case want similar:

uiview *whiteview = [[uiview alloc] initwithframe:cgrectmake(0, 0, self.view.frame.size.width, self.view.frame.size.height)]; [whiteview setbackgroundcolor:[uicolor whitecolor]]; [whiteview setuserinteractionenabled:no]; [self.view addsubview:whiteview];  calayer *masklayer = [calayer layer];  // mask image ends 0.15 opacity on both sides. set background color of layer // same value layer can extend mask image. masklayer.backgroundcolor = [[uicolor colorwithred:1.0f green:1.0f blue:1.0f alpha:0.0f] cgcolor]; masklayer.contents = (id)[[uiimage imagenamed:@"shinemask.png"] cgimage];  // center mask image on twice width of text layer, starts left // of text layer , moves right when translate width. masklayer.contentsgravity = kcagravitycenter; masklayer.frame = cgrectmake(-whiteview.frame.size.width,                               0.0f,                               whiteview.frame.size.width * 2,                               whiteview.frame.size.height);  // animate mask layer's horizontal position cabasicanimation *maskanim = [cabasicanimation animationwithkeypath:@"position.x"]; maskanim.byvalue = [nsnumber numberwithfloat:self.view.frame.size.width * 9]; maskanim.repeatcount = huge_valf; maskanim.duration = 3.0f; [masklayer addanimation:maskanim forkey:@"shineanim"];  whiteview.layer.mask = masklayer; 

using image:

enter image description here


Comments

Popular posts from this blog

c++ - Is it possible to compile a VST on linux? -

java - Output of Eclipse is rubbish -

jquery - Confused with JSON data and normal data in Django ajax request -