ios - Scale a circle at same center position -


i working on scaling circle , keep same center position, looks pulsing circle on map.

animationview.m

@property (nonatomic, strong) uibezierpath *ovalpath;  - (void)drawcircle {     uigraphicsbeginimagecontext(self.frame.size);     cgrect rect = cgrectmake(25.45, 49.25, 5.8, 5.8);     self.ovalpath = [uibezierpath bezierpathwithovalinrect: rect];     [self.ovalpath fill];     uigraphicsendimagecontext(); }  - (void)bumpupcircle {     cashapelayer *pathlayer = [cashapelayer layer];      pathlayer.frame     = self.bounds;     pathlayer.path      = self.ovalpath.cgpath;     pathlayer.fillcolor = [uicolor blackcolor].cgcolor;     pathlayer.linewidth = 2.0f;     pathlayer.linejoin  = kcalinejoinbevel;     [self.layer addsublayer:pathlayer];      cabasicanimation *animation = [cabasicanimation animationwithkeypath:@"transform.scale"];     animation.fromvalue = [nsvalue valuewithcatransform3d:catransform3dmakescale(0.0, 0.0, 0)];     animation.tovalue = [nsvalue valuewithcatransform3d:catransform3dmakescale(10.0, 10.0, 10.0)];     animation.repeatcount = 1;     animation.removedoncompletion = no;     animation.fillmode = kcafillmodeforwards;     animation.duration = 1;     animation.timingfunction = [camediatimingfunction functionwithname:kcamediatimingfunctioneaseout];     [pathlayer addanimation:animation forkey:@"transform.scale"];     nslog(@"%@",nsstringfromcgpoint(self.bounds.origin)); } 

however, scaling position in strange position, rather center of circle.

any ideas appreciated. thanks.

edit:

gif uploaded

my suggestion pulsing circle, use uiview , add subview in uiviewcontroller. in following example pulsing circle (a uiview cornerradius radius) scaling , down in few lines. include e.g. in uiviewcontroller's viewdidload try out.

int radius = 100; uiview * circleview = [[uiview alloc] init]; circleview.backgroundcolor = [uicolor greencolor]; circleview.frame = cgrectmake(0, 0, radius*2, radius*2); circleview.center = self.view.center; circleview.layer.cornerradius = radius; [self.view addsubview:circleview];  [uiview animatewithduration:0.8f                       delay:0.0f                     options:uiviewanimationoptionautoreverse | uiviewanimationoptionrepeat                  animations:^{                      circleview.transform = cgaffinetransformmakescale(1.1, 1.1);                  } completion:^(bool fin) {                       // nothing                  }]; 

Comments

Popular posts from this blog

qt - Using float or double for own QML classes -

Create Outlook appointment via C# .Net -

ios - Swift Array Resetting Itself -