objective c - Is it possible to change UIImageView color while rotating image using CABasicAnimation? -
i able rotate uiimageview cabasicanimation, wondering if it's possible change color of image while rotates, transitions particular color?
yes it's possible. can add multiple ca animations object. can place them in group , control timing , other parameters group.
for example:
// make animation group let myanimations = caanimationgroup() myanimations.duration = 1 myanimations.timingfunction = camediatimingfunction(name: kcamediatimingfunctioneaseineaseout) // make opacity animation let opacity = cabasicanimation(keypath: "opacity") opacity.fromvalue = 0 opacity.tovalue = 100 // make bg color animation let color = cabasicanimation(keypath: "backgroundcolor") color.fromvalue = uicolor.redcolor().cgcolor color.tovalue = uicolor.bluecolor().cgcolor // make position animation let position = cabasicanimation(keypath: "position.y") position.fromvalue = 0 position.tovalue = contentview.center.y - 80 // add animations group myanimations.animations = [opacity, position, color] // add group layer myobject.layer.addanimation(placeanimation, forkey: "myanimations")
Comments
Post a Comment