Regarding SetRotation this is what I do in rRingMod3 for the spark
Code:
local function calc_health_spark(self,value)
local spark = self.health_spark.texture
value = 1-value --values is between 0 and 1
local radian = math.rad(value * 360)
spark:SetPoint("CENTER", spark.radius * math.cos(radian), spark.radius * math.sin(radian))
spark:SetRotation(radian)
end
The spark will be placed ontop of the ring in a radian based on hp/pp values.
Most of that code is from Boloking:
http://www.wowinterface.com/download...4-GCDRing.html
If you dont have to adjust the setpoint there is still the radian that you need based on the value.
Example above uses 360°. Now that would be values from 0 to 1. Quarterrings would be at 0.25, 0.5, 0.75 and one. So a value of 0.25 would be 90°.
But thx to animationgroups I think the easiest way to do this now is by using the animationgroups. They do all the math.
Tick-Tack Example
lua Code:
[code]
local rotateme = function(texture,width,height,scale,anchorframe,framelevel,texr,texg,texb,alpha,duration,side,blendmode,point,pointx,pointy)
local h = CreateFrame("Frame",nil,anchorframe)
h:SetHeight(height)
h:SetWidth(width)
h:SetPoint(point,pointx,pointy)
h:SetScale(scale)
h:SetFrameLevel(framelevel)
local t = h:CreateTexture()
t:SetAllPoints(h)
t:SetTexture("Interface\\AddOns\\yourTextures\\"..texture)
t:SetBlendMode(blendmode)
t:SetVertexColor(texr,texg,texb,alpha)
h.t = t
local ag = h:CreateAnimationGroup()
h.ag = ag
local a1 = h.ag:CreateAnimation("Rotation")
a1:SetDegrees(6)
a1:SetDuration(1)
h.ag.a1 = a1
h.ag:SetLooping("REPEAT") --repeat this OVER AND OVER?!
return h
end
local f = rotateme(...)
f.ag:Play()
--adjust values
--f.ag.a1:SetDegrees(20)
--f.a1:SetDuration(10)
--f.ag:SetLooping("REPEAT")
[/code]
This will do a Rotation for 6° and need "duration" to do that. Well you could just bring that duration down to 0 to make it be there instantly. Since it's an object you can adjust the value of SetDegrees anytime, even later and after that just Play() the animation.
The example above with a duration of 1 would be a clock. It moves 6° every second forever.
To make that acutally look like a clock you need a line-texture. Now you play it every second. The animation does a 6° move but only takes 0.3ms to do that. This will leave 0.7ms until the next move.