Thread Tools Display Modes
01-26-18, 08:30 AM   #1
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
The ring v3

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:
  1. local A, L = ...
  2. local mediapath = "interface\\addons\\"..A.."\\"
  3.  
  4. --container
  5. local f = CreateFrame("Frame",nil,UIParent)
  6. f:SetPoint("CENTER")
  7. f:SetSize(256,256)
  8.  
  9. --left ring frame with clip children
  10. local lr = CreateFrame("Frame",nil,f)
  11. lr:SetPoint("LEFT")
  12. local w,h = f:GetSize()
  13. lr:SetSize(w/2,h)
  14. lr:SetClipsChildren(true)
  15.  
  16. --half pie/square mask texture
  17. local m = lr:CreateMaskTexture()
  18. m:SetTexture(mediapath.."half")
  19. --m:SetTexture(mediapath.."half","CLAMP","CLAMP")
  20. --CLAMP, REPEAT, CLAMPTOBLACK, CLAMPTOBLACKADDITIVE, CLAMPTOWHITE, MIRROR
  21. m:SetSize(f:GetSize())
  22. m:SetPoint("CENTER",f,"CENTER",0,0)
  23.  
  24. --ring texture
  25. local t = lr:CreateTexture(nil,"BACKGROUND",nil,-8)
  26. t:SetTexture(mediapath.."ring")
  27. t:SetSize(f:GetSize())
  28. t:SetPoint("CENTER",f,"CENTER",0,0)
  29. t:SetVertexColor(1,0,0)
  30. t:AddMaskTexture(m)
  31. --t:RemoveMaskTexture(m)
  32.  
  33. --you can create additional textures on different layers and use the same mask
  34.  
  35. --animation group
  36. local ag = m:CreateAnimationGroup()
  37. local anim = ag:CreateAnimation("Rotation")
  38. anim:SetDegrees(360)
  39. anim:SetDuration(10)
  40. ag:Play()
  41. 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?
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW)

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)

Last edited by zork : 01-26-18 at 12:13 PM.
  Reply With Quote
01-26-18, 12:12 PM   #2
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
Writing DiscoKugel3 atm.

It is working as written above. The mask texture can be animated like DanW described.

https://github.com/zorker/rothui/tre....0/DiscoKugel3

Currently trying to get the fog animation on the texture going to fake a fluid animation.

*edit* Got the fluid animation working.

https://imgur.com/a/dvOFv

Btw do not set any of the textures to blendmode "MOD" and make sure your mask texture does not touch the edge of the texture. You will get fragments otherwise. Keep at least 1px distance.

Here is a video of the thing in progress.

https://www.youtube.com/watch?v=A34HTeYwLCY

Basically two animations in one. The mask animation will later be handled by any health/power events or whatever.

Idea for later.



*edit* First part of oUF_Orbs revival.



https://github.com/zorker/rothui/tre...ow7.0/oUF_Orbs
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW)

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)

Last edited by zork : 01-26-18 at 07:04 PM.
  Reply With Quote
01-27-18, 01:40 AM   #3
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,290
What i'm interested in when you apply a triangle like mask on the texture does the OnEnter/OnLeave scripts works in a triangle like area or is it still square? Or is there any way to determine which slide of the ring you hovering over? I would like to create pie charts with a similar method in the future.
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » The ring v3

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off