Thread Tools Display Modes
11-29-10, 02:35 AM   #1
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
Circular Masks for Textures

Holy Cow.

I finally had enough time to do a testrun on this:


The bottom textures are rotating all the time btw.

So rotatiing masked circular textures are actually possible.

Currently tricking out the values. Will post he code when done.

So here is the first result with a texture of my own:


My texture is 128x128px. I think what the distortion tells me is that I need to make the basic texture go 64x64px. Gonna try that now. Texture has to be in BLP file format to work btw.

*edit*

Got it.



What you see here is the first circular masked rotating texture in WoW.

All textures are the same. Just two of them are masked and two of them use the animation system.

But...this is nothing more but an alpha layer with some very strict rules. So you will not profit from it that much unless you want to use it on tons of textures that have no circular alpha layer.

If that kind of mask could be applied to models...well that would be another story.

Code:
  
  -- Zorks round texture animation testmod

  local function createme(h,tex,circle,x,y,size,dur,degree)    
        
    local t = h:CreateTexture(nil,"BACKGROUND",nil,-8)
    t:SetPoint("CENTER",x,y)
    t:SetSize(size,size)
    --t:SetBlendMode("ADD")
    
    if circle then
      SetPortraitToTexture(t, "Interface\\AddOns\\rGalaxy\\"..tex)
    else
      t:SetTexture("Interface\\AddOns\\rGalaxy\\"..tex)
    end
    
    if dur then
    
      local ag = t:CreateAnimationGroup()    
      local anim = ag:CreateAnimation("Rotation")
      anim:SetDegrees(degree)
      anim:SetDuration(dur)    
      ag:Play()
      ag:SetLooping("REPEAT")
    
    end
    
    return t    
  
  end  
  
  local h = CreateFrame("Frame",nil,UIParent)  
  h:SetPoint("CENTER",0,0)
  h:SetSize(64,64)
  
  local a = createme(h,"bob",true,70,70,128)
  local b = createme(h,"bob",false,-70,70,128)
  local c = createme(h,"bob",true,70,-70,128,15,360)
  local d = createme(h,"bob",false,-70,-70,128,15,360)
  local e = createme(h,"bob",true,70,-140,128,15,-360)
  local f = createme(h,"bob",false,-70,-140,128,15,-360)
bob is a BLP file with no alpha layer and 64x64 px in size.
__________________
| 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 : 11-30-10 at 08:03 AM.
  Reply With Quote
11-30-10, 02:11 PM   #2
Lyelu
A Cyclonian
AddOn Author - Click to view addons
Join Date: Oct 2010
Posts: 44
Hi Zork,
I'm working on an animation, and for lack of a better place to ask you... may I pose the question here?

I'm trying to make a healthbar which would play an animation of bubbles when in combat. So for example if you look at this pic:
http://s.wowinterface.com/preview/pvw46847.jpg
You can see that the bubbles would need to be masked somehow as the container filled or emptied.

So I worked my way through some basics - I created a SetTexCoord that shows me part of an image. I created a basic Translation animation. But I really can't see where to go from there.

Here are my bubbles (tga file), I can easily make the image different - longer and with more bubbles etc, if needed.

It easily moves across the screen, but I don't understand how you are "masking". While I can hide part of my bubbles, the visible part does not stay contained with a container frame's borders.

Do you have an example of this somewhere?
In the same vein, have you seen any examples of a health Statusbar that uses SetTexCoord (rather than stretching or repeating the statusbar texture)?
Thanks!

Last edited by Lyelu : 11-30-10 at 02:17 PM.
  Reply With Quote
11-30-10, 04:38 PM   #3
Xubera
A Cobalt Mageweaver
 
Xubera's Avatar
AddOn Author - Click to view addons
Join Date: May 2009
Posts: 207
well for the healthbar part, you can do

Code:
Texture:SetTexCoord(0,1,(1-(curValue/maxValue)),1)
    Texture:SetHeight((curValue/maxValue)*heightOfTheStatusbar)
and then you add a texture that is always at 100%, and you just give it a low alpha, that way it looks like a shadow of the texture is in its place.

This makes a vertical statusbar
__________________
Chat Consolidate is the solution to any out of control trade chat. Ignore lines, throttle chat, consolidate posts!Follow the link to find out how!

▲ ▲ WoWInterface wont let me triforce >.>
  Reply With Quote
12-15-10, 06:58 AM   #4
Mekelan
A Kobold Labourer
Join Date: Dec 2010
Posts: 1
damn you Lyelu, that looks just like a steampunk-inspired UI I'm working on :P Goes perfectly with an Engineering Goblin. Oh well, the world does need more steampunk
  Reply With Quote
12-28-10, 06:50 AM   #5
Lyelu
A Cyclonian
AddOn Author - Click to view addons
Join Date: Oct 2010
Posts: 44
Not my picture, lol.
It was just an example, to help visualize the question of how to animate bubbles, most efficiently. I suppose you could just do them individually, and hide them at the end with another graphic, but it strikes me as a fairly complex workaround.
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » Circular Masks for Textures


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