In reference to
http://www.wowinterface.com/forums/s...highlight=ring I would like to talk about rings in WoW patch >= 7.3.5.
We have MaskTexture now.
http://www.wowinterface.com/forums/s...ht=MaskTexture
It does allow us to create a mask texture that will render all textures it is applied to invisible.
On top of that we now have SetClipsChildren which can be applied to frames. There is no need for a scrollFrame any more to mask frames.
What I'm currently asking myself if it is possible to apply an animationgroup to the mask. Sort of like this:
Lua Code:
local A, L = ...
local mediapath = "interface\\addons\\"..A.."\\"
--container
local f = CreateFrame("Frame",nil,UIParent)
f:SetPoint("CENTER")
f:SetSize(256,256)
--left ring frame with clip children
local lr = CreateFrame("Frame",nil,f)
lr:SetPoint("LEFT")
local w,h = f:GetSize()
lr:SetSize(w/2,h)
lr:SetClipsChildren(true)
--half pie/square mask texture
local m = lr:CreateMaskTexture()
m:SetTexture(mediapath.."half")
--m:SetTexture(mediapath.."half","CLAMP","CLAMP")
--CLAMP, REPEAT, CLAMPTOBLACK, CLAMPTOBLACKADDITIVE, CLAMPTOWHITE, MIRROR
m:SetSize(f:GetSize())
m:SetPoint("CENTER",f,"CENTER",0,0)
--ring texture
local t = lr:CreateTexture(nil,"BACKGROUND",nil,-8)
t:SetTexture(mediapath.."ring")
t:SetSize(f:GetSize())
t:SetPoint("CENTER",f,"CENTER",0,0)
t:SetVertexColor(1,0,0)
t:AddMaskTexture(m)
--t:RemoveMaskTexture(m)
--you can create additional textures on different layers and use the same mask
--animation group
local ag = m:CreateAnimationGroup()
local anim = ag:CreateAnimation("Rotation")
anim:SetDegrees(360)
anim:SetDuration(10)
ag:Play()
ag:SetLooping("REPEAT")
The frame itself is clipped. Inside the frame lives a number of textures. Each texture can have the same mask.
If the mask is a half-pie and we start to rotate it...it should crop all textures.
Sort of like this. The example above is just a half ring.
Yellow = frame
Purple = mask texture
Green = ring texture
Now that I see the images. Not sure if the mask has to be a half-pie at all. A half-square will be fine too.
A different approach could be to just use a circular shaped mask and let your textures be half-squares.
How would you do it?
On top of that how would you do it if you want textures animated?
I had the following idea. On top of the ring texture I put another ring texture which I will set to rotate 24/7. It is a blend texture that will multiply with the color texture below. Thanks to the mask both will be clipped. On top of that you get the feeling of an animated texture.
The mask does not apply to model frames, no?