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:
http://www.wowinterface.com/forums/s...ad.php?t=36679
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.