ios - How do I make shape rotate on its axis? -
the hexagon rotates, wont stay in place , rotate. need change in order spin clockwise once every single time button clicked.
shape6 = cashapelayer() view.layer.addsublayer(shape6) shape6.opacity = 0.5 shape6.linewidth = 2 shape6.linejoin = kcalinejoinmiter shape6.strokecolor = uicolor(hue: 0.786, saturation: 0.79, brightness: 0.53, alpha: 1.0).cgcolor shape6.fillcolor = uicolor(hue: 0, saturation: 0, brightness: 0, alpha: 0).cgcolor path6 = uibezierpath() path6.movetopoint(cgpointmake(35,430)) path6.addlinetopoint(cgpointmake(80, 300)) path6.closepath() shape6.path = path6.cgpath @ibaction func ispin(sender: anyobject) { uiview.animatewithduration(1.0, animations: ({ self.shape1.transform = catransform3dmakerotation(30, 150, 400, 20) self.shape2.transform = catransform3dmakerotation(30, 150, 400, 20) self.shape3.transform = catransform3dmakerotation(30, 150, 400, 20) self.shape4.transform = catransform3dmakerotation(30, 150, 400, 20) self.shape5.transform = catransform3dmakerotation(30, 150, 400, 20) self.shape6.transform = catransform3dmakerotation(30, 150, 400, 20) })) }
try setting anchor point of shape shape6
:
shape6.anchorpoint = cgpointmake(0.5, 0.5)
Comments
Post a Comment