I'm trying to have several ellipses centered with different sizes and different rotations around their center but I'm getting this:
My playground code so far:
import UIKit
func radians(x: Int)->CGFloat{
let pi = M_PI
return CGFloat(pi * Double(x) / 180.0)
}
let size = CGSize(width: 600, height: 600)
UIGraphicsBeginImageContextWithOptions(size, true, 0.0)
let context = UIGraphicsGetCurrentContext()
CGContextSetStrokeColorWithColor(context, UIColor.whiteColor().CGColor);
let center:CGPoint=CGPointMake(size.width/2, size.height/2)
CGContextSetLineWidth(context, 2.0);
var step=0
while step<12{
var width:CGFloat = 25.0+CGFloat(step)*20.0
var height:CGFloat = 100.0+CGFloat(step)*20.0
CGContextRotateCTM( context, radians( 10 ) ) ;
var circle:CGRect = CGRectMake(center.x-width/2,center.y-height/2,width,height);
CGContextAddEllipseInRect(context, circle);
CGContextStrokePath(context);
step++
}
let image = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()