using both :SetTexCoord and :SetRotation()
Hi!
I'm trying as the title says to use both :SetTexCoord and :SetRotation() on the same texture Lua Code:
what I try to do with this code is to first set the coord for the bottom left emblem on THIS image, then I want to rotate it based on a slidervalue (set longer down in the code), but if I use the mainFrame.icon:SetRotation(math.rad(0)) command the image show uncropped Any way to fix this without using animGroup and rotate |
I think kgPanels allows you to both crop and rotate a texture. You could see how it does it.
|
Quote:
|
You can rotate the coordinates that you're sending to SetTexCoord with a matrix transformation (rotation matrix), which takes your input coordinates and rotates them around a central point (the middle of your coordinate pairs).
If you're rotating in 90 degree increments, you can skip doing any math and just shift the coordinates over (they're x,y pairs representing the corners of your texture). By moving the order of the SetTexCoord arguments by 2 you're changing which corner of the texture coordinates is being attached to which corner of your texture object. This page has some lua examples if you need to rotate by an arbitrary amount, but if this all seems overwhelmingly confusing I would probably just use an animation to do it. I think SetRotation essentially applies SetTexCoord in the background so I don't know that they can be used together. |
Quote:
|
Quote:
Code:
local pi_4 = math.pi / 4 Code:
local TEXTURE = [[Interface\Artifacts\ArtifactUIHunter]] |
Thanks all, I'm impressed with the math knowledge a lot of you have, I guess I should have paid better attention at class :confused:
Quote:
But unfortunately as you said it is a round texture with something close. I did not take that into consideration when I wanted to rotate the texture. Guess I have to try to use the animGroup then :) |
Not sure if zork's oUF_RingThing will help you at all but here: https://www.wowinterface.com/downloa...RingThing.html
|
All times are GMT -6. The time now is 03:35 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI