-
Posted by tisaidivan on Fri, 27 Aug 2010 20:54:40
I was wondering if there is a way to create a frame which displays an image on your screen and and then have it rotate clockwise 360 degrees for a certain amount of time. Ive looked around for a few hours and can't seem to find anything. Can this even be done? If so, could someone point me in the right direction?
Thanks!
-
Posted by nuttyprot on Fri, 27 Aug 2010 22:05:03
I think you can use the animation widget for this. After a little searching I found http://wowprogramming.com/forums/development/169. But it maybe a bit complex would be nice to have a a minimal example.
EDIT: check this post out http://wowprogramming.com/forums/development/316
-
Posted by tisaidivan on Fri, 27 Aug 2010 22:20:38
Thank you! This will help a lot!
-
Posted by tisaidivan on Fri, 27 Aug 2010 22:35:39
Hmm, this is what I got, and for some reason it wont work.
I'm using this to show the image on the screen.
local height= WorldFrame:GetHeight(); local width= WorldFrame:GetWidth(); if mytestframe then UIFrameFadeOut(mytestframe, 0.5, 1, 0); mytestframe = nil; else mytestframe = CreateFrame("Frame", nil, nil); mytestframe:SetFrameStrata("BACKGROUND"); mytestframe:SetWidth(width); mytestframe:SetHeight(height); local temp = CreateFrame("Frame", nil,mytestframe) temp:SetWidth(width) temp:SetHeight(height) temp.bg = temp:CreateTexture(nil, "CENTER") temp.bg:SetTexture("Image location") temp.bg:SetVertexColor(1,.2,0,1) temp.bg:SetAllPoints(temp) temp:SetPoint("CENTER") mytestframe:SetPoint("CENTER",0,0); UIFrameFadeIn(mytestframe, 0.5, 0, 1); end
And this to do the rotation animation.
if not mytestframe.ag then mytestframe.ag = mytestframe:CreateAnimationGroup() local ag = mytestframe.ag ag.rot = ag:CreateAnimation("Rotation") ag.alpha = ag:CreateAnimation("Alpha") end local ag = mytestframe.ag ag.rot:SetDuration(5.0) ag.rot:SetDegrees(360) ag.rot:SetOrder(1) ag.alpha:SetDuration(2.0) ag.alpha:SetChange(-1.0) ag.alpha:SetOrder(2) mytestframe.ag:Play()
For some reason it wont rotate, but it will do the alpha part...
What am I doing wrong?
Thanks again for the help. :)
-
Posted by tisaidivan on Sun, 29 Aug 2010 02:44:47
Anyone?
-
Posted by jnwhiteh on Sun, 29 Aug 2010 08:32:52
I would try a more minimal example, get that working, and then move up. I don't see anything obvious to indicate why this might not be working.
-
Posted by tisaidivan on Sun, 29 Aug 2010 14:26:47
That's as simple as it can get.. I think. The first part just shows the image. The second is suppose to make that image rotate. I know it's running through the animation, cause it plays the alpha fade part. Just for some reason it won't play the rotaion part.
-
Posted by Gotai on Sun, 29 Aug 2010 17:41:44
Try setting the origin point, not sure if the rotation animation does anything without one: http://wowprogramming.com/docs/widgets/Rotation/SetOrigin
-
Posted by jnwhiteh on Sun, 29 Aug 2010 23:22:47
Does it take the TIME for the rotation, i.e. something is just not set right or is it just completely ignoring it?
-
Posted by tisaidivan on Mon, 30 Aug 2010 00:02:26
Yes, it still plays through everything. Like, it takes the 5 seconds before the alpha part, but it doesn't rotate. I can't get to a computer right now, or I'd test the set origin.