diff --git a/WeakAuras/Media/Textures/StopMotion.blp b/WeakAuras/Media/Textures/StopMotion.blp new file mode 100644 index 0000000..eea4ad9 Binary files /dev/null and b/WeakAuras/Media/Textures/StopMotion.blp differ diff --git a/WeakAuras/RegionTypes/StopMotion.lua b/WeakAuras/RegionTypes/StopMotion.lua new file mode 100644 index 0000000..bc199a0 --- /dev/null +++ b/WeakAuras/RegionTypes/StopMotion.lua @@ -0,0 +1,375 @@ +if not WeakAuras.IsCorrectVersion() then return end +local AddonName, Private = ... + +local texture_types = WeakAuras.StopMotion.texture_types; +local texture_data = WeakAuras.StopMotion.texture_data; +local animation_types = WeakAuras.StopMotion.animation_types; +local L = WeakAuras.L; + +local default = { + foregroundTexture = "Interface\\AddOns\\WeakAuras\\Media\\Textures\\StopMotion", + backgroundTexture = "Interface\\AddOns\\WeakAuras\\Media\\Textures\\StopMotion", + desaturateBackground = false, + desaturateForeground = false, + sameTexture = true, + width = 128, + height = 128, + foregroundColor = {1, 1, 1, 1}, + backgroundColor = {0.5, 0.5, 0.5, 0.5}, + blendMode = "BLEND", + rotation = 0, + discrete_rotation = 0, + mirror = false, + rotate = true, + selfPoint = "CENTER", + anchorPoint = "CENTER", + anchorFrameType = "SCREEN", + xOffset = 0, + yOffset = 0, + frameStrata = 1, + startPercent = 0, + endPercent = 1, + backgroundPercent = 1, + frameRate = 15, + animationType = "progress", + inverse = false, + customForegroundFrames = 0, + customForegroundRows = 16, + customForegroundColumns = 16, + customBackgroundFrames = 0, + customBackgroundRows = 16, + customBackgroundColumns = 16, + hideBackground = true +}; + +local screenWidth, screenHeight = math.ceil(GetScreenWidth() / 20) * 20, math.ceil(GetScreenHeight() / 20) * 20; + +local properties = { + desaturateForeground = { + display = L["Desaturate Foreground"], + setter = "SetForegroundDesaturated", + type = "bool", + }, + desaturateBackground = { + display = L["Desaturate Background"], + setter = "SetBackgroundDesaturated", + type = "bool", + }, + foregroundColor = { + display = L["Foreground Color"], + setter = "Color", + type = "color" + }, + backgroundColor = { + display = L["Background Color"], + setter = "SetBackgroundColor", + type = "color" + }, + width = { + display = L["Width"], + setter = "SetRegionWidth", + type = "number", + min = 1, + softMax = screenWidth, + bigStep = 1, + }, + height = { + display = L["Height"], + setter = "SetRegionHeight", + type = "number", + min = 1, + softMax = screenHeight, + bigStep = 1 + }, +} + +WeakAuras.regionPrototype.AddProperties(properties, default); + +local function create(parent) + local frame = CreateFrame("FRAME", nil, UIParent); + frame:SetMovable(true); + frame:SetResizable(true); + frame:SetMinResize(1, 1); + + local background = frame:CreateTexture(nil, "BACKGROUND"); + frame.background = background; + background:SetAllPoints(frame); + + local foreground = frame:CreateTexture(nil, "ART"); + frame.foreground = foreground; + foreground:SetAllPoints(frame); + + WeakAuras.regionPrototype.create(frame); + + return frame; +end + +local function SetTextureViaAtlas(self, texture) + self:SetTexture(texture); +end + +local function setTile(texture, frame, rows, columns ) + frame = frame - 1; + local row = floor(frame / columns); + local column = frame % columns; + + local deltaX = 1 / columns; + local deltaY = 1 / rows; + + local left = deltaX * column; + local right = left + deltaX; + + local top = deltaY * row; + local bottom = top + deltaY; + + texture:SetTexCoord(left, right, top, bottom); +end + +WeakAuras.setTile = setTile; + +local function SetFrameViaAtlas(self, texture, frame) + setTile(self, frame, self.rows, self.columns); +end + +local function SetTextureViaFrames(self, texture) + self:SetTexture(texture .. format("%03d", 0)); + self:SetTexCoord(0, 1, 0, 1); +end + +local function SetFrameViaFrames(self, texture, frame) + self:SetTexture(texture .. format("%03d", frame)); +end + +local function modify(parent, region, data) + WeakAuras.regionPrototype.modify(parent, region, data); + + local tdata = texture_data[data.foregroundTexture]; + if (tdata) then + local lastFrame = tdata.count - 1; + region.startFrame = floor( (data.startPercent or 0) * lastFrame) + 1; + region.endFrame = floor( (data.endPercent or 1) * lastFrame) + 1; + region.foreground.rows = tdata.rows; + region.foreground.columns = tdata.columns; + else + local lastFrame = (data.customForegroundFrames or 256) - 1; + region.startFrame = floor( (data.startPercent or 0) * lastFrame) + 1; + region.endFrame = floor( (data.endPercent or 1) * lastFrame) + 1; + region.foreground.rows = data.customForegroundRows; + region.foreground.columns = data.customForegroundColumns; + end + + local backgroundTexture = data.sameTexture + and data.foregroundTexture + or data.backgroundTexture; + + local tbdata = texture_data[backgroundTexture]; + if (tbdata) then + local lastFrame = tbdata.count - 1; + region.backgroundFrame = floor( (data.backgroundPercent or 1) * lastFrame + 1); + region.background.rows = tbdata.rows; + region.background.columns = tbdata.columns; + else + local lastFrame = (data.sameTexture and data.customForegroundFrames + or data.customBackgroundFrames or 256) - 1; + region.backgroundFrame = floor( (data.backgroundPercent or 1) * lastFrame + 1); + region.background.rows = data.sameTexture and data.customForegroundRows + or data.customBackgroundRows; + region.background.columns = data.sameTexture and data.customForegroundColumns + or data.customBackgroundColumns; + end + + if (region.foreground.rows and region.foreground.columns) then + region.foreground.SetBaseTexture = SetTextureViaAtlas; + region.foreground.SetFrame = SetFrameViaAtlas; + else + region.foreground.SetBaseTexture = SetTextureViaFrames; + region.foreground.SetFrame = SetFrameViaFrames; + end + + if (region.background.rows and region.background.columns) then + region.background.SetBaseTexture = SetTextureViaAtlas; + region.background.SetFrame = SetFrameViaAtlas; + else + region.background.SetBaseTexture = SetTextureViaFrames; + region.background.SetFrame = SetFrameViaFrames; + end + + + region.background:SetBaseTexture(backgroundTexture); + region.background:SetFrame(backgroundTexture, region.backgroundFrame or 1); + region.background:SetDesaturated(data.desaturateBackground) + region.background:SetVertexColor(data.backgroundColor[1], data.backgroundColor[2], data.backgroundColor[3], data.backgroundColor[4]); + region.background:SetBlendMode(data.blendMode); + + if (data.hideBackground) then + region.background:Hide(); + else + region.background:Show(); + end + + region.foreground:SetBaseTexture(data.foregroundTexture); + region.foreground:SetFrame(data.foregroundTexture, 1); + region.foreground:SetDesaturated(data.desaturateForeground); + region.foreground:SetBlendMode(data.blendMode); + + region:SetWidth(data.width); + region:SetHeight(data.height); + region.width = data.width; + region.height = data.height; + region.scalex = 1; + region.scaley = 1; + + function region:Scale(scalex, scaley) + region.scalex = scalex; + region.scaley = scaley; + if(scalex < 0) then + region.mirror_h = true; + scalex = scalex * -1; + else + region.mirror_h = nil; + end + region:SetWidth(region.width * scalex); + if(scaley < 0) then + scaley = scaley * -1; + region.mirror_v = true; + else + region.mirror_v = nil; + end + region:SetHeight(region.height * scaley); + end + + function region:Color(r, g, b, a) + region.color_r = r; + region.color_g = g; + region.color_b = b; + region.color_a = a; + if (r or g or b) then + a = a or 1; + end + region.foreground:SetVertexColor(region.color_anim_r or r, region.color_anim_g or g, region.color_anim_b or b, region.color_anim_a or a); + end + + function region:ColorAnim(r, g, b, a) + region.color_anim_r = r; + region.color_anim_g = g; + region.color_anim_b = b; + region.color_anim_a = a; + if (r or g or b) then + a = a or 1; + end + region.foreground:SetVertexColor(r or region.color_r, g or region.color_g, b or region.color_b, a or region.color_a); + end + + function region:GetColor() + return region.color_r or data.color[1], region.color_g or data.color[2], + region.color_b or data.color[3], region.color_a or data.color[4]; + end + + region:Color(data.foregroundColor[1], data.foregroundColor[2], data.foregroundColor[3], data.foregroundColor[4]); + + function region:PreShow() + region.startTime = GetTime(); + end + + local function onUpdate() + if (not region.startTime) then return end + + WeakAuras.StartProfileAura(region.id); + WeakAuras.StartProfileSystem("stopmotion") + local timeSinceStart = (GetTime() - region.startTime); + local newCurrentFrame = floor(timeSinceStart * (data.frameRate or 15)); + if (newCurrentFrame == region.currentFrame) then + WeakAuras.StopProfileAura(region.id); + WeakAuras.StopProfileSystem("stopmotion") + return; + end + + region.currentFrame = newCurrentFrame; + + local frames; + local startFrame = region.startFrame; + local endFrame = region.endFrame; + local inverse = data.inverse; + if (endFrame >= startFrame) then + frames = endFrame - startFrame + 1; + else + frames = startFrame - endFrame + 1; + startFrame, endFrame = endFrame, startFrame; + inverse = not inverse; + end + + local frame = 0; + if (data.animationType == "loop") then + frame = (newCurrentFrame % frames) + startFrame; + elseif (data.animationType == "bounce") then + local direction = floor(newCurrentFrame / frames) % 2; + if (direction == 0) then + frame = (newCurrentFrame % frames) + startFrame; + else + frame = endFrame - (newCurrentFrame % frames); + end + elseif (data.animationType == "once") then + frame = newCurrentFrame + startFrame + if (frame > endFrame) then + frame = endFrame; + end + elseif (data.animationType == "progress") then + if (not region.state) then + -- Do nothing + elseif (region.state.progressType == "static") then + local value = region.state.value or 0 + local total = region.state.total ~= 0 and region.state.total or 1 + frame = floor((frames - 1) * value / total) + startFrame; + else + local remaining = region.state.expirationTime and (region.state.expirationTime - GetTime()) or 0; + local progress = region.state.duration and region.state.duration > 0 and (1 - (remaining / region.state.duration)) or 0; + frame = floor( (frames - 1) * progress) + startFrame; + end + end + + if (inverse) then + frame = endFrame - frame + startFrame; + end + + if (frame > endFrame) then + frame = endFrame + end + if (frame < startFrame) then + frame = startFrame + end + region.foreground:SetFrame(data.foregroundTexture, frame); + + WeakAuras.StopProfileAura(region.id); + WeakAuras.StopProfileSystem("stopmotion") + end; + + region.FrameTick = onUpdate; + + function region:Update() + onUpdate(); + end + + function region:SetForegroundDesaturated(b) + region.foreground:SetDesaturated(b); + end + + function region:SetBackgroundDesaturated(b) + region.background:SetDesaturated(b); + end + + function region:SetBackgroundColor(r, g, b, a) + region.background:SetVertexColor(r, g, b, a); + end + + function region:SetRegionWidth(width) + region.width = width; + region:Scale(region.scalex, region.scaley); + end + + function region:SetRegionHeight(height) + region.height = height; + region:Scale(region.scalex, region.scaley); + end +end + +WeakAuras.RegisterRegionType("stopmotion", create, modify, default, properties); diff --git a/WeakAuras/Types.lua b/WeakAuras/Types.lua index ae6b35d..2c35999 100644 --- a/WeakAuras/Types.lua +++ b/WeakAuras/Types.lua @@ -2495,6 +2495,30 @@ WeakAuras.reset_ranged_swing_spells = { [75] = true, -- Auto Shot } +WeakAuras.StopMotion = {} +WeakAuras.StopMotion.texture_types = { +} + +WeakAuras.StopMotion.texture_types.Basic = { + ["Interface\\AddOns\\WeakAuras\\Media\\Textures\\StopMotion"] = "Example", +} + +WeakAuras.StopMotion.texture_data = { +} + +WeakAuras.StopMotion.texture_data["Interface\\AddOns\\WeakAuras\\Media\\Textures\\StopMotion"] = { + ["count"] = 64, + ["rows"] = 8, + ["columns"] = 8 +} + +WeakAuras.StopMotion.animation_types = { + loop = L["Loop"], + bounce = L["Forward, Reverse Loop"], + once = L["Forward"], + progress = L["Progress"] +} + if WeakAuras.IsClassic() then local reset_swing_spell_list = { 1464, 8820, 11604, 11605, -- Slam diff --git a/WeakAuras/WeakAuras.toc b/WeakAuras/WeakAuras.toc index 61e222f..52280ea 100644 --- a/WeakAuras/WeakAuras.toc +++ b/WeakAuras/WeakAuras.toc @@ -50,6 +50,7 @@ RegionTypes\Icon.lua RegionTypes\Text.lua RegionTypes\Group.lua RegionTypes\DynamicGroup.lua +RegionTypes\StopMotion.lua RegionTypes\Model.lua # sub region support diff --git a/WeakAurasOptions/RegionOptions/StopMotion.lua b/WeakAurasOptions/RegionOptions/StopMotion.lua new file mode 100644 index 0000000..f3d6fce --- /dev/null +++ b/WeakAurasOptions/RegionOptions/StopMotion.lua @@ -0,0 +1,414 @@ +local L = WeakAuras.L + +local texture_types = WeakAuras.StopMotion.texture_types; +local texture_data = WeakAuras.StopMotion.texture_data; +local animation_types = WeakAuras.StopMotion.animation_types; +local setTile = WeakAuras.setTile; + +local function setTextureFunc(textureWidget, texturePath, textureName) + local data = texture_data[texturePath]; + textureWidget.frameNr = 0; + if (data) then + if (data.rows and data.columns) then + -- Texture Atlas + textureWidget:SetTexture(texturePath, textureName); + + setTile(textureWidget, data.count, data.rows, data.columns); + + textureWidget:SetOnUpdate(function() + textureWidget.frameNr = textureWidget.frameNr + 1; + if (textureWidget.frameNr == data.count) then + textureWidget.frameNr = 1; + end + setTile(textureWidget, textureWidget.frameNr, data.rows, data.columns); + end); + else + -- Numbered Textures + local texture = texturePath .. format("%03d", texture_data[texturePath].count) + textureWidget:SetTexture(texture, textureName) + textureWidget:SetTexCoord(0, 1, 0, 1); + + textureWidget:SetOnUpdate(function() + textureWidget.frameNr = textureWidget.frameNr + 1; + if (textureWidget.frameNr == data.count) then + textureWidget.frameNr = 1; + end + local texture = texturePath .. format("%03d", textureWidget.frameNr) + textureWidget:SetTexture(texture, textureName); + end); + end + else + local texture = texturePath .. format("%03d", 1) + textureWidget:SetTexture(texture, textureName); + end +end + +local function createOptions(id, data) + local options = { + __title = L["Stop Motion Settings"], + __order = 1, + foregroundTexture = { + type = "input", + width = WeakAuras.normalWidth, + name = L["Texture"], + order = 1, + }, + backgroundTexture = { + type = "input", + width = WeakAuras.normalWidth, + name = L["Background Texture"], + order = 5, + disabled = function() return data.sameTexture or data.hideBackground end, + get = function() return data.sameTexture and data.foregroundTexture or data.backgroundTexture; end, + }, + chooseForegroundTexture = { + type = "execute", + width = WeakAuras.normalWidth, + name = L["Choose"], + order = 12, + func = function() + WeakAuras.OpenTexturePicker(data, data, "foregroundTexture", texture_types, setTextureFunc); + end + }, + sameTexture = { + type = "toggle", + width = WeakAuras.halfWidth, + name = L["Same"], + order = 15, + disabled = function() return data.hideBackground; end + }, + chooseBackgroundTexture = { + type = "execute", + width = WeakAuras.halfWidth, + name = L["Choose"], + order = 17, + func = function() + WeakAuras.OpenTexturePick(data, data, "backgroundTexture", texture_types, setTextureFunc); + end, + disabled = function() return data.sameTexture or data.hideBackground; end + }, + desaturateForeground = { + type = "toggle", + width = WeakAuras.normalWidth, + name = L["Desaturate"], + order = 17.5, + }, + desaturateBackground = { + type = "toggle", + name = L["Desaturate"], + order = 17.6, + width = WeakAuras.halfWidth, + disabled = function() return data.hideBackground; end + }, + hideBackground = { + type = "toggle", + name = L["Hide"], + order = 17.65, + width = WeakAuras.halfWidth, + }, + -- Foreground options for custom textures + customForegroundHeader = { + type = "header", + name = L["Custom Foreground"], + order = 17.70, + hidden = function() return texture_data[data.foregroundTexture] end + }, + customForegroundRows = { + type = "range", + width = WeakAuras.normalWidth, + name = L["Rows"], + min = 1, + max = 64, + order = 17.71, + hidden = function() return texture_data[data.foregroundTexture] end + }, + customForegroundColumns = { + type = "range", + width = WeakAuras.normalWidth, + name = L["Columns"], + min = 1, + max = 64, + order = 17.72, + hidden = function() return texture_data[data.foregroundTexture] end + }, + customForegroundFrames = { + type = "range", + width = WeakAuras.normalWidth, + name = L["Frame Count"], + min = 0, + max = 4096, + --bigStep = 0.01, + order = 17.73, + hidden = function() return texture_data[data.foregroundTexture] end + }, + customForegroundSpace = { + type = "execute", + width = WeakAuras.normalWidth, + name = "", + order = 17.74, + image = function() return "", 0, 0 end, + hidden = function() return texture_data[data.foregroundTexture] end + }, + -- Background options for custom textures + customBackgroundHeader = { + type = "header", + name = L["Custom Background"], + order = 18.00, + hidden = function() return data.sameTexture or texture_data[data.backgroundTexture] + or data.hideBackground end + }, + customBackgroundRows = { + type = "range", + width = WeakAuras.normalWidth, + name = L["Rows"], + min = 1, + max = 64, + order = 18.01, + hidden = function() return data.sameTexture or texture_data[data.backgroundTexture] + or data.hideBackground end + }, + customBackgroundColumns = { + type = "range", + width = WeakAuras.normalWidth, + name = L["Columns"], + min = 1, + max = 64, + order = 18.02, + hidden = function() return data.sameTexture or texture_data[data.backgroundTexture] + or data.hideBackground end + }, + customBackgroundFrames = { + type = "range", + width = WeakAuras.normalWidth, + name = L["Frame Count"], + min = 0, + max = 4096, + step = 1, + order = 18.03, + hidden = function() return data.sameTexture or texture_data[data.backgroundTexture] + or data.hideBackground end + }, + customBackgroundSpace = { + type = "execute", + width = WeakAuras.normalWidth, + name = "", + order = 18.04, + image = function() return "", 0, 0 end, + hidden = function() return data.sameTexture or texture_data[data.backgroundTexture] + or data.hideBackground end + }, + blendMode = { + type = "select", + width = WeakAuras.normalWidth, + name = L["Blend Mode"], + order = 20, + values = WeakAuras.blend_types + }, + animationType = { + type = "select", + width = WeakAuras.normalWidth, + name = L["Animation Mode"], + order = 21, + values = animation_types + }, + startPercent = { + type = "range", + width = WeakAuras.normalWidth, + name = L["Animation Start"], + min = 0, + max = 1, + --bigStep = 0.01, + order = 22, + isPercent = true + }, + endPercent = { + type = "range", + width = WeakAuras.normalWidth, + name = L["Animation End"], + min = 0, + max = 1, + --bigStep = 0.01, + order = 23, + isPercent = true + }, + frameRate = { + type = "range", + width = WeakAuras.normalWidth, + name = L["Frame Rate"], + min = 3, + max = 120, + step = 1, + bigStep = 3, + order = 24, + disabled = function() return data.animationType == "progress" end; + }, + backgroundPercent = { + type = "range", + width = WeakAuras.normalWidth, + name = L["Background"], + min = 0, + max = 1, + order = 25, + isPercent = true, + disabled = function() return data.hideBackground; end + }, + foregroundColor = { + type = "color", + width = WeakAuras.normalWidth, + name = L["Foreground Color"], + hasAlpha = true, + order = 30 + }, + backgroundColor = { + type = "color", + width = WeakAuras.normalWidth, + name = L["Background Color"], + hasAlpha = true, + order = 32, + disabled = function() return data.hideBackground; end + }, + inverse = { + type = "toggle", + width = WeakAuras.normalWidth, + name = L["Inverse"], + order = 33 + }, + space3 = { + type = "execute", + width = WeakAuras.normalWidth, + name = "", + order = 36, + image = function() return "", 0, 0 end, + }, + }; + + if WeakAuras.commonOptions then + return { + stopmotion = options, + position = WeakAuras.commonOptions.PositionOptions(id, data, 2), + }; + else + return { + stopmotion = options, + position = WeakAuras.PositionOptions(id, data, 2), + }; + end +end + +local function createThumbnail() + local borderframe = CreateFrame("FRAME", nil, UIParent); + borderframe:SetWidth(32); + borderframe:SetHeight(32); + + local border = borderframe:CreateTexture(nil, "OVERLAY"); + border:SetAllPoints(borderframe); + border:SetTexture("Interface\\BUTTONS\\UI-Quickslot2.blp"); + border:SetTexCoord(0.2, 0.8, 0.2, 0.8); + + local texture = borderframe:CreateTexture(); + borderframe.texture = texture; + texture:SetPoint("CENTER", borderframe, "CENTER"); + + return borderframe; +end + +local function modifyThumbnail(parent, region, data, fullModify, size) + region:SetParent(parent) + + size = size or 30; + local scale; + if(data.height > data.width) then + scale = size/data.height; + region.texture:SetWidth(scale * data.width); + region.texture:SetHeight(size); + else + scale = size/data.width; + region.texture:SetWidth(size); + region.texture:SetHeight(scale * data.height); + end + + local frame = 1; + + local tdata = texture_data[data.foregroundTexture]; + if (tdata) then + local lastFrame = tdata.count - 1; + region.startFrame = floor( (data.startPercent or 0) * lastFrame) + 1; + region.endFrame = floor( (data.endPercent or 1) * lastFrame) + 1; + region.foregroundRows = tdata.rows; + region.foregroundColumns = tdata.columns; + else + local lastFrame = data.customForegroundFrames - 1; + region.startFrame = floor( (data.startPercent or 0) * lastFrame) + 1; + region.endFrame = floor( (data.endPercent or 1) * lastFrame) + 1; + region.foregroundRows = data.customForegroundRows; + region.foregroundColumns = data.customForegroundColumns; + end + + if (region.startFrame and region.endFrame) then + frame = floor(region.startFrame + (region.endFrame - region.startFrame) * 0.75); + end + + local texture = data.foregroundTexture or "Interface\\AddOns\\WeakAuras\\Media\\Textures\\stopmotion"; + + if (region.foregroundRows and region.foregroundColumns) then + region.texture:SetTexture(texture); + setTile(region.texture, frame, region.foregroundRows, region.foregroundColumns); + + region.SetValue = function(self, percent) + local frame = floor(percent * (region.endFrame - region.startFrame) + region.startFrame); + setTile(self.texture, frame, region.foregroundRows, region.foregroundColumns); + end + else + region.texture:SetTexture(texture .. format("%03d", frame)); + region.texture:SetTexCoord(0, 1, 0, 1); + + region.SetValue = function(self, percent) + local frame = floor(percent * (region.endFrame - region.startFrame) + region.startFrame); + self.texture:SetTexture((data.foregroundTexture) .. format("%03d", frame)); + end + end + + region.texture:SetVertexColor(data.foregroundColor[1], data.foregroundColor[2], data.foregroundColor[3], data.foregroundColor[4]); + region.texture:SetBlendMode(data.blendMode); + + region.elapsed = 0; + region:SetScript("OnUpdate", function(self, elapsed) + region.elapsed = region.elapsed + elapsed; + if(region.elapsed > 4) then + region.elapsed = region.elapsed - 4; + end + region:SetValue(region.elapsed / 4); + end); +end + +local function createIcon() + local data = { + height = 30, + width = 30, + foregroundTexture = "Interface\\AddOns\\WeakAuras\\Media\\Textures\\StopMotion", + foregroundColor = {1, 1, 1, 1}, + blendMode = "ADD", + rotate = false, + rotation = 0, + startPercent = 0, + endPercent = 1, + backgroundPercent = 1, + animationType = "progress" + }; + + local thumbnail = createThumbnail(UIParent); + modifyThumbnail(UIParent, thumbnail, data, nil, 75); + + thumbnail.elapsed = 0; + thumbnail:SetScript("OnUpdate", function(self, elapsed) + thumbnail.elapsed = thumbnail.elapsed + elapsed; + if(thumbnail.elapsed > 2) then + thumbnail.elapsed = thumbnail.elapsed - 2; + end + thumbnail:SetValue(thumbnail.elapsed / 2); + end); + + return thumbnail; +end + +WeakAuras.RegisterRegionOptions("stopmotion", createOptions, createIcon, L["Stop Motion"], createThumbnail, modifyThumbnail, L["Shows a stop motion textures"]); diff --git a/WeakAurasOptions/WeakAurasOptions.toc b/WeakAurasOptions/WeakAurasOptions.toc index f90232e..234a415 100644 --- a/WeakAurasOptions/WeakAurasOptions.toc +++ b/WeakAurasOptions/WeakAurasOptions.toc @@ -24,6 +24,7 @@ RegionOptions\Icon.lua RegionOptions\Text.lua RegionOptions\Group.lua RegionOptions\DynamicGroup.lua +RegionOptions\StopMotion.lua RegionOptions\Model.lua RegionOptions\ProgressTexture.lua