ios - How to rotate a UIView around it's proper center without distortion / skew -
i've built own animation engine, , want set rotation of ui view on each frame render (60fps)
i've made video showing problem currently.
it's close, it's still rotating in strange way:
https://www.youtube.com/watch?v=1zkk4r0-6i4
i've implemented custom customuiview class, inherits ui view. has translation, scaling , rotation properties, when transform matrix, 3 happen in same action.
var t = cgaffinetransform( translationx: self.translation.x, y: self.translation.y ); // apply scaling t = t.scaledby( x: self.scaling.x, y: self.scaling.y ); // apply rotation t = t.rotated(by:self.rotation) self.transform = t
and size , width set this:
view.frame.size.width = parsesize(value, axis: "width") view.layer.bounds.size.width = parsesize(value, axis: "width")
i'm trying set both of these properties, i'm not sure if correct.
i've set anchor point lot, , tried overall center point of view well.
the problem was setting transform more once per animation frame. causing compound effect different values. need organise variables set transform once during property modifications.
Comments
Post a Comment