I have an outline of a circle I’m using to represent a ‘shield’ on a character. At certain intervals he can create a new shield, at which point I scale an image of an unfilled circle up to the point I want. The only problem I’m having is that whenever I scale up a circle, it progressively gets thicker and thicker. This is not what I want. Is there a way to fix this? I know @kpulv has a ninescale class that works with rectangular stuff, I don’t think it’ll work with circles though. Any ideas?
Increasing the scale of an un-filled circle without changing the stroke?
You should use circlePlus and you should define “fill” boolean “false”.
scale = 1; scale = 22; scale = 300; no matter, all it works…
Draw.circlePlus(x, y, 100*scale, 0xFFFFFF, 1, false, 1*scale)
You should define a “scale” variable and apply(multiply) it to circle radius and thick size both.
Will the Draw class work with dynamically adjusting scales? I don’t have much experience with it. I guess I’ll look into it
It seems like the API strongly suggests to only use it when testing and debugging. Is there another way?
Create two circle graphics, one for the fill and one for the outline and stack them on top of each other. Then, change the size so the outline is always a fixed size larger.
function setShieldSize(diameter:Number):void
{
// Set the fill size.
circleFill.height = diameter;
circleFill.width = diameter;
// Set the outline size.
circleOutline.height = diameter + 10;
circleOutline.width = diameter + 10;
}
I can’t make an outline like that though can I? Won’t a transparent inner circle just show the color of the outer circle?
I’d redraw the circle each time you resize it, using the Draw API with a BitmapData. It can be used just fine, as long as you don’t use Draw for lots of stuff each frame (so store the result on a BitmapData which would be your graphic, and only redraw it when your circle changes).
I should say, I was going to use zach lewis’ solution but the game turned out differently so I ended up not needing what I originally asked for.