So i have this vector in for a rating system in PaintCode
I would like to be able to fill the colors partially. Like this:
Can this be accomplished in PaintCode?
Yes, it’s possible.
How did I do that:
Created a numeric variable Stars that is supposed to be from 0 to 5. This will be a parameter of the canvas:
- (void)drawRatingWithStars: (CGFloat)stars;
Created an expression variable Width like 100 / 5 * stars
, where 100 is the width of all 5 stars.
Edit: The GIF animation was exported from PaintCode using a helper fraction variable Animation, which I animated from 0 to 1 (in GIF export settings). I then changed Stars to be an expression with this content 5 - 10 * abs(animation - 0.5)
. That maps numbers in 0..1
to 0..5..0
.