let circleWH: CGFloat = 10
var progress: CGFloat = 1
let con = UIGraphicsGetCurrentContext()!
let centerX = (rect.width - circleWH * progress) / 2
let centerY = (rect.height - circleWH * progress) / 2
let gap: CGFloat = 8
// top left
con.addEllipse(in:
CGRect(
x: centerX - gap,
y: centerY - gap,
width: circleWH * progress,
height: circleWH * progress))
// top right
con.addEllipse(in:
CGRect(
x: centerX + gap,
y: centerY - gap,
width: circleWH * progress,
height: circleWH * progress))
// bottom left
con.addEllipse(in:
CGRect(
x: centerX - gap,
y: centerY + gap,
width: circleWH * progress,
height: circleWH * progress))
// bottom right
con.addEllipse(in:
CGRect(
x: centerX + gap,
y: centerY + gap,
width: circleWH * progress,
height: circleWH * progress))
con.setFillColor(themeColor.cgColor)
con.fillPath()
网友评论