View Single Post
03-05-16, 11:29 AM   #72
semlar
A Pyroguard Emberseer
 
semlar's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 1,060
Originally Posted by leblitzer View Post
This feature is really great. Are there some ways to start the rotation by an angle which is not a multiplier of 90 degrees ?
So let's say you want to make a casting bar like the one on this pick: http://imagizer.imageshack.us/a/img907/4979/vOdhsr.jpg
Would it be possible to set the same start angle ?
It has to start at a 90 degree angle because it needs a scroll frame to hide the excess part of our rotating slice texture, and the sides of the scroll frame are all at 90 degree angles.

However, if you're using a custom texture it doesn't matter because you can make that part of the image transparent. Even though the texture is "visible" from the 90 degree starting angle, if it's transparent you can't see it.

When you go to set the value of the spinner, you'll need to take into account both the new starting angle and the fact that the "total" value of the bar is no longer 100%.


For example, if we use this source texture, which has had a 90 degree (25% of 360) section removed from the top, and we want to start at 0 degrees and fill clockwise, we have to multiply our value by the size of the visible bar relative to a full circle (75% or 270 degrees) and add our starting angle, which is 45 degrees or half of 25%.

So you'd use spinner:SetValue( value * 0.75 + 0.25 / 2 ) to make sure it starts filling from 45 degrees, and completes after filling 270 degrees.

With your example, going counterclockwise and treating 0 degrees as straight up, you'd offset the starting angle by around 127 degrees and limit the fill arc to 106 degrees.



The "Shadowbolt" bar in that image is actually not possible with the demo script I posted because it passes through the 0 degree mark and to simplify the example I wrote it in a way that doesn't support that.

I'll probably rewrite it later and maybe just upload it as a library.

Last edited by semlar : 03-05-16 at 02:51 PM.
  Reply With Quote