The ring theory part two - WoWInterface
03-02-13, 09:46 AM   #1
zork
A Pyroguard Emberseer

Join Date: Jul 2008
Posts: 1,739
The ring theory part two

Based on this:
http://www.wowinterface.com/forums/s...ght=discokugel

Today after finishing my config I had some time to think about stuff. What really got me is that no-one has ever used scrollFrames to do stuff. I set up an experiment that I may try to prove if I have time.

Basic ring setup:

We put a scrollFrame with an inline texture into ring segment 1:

This will happen if we change the setpoint of the scrollFrame and the setpoint of the texture inside the scrollFrame:

This is what is going to happen if we only adjust the size of the scrollframe:

What about rotation? Let's see. Hmm the offset does not fit.

So this is what happens if we correct the offset.

What we are doing in the last screenshot. We rotate the scrollFrame right while adjusting the setpoint properly. Additionally we rotate the ringTexture inside the scrollFrame in opposite direction.

*edit*

Ahhh...got an even better idea. Why would you rotate the scrollFrame at all? We can just leave as it is and just rotate the texture inside.

This is what will happen:

The pink thingy is the alpha layer of the ring texture.

Now if we rotate the texture inside the scrollFrame it will adjust on it's own.

This should make it very simple to create any kind of rings. Just set up 4 scrollFrames and throw in any ring texture you want. The number of rings per scrollFrames is unlimited. Each ring texture can be rotated individually.

Only one limitation. Start and end point of a ring segment can only be in one segment if at least one point is at 0° or 90°.

It even should be possible to do full half-rings with only 2 scrollFrames. Your ring texture would span 180° then.
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW) | TDMOG

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

Last edited by zork : 08-07-14 at 04:08 AM.

03-02-13, 10:22 AM   #2
Nibelheim
local roygbi-

Join Date: Jan 2010
Posts: 1,600
Tripped out

03-02-13, 11:04 AM   #3
zork
A Pyroguard Emberseer

Join Date: Jul 2008
Posts: 1,739
Hmm...actually I set down to prove the concept.

It works!

SVN:

If I look at how simple that actually is I want back my time when I did rRingThing. Damnit.
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW) | TDMOG

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

Last edited by zork : 03-02-13 at 11:13 AM.

03-02-13, 11:29 AM   #4
Nibelheim
local roygbi-

Join Date: Jan 2010
Posts: 1,600
 Originally Posted by zork Hmm...actually I set down to prove the concept. If I look at how simple that actually is I want back my time when I did rRingThing. Damnit.
Many a scientist must have thought that throughout history

03-03-13, 05:04 AM   #5
humfras
A Flamescale Wyrmkin
Join Date: Oct 2009
Posts: 131
This is superb.

There are just some major drawbacks to the texture rotation:
It only works for mono-color and symmetrical textures.
Otherwise, the illusion fails.
__________________
Author of VuhDo CursorCastBar OptiTaunt Poisoner RaidMobMarker

03-03-13, 05:47 AM   #6
Haleth
This Space For Rent

Join Date: Sep 2008
Posts: 1,173

It actually inspired me to try and use a scroll frame myself for some to-do list I'm working on. Sliding panel with transparent frames (so no lazy moving behind the parent frame) \o/

The possibilities... they are endless.

Edit: You could also make a pretty cool experience bar with it. A full circle represents one level. You have a segment for the current experience, then a second segment starting at the end of the first one representing rested experience. If you make the second one semi-transparent, you could see how far it overlaps into the next level as well, something which traditional experience bars can't do.

Last edited by Haleth : 03-03-13 at 06:40 AM.

03-03-13, 07:18 AM   #7
zork
A Pyroguard Emberseer

Join Date: Jul 2008
Posts: 1,739
@Haleth
Nice one.

@humfras

You can cheat alot more if you have to. Atleast it's a huge improvement of what we currently had to do.

The texture can use blending and gradients are possible aswell. Additonally you can use overlays or backgrounds. You can recolor on value change. You can even position another texture (spark) ontop of the ring.

Lua Code:
`local function calc_health_spark(self,value)    local spark = self.health_spark.texture      local adjust = 0.009    value = 1-value+adjust    local mult = 1    local radian = math.rad(90) + math.rad(value * (mult*90*self.config.health.segments_used))    spark:SetPoint("CENTER", spark.radius * math.cos(radian), spark.radius * math.sin(radian))    spark:SetRotation(radian - spark.shiftradian)    end`

On that note...I have not tested frame rotation which should be possible via animationgroups. Thus some could try to stack textures on a frame and rotate the full frame inside the scrollFrame.

Another big plus is the ability of AnimationGroups. Sth like Animation > SetSmoothing is just nice to have.

 Sets the smoothing type for the animation. This setting affects the rate of change in the animation's progress value as it plays. Signature: Animation:SetSmoothing("smoothType") Arguments: smoothType - Type of smoothing for the animation (string)IN - Initially progressing slowly and accelerating towards the end IN_OUT - Initially progressing slowly and accelerating towards the middle, then slowing down towards the end NONE - Progresses at a constant rate from beginning to end OUT - Initially progressing quickly and slowing towards the end
http://wowprogramming.com/docs/widge...n/SetSmoothing

__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW) | TDMOG

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

Last edited by zork : 03-03-13 at 07:36 AM.

03-04-13, 02:48 AM   #8
humfras
A Flamescale Wyrmkin
Join Date: Oct 2009
Posts: 131
 Originally Posted by zork @humfras You can cheat alot more if you have to. Atleast it's a huge improvement of what we currently had to do. The texture can use blending and gradients are possible aswell. Additonally you can use overlays or backgrounds. You can recolor on value change. You can even position another texture (spark) ontop of the ring.
Bzgl. sparks teste ich seit einiger Zeit für CursorCastbar die 3D-Zauberanimation (z.B. Shadowbolt) als zusätzliches Rotationsobjet (siehe auch Poisoner5).
Dynamische Texturen (hier: sich verwindente Doppelstränge) brauchen zur Darstellung eine vorlaufende Sichtgrenze. Sollte ja möglich sein.
Problematisch wird es, wenn dynamische Schattenverläufe nötig sind. Oder ist dies mit Overlay-Texturen möglich ('MaskTexture')?
__________________
Author of VuhDo CursorCastBar OptiTaunt Poisoner RaidMobMarker

03-13-13, 11:56 AM   #9
zork
A Pyroguard Emberseer

Join Date: Jul 2008
Posts: 1,739
Lol...SetRotation has a bug. It does sth to my ring texture.

To get it to work properly I had to use the SQRT trick posted by Saiket here:

My code is:
Lua Code:
`-- // DiscoKugel2  -- // zork - 2013   --get the addon namespace  local addon, ns = ...   local unpack = unpack  local _G = _G  local CF = CreateFrame  local UIP = UIParent  local abs = math.abs  local sin = math.sin  local pi = math.pi   -----------------------------  -- FUNCTIONS  -----------------------------   local f = CF("Frame",nil,UIP)  f:SetSize(512,512)  f:SetScale(0.5)  f.w, f.h = f:GetSize()  f:SetPoint("CENTER")   local t = f:CreateTexture(nil, "BACKGROUND", nil, -8)  t:SetTexture("Interface\\AddOns\\rTestRing2\\media\\ring")  t:SetAllPoints()  t:SetAlpha(0.2)   local sf1 = CF("ScrollFrame",nil,f)  sf1:SetSize(f.w/2,f.h)  sf1:SetPoint("LEFT")   local sc1 = CF("Frame")  sf1:SetScrollChild(sc1)  sc1:SetSize(f.w,f.h)   local rt1 = sc1:CreateTexture(nil,"BACKGROUND",nil,-6)  rt1:SetTexture("Interface\\AddOns\\rTestRing2\\media\\ring_half")  rt1:SetSize(sqrt(2)*f.w,sqrt(2)*f.h)  rt1:SetPoint("CENTER")  rt1:SetVertexColor(1,0,0)  rt1:SetRotation(math.rad(40)) -- etc   --local ag = rt1:CreateAnimationGroup()  --local anim = ag:CreateAnimation("Rotation")  --anim:SetDegrees(90)  --anim:SetDuration(10)  --ag:Play()`

Maybe it has sth to do with the mysterious 1px I read about. Going to try to snip out 1px of my ring.
Afaik I read sth about it in Iriels ring theory. Thus every texture with a transparent outer edge needs to stay away from the texture edge by atleast 1px. Gonna try that. I think they did that to determine matching background colors or the like.

Loooool. That worked. I stripped the outer pixel and BÄÄÄM.

So when working with Texture:SetRotation() you have to make sure to do these:
• Texture size has to be in SQRT
• Texture rotation must be in rad
• Texture file must not hit the other edge of the image or you will get background color copy behaviour that you may not want.
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW) | TDMOG

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

Last edited by zork : 03-13-13 at 01:40 PM.

03-13-13, 12:31 PM   #10
SDPhantom
A Pyroguard Emberseer

Join Date: Jul 2006
Posts: 1,851
The reason for the first bug you mentioned is just the way WoW decides to render the out of bounds area of a texture's image. It tends to duplicate the last pixel out past the bounds of the image in order to fill the rendering area of the texture. This has nothing to do with texture:SetRotation() and will show up if you use texture:SetTexCoord() with coordinates that extend out of bounds.

The problem in which the SQRT method fixes is that Blizzard chose to have a texture shrink so the corners of an image fit in it at a 45 degree angle whenever texture:SetRotation() is used. If you manually calculate the coordinates of the corners and set the texcoord yourself, this doesn't apply. Although it's probably easier and more efficient to just multiply the intended size of the texture object with SQRT(2) as shown by your code example.
__________________
 "All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools." -Anders (Dragon Age: Origins - Awakening)

Last edited by SDPhantom : 03-13-13 at 12:46 PM.

03-13-13, 01:40 PM   #11
zork
A Pyroguard Emberseer

Join Date: Jul 2008
Posts: 1,739
Thanks for the insight SDPhantom.

I'm on the way of creating an oUF layout from this. I really wanted to do this for a long time. Now I'm finally able to make it work properly.

I'm currently setting up the orb templates in my GFX program. Currently I have two templates in mind that I want to bring to life.

Outer ring templates

It can be combined with an orb in the center.

Thanks to SetPortraitToTexture() [http://wowprogramming.com/docs/api/S...raitToTexture] it is even possible to work with circular icon symbols. It may not seem that the icon is circular but in fact it is.

Lua Code:
`local icon = select(3,GetSpellInfo(12880))  --icon = "Interface\\LFGFrame\\UI-LFR-PORTRAIT"  local t = helper:CreateTexture(nil,"OVERLAY",nil,-8)  t:SetTexCoord(0, 1, 0, 1)  t:SetAllPoints()  --t:SetTexture(icon)  SetPortraitToTexture(t,icon)`

Result:

So a template-idea can be adding a circular cast icon inside a circular castbar and ring unitframes.

*edit*

I made the code of the stuff above available via SVN:
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW) | TDMOG

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

Last edited by zork : 03-14-13 at 02:54 AM.

03-13-13, 08:36 PM   #12
10leej
A Molten Giant

Join Date: Feb 2011
Posts: 579
Love what I'm seeing here
__________________

03-14-13, 06:00 AM   #13
zork
A Pyroguard Emberseer

Join Date: Jul 2008
Posts: 1,739
Currently doing some font tests and finishing the template:

Not sure which font I want to use. All fonts are from dafont.com (except Arial)

Hmm have not decided on the border width. 4, 6 or 8.

Top version is with castbar. Bottom is without.

__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW) | TDMOG

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

Last edited by zork : 03-14-13 at 08:18 AM.

03-14-13, 09:07 AM   #14
zork
A Pyroguard Emberseer

Join Date: Jul 2008
Posts: 1,739
The second layout I want to do is a revival of my oUF_Orbs mod (http://www.wowinterface.com/download...-oUF_Orbs.html).

The problem is the castbar icon. I think I have to put it somewhere else.

__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW) | TDMOG

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

03-14-13, 10:23 AM   #15
Dridzt
A Pyroguard Emberseer

Join Date: Nov 2005
Posts: 1,254
*swoons*

03-14-13, 12:55 PM   #16
10leej
A Molten Giant

Join Date: Feb 2011
Posts: 579
Why not have the castbar circle the healthbar which circles the mana bar?
__________________

03-14-13, 07:00 PM   #17
Lombra
A Molten Giant

Join Date: Nov 2006
Posts: 554
Looks amazing.
__________________
Grab your sword and fight the Horde!

03-14-13, 07:05 PM   #18
Talyrius
An Onyxian Warder

Join Date: Oct 2008
Posts: 360
The bright colors and round shapes remind me of poké balls from Pokémon.

03-15-13, 04:42 AM   #19
zork
A Pyroguard Emberseer

Join Date: Jul 2008
Posts: 1,739
You get that those are only examples showing the technique behind the scenes right? I'm just showing options. Everything else is personal preference. Do whatever you want. You have the freedom to do so.

You can use any color. You can do quarter, half, full-rings. You can use any ring-width and so on ...
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW) | TDMOG

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

Last edited by zork : 03-15-13 at 09:22 AM.

03-23-13, 11:20 AM   #20
pelf
Sentient Plasmoid

Join Date: May 2008
Posts: 133
 Originally Posted by zork The problem is the castbar icon. I think I have to put it somewhere else.
Top left has symmetry with the cast time. Have you tried putting it behind the main orb?

That looks kind of okay to me.

 WoWInterface » The ring theory part two

 Thread Tools Display Modes Linear Mode

 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