From 79c6642f13aa0ab4043f08952a6b7647c744fef0 Mon Sep 17 00:00:00 2001 From: JinGao <519196476@qq.com> Date: Thu, 20 Nov 2025 23:58:38 +0800 Subject: [PATCH 1/4] fireworks animation --- Locales/deDE.lua | 1 + Locales/enUS.lua | 1 + Locales/esES.lua | 1 + Locales/esMX.lua | 1 + Locales/frFR.lua | 1 + Locales/koKR.lua | 1 + Locales/ruRU.lua | 1 + Locales/zhCN.lua | 1 + Locales/zhTW.lua | 1 + NameplateSCT.lua | 13 +++++++++++++ 10 files changed, 22 insertions(+) diff --git a/Locales/deDE.lua b/Locales/deDE.lua index 1c971a9..c422a08 100644 --- a/Locales/deDE.lua +++ b/Locales/deDE.lua @@ -50,6 +50,7 @@ L["Enable"] = "Aktivieren" --L["Font Flags"] = "Font Flags" L["Font"] = "Schriftart" --L["Fountain"] = "Fountain" +L["Fireworks"] = "Feuerwerk" --L["Has soft max/min, you can type whatever you'd like into the editbox"] = "Has soft max/min, you can type whatever you'd like into the editbox" --L["Hide hits that are below a running average of your recent damage output"] = "Hide hits that are below a running average of your recent damage output" --L["Hide hits that are below this threshold."] = "Hide hits that are below this threshold." diff --git a/Locales/enUS.lua b/Locales/enUS.lua index 5196eca..debfa6d 100644 --- a/Locales/enUS.lua +++ b/Locales/enUS.lua @@ -49,6 +49,7 @@ L["Filters"] = true L["Font Flags"] = true L["Font"] = true L["Fountain"] = true +L["Fireworks"] = true L["Has soft max/min, you can type whatever you'd like into the editbox"] = true L["Hide hits that are below a running average of your recent damage output"] = true L["Hide hits that are below this threshold."] = true diff --git a/Locales/esES.lua b/Locales/esES.lua index 6702e68..a1302ee 100644 --- a/Locales/esES.lua +++ b/Locales/esES.lua @@ -50,6 +50,7 @@ L["Display only the icon for damage.\nWill not change Miss, Dodge, Parry, etc di --L["Font Flags"] = "Font Flags" --L["Font"] = "Font" --L["Fountain"] = "Fountain" +L["Fireworks"] = "Fuegos artificiales" --L["Has soft max/min, you can type whatever you'd like into the editbox"] = "Has soft max/min, you can type whatever you'd like into the editbox" --L["Hide hits that are below a running average of your recent damage output"] = "Hide hits that are below a running average of your recent damage output" --L["Hide hits that are below this threshold."] = "Hide hits that are below this threshold." diff --git a/Locales/esMX.lua b/Locales/esMX.lua index 028195c..818f6d1 100644 --- a/Locales/esMX.lua +++ b/Locales/esMX.lua @@ -50,6 +50,7 @@ if not L then return end --L["Font Flags"] = "Font Flags" --L["Font"] = "Font" --L["Fountain"] = "Fountain" +L["Fireworks"] = "Fuegos artificiales" --L["Has soft max/min, you can type whatever you'd like into the editbox"] = "Has soft max/min, you can type whatever you'd like into the editbox" --L["Hide hits that are below a running average of your recent damage output"] = "Hide hits that are below a running average of your recent damage output" --L["Hide hits that are below this threshold."] = "Hide hits that are below this threshold." diff --git a/Locales/frFR.lua b/Locales/frFR.lua index cdfb409..003ed12 100644 --- a/Locales/frFR.lua +++ b/Locales/frFR.lua @@ -50,6 +50,7 @@ L["Evaded"] = "Évité" --L["Font Flags"] = "Font Flags" L["Font"] = "Police de caractère" L["Fountain"] = "Fontaine" +L["Fireworks"] = "Feux d'artifice" --L["Has soft max/min, you can type whatever you'd like into the editbox"] = "Has soft max/min, you can type whatever you'd like into the editbox" L["Hide hits that are below a running average of your recent damage output"] = "Cacher les dégâts qui sont en dessous de la moyenne des dégâts récents" --L["Hide hits that are below this threshold."] = "Hide hits that are below this threshold." diff --git a/Locales/koKR.lua b/Locales/koKR.lua index ac3937e..5978eb1 100644 --- a/Locales/koKR.lua +++ b/Locales/koKR.lua @@ -50,6 +50,7 @@ L["Evaded"] = "벗어남" L["Font Flags"] = "글꼴 외곽선" L["Font"] = "글꼴" L["Fountain"] = "분수" +L["Fireworks"] = "불꽃놀이" L["Has soft max/min, you can type whatever you'd like into the editbox"] = "최대/최소 값이 있습니다, 입력창에 원하는 값을 입력할 수 있습니다." L["Hide hits that are below a running average of your recent damage output"] = "피해량이 최근 피해량의 평균보다 낮으면 숨깁니다" --L["Hide hits that are below this threshold."] = "Hide hits that are below this threshold." diff --git a/Locales/ruRU.lua b/Locales/ruRU.lua index fc4e110..d2d04ae 100644 --- a/Locales/ruRU.lua +++ b/Locales/ruRU.lua @@ -50,6 +50,7 @@ L["Evaded"] = "Избежание" L["Font Flags"] = "Параметры шрифта" L["Font"] = "Шрифт" L["Fountain"] = "Фонтан" +L["Fireworks"] = "Фейерверк" L["Has soft max/min, you can type whatever you'd like into the editbox"] = "Имеет неограниченный минимум/максимум, можно ввести любое число в поле ввода" L["Hide hits that are below a running average of your recent damage output"] = "Скрыть слабые удары, которые ниже среднего урона персонажа" --L["Hide hits that are below this threshold."] = "Hide hits that are below this threshold." diff --git a/Locales/zhCN.lua b/Locales/zhCN.lua index 3c51926..f7c26d8 100644 --- a/Locales/zhCN.lua +++ b/Locales/zhCN.lua @@ -50,6 +50,7 @@ L["Filters"] = "过滤器" L["Font Flags"] = "字体描边" L["Font"] = "字体" L["Fountain"] = "弧形" +L["Fireworks"] = "烟花" L["Has soft max/min, you can type whatever you'd like into the editbox"] = "有最大值/最小值限制,可在输入框中输入规则内的任意数值" L["Hide hits that are below a running average of your recent damage output"] = "隐藏低于最近攻击平均值的伤害" L["Hide hits that are below this threshold."] = "隐藏低于此阈值的命中伤害。" diff --git a/Locales/zhTW.lua b/Locales/zhTW.lua index aee369b..457b5a0 100644 --- a/Locales/zhTW.lua +++ b/Locales/zhTW.lua @@ -50,6 +50,7 @@ L["Filters"] = "過濾器" L["Font Flags"] = "文字樣式" L["Font"] = "字體" L["Fountain"] = "潮吹噴泉" +L["Fireworks"] = "煙花" L["Has soft max/min, you can type whatever you'd like into the editbox"] = "有軟上限 / 下限,請隨意輸入喜愛的數值。" L["Hide hits that are below a running average of your recent damage output"] = "隱藏低於最近輸出平均值的傷害。" L["Hide hits that are below this threshold."] = "隱藏低於此閥值的命中。" diff --git a/NameplateSCT.lua b/NameplateSCT.lua index 44bd60d..961df7e 100644 --- a/NameplateSCT.lua +++ b/NameplateSCT.lua @@ -44,6 +44,7 @@ local animationValues = { ["verticalDown"] = L["Vertical Down"], ["fountain"] = L["Fountain"], ["rainfall"] = L["Rainfall"], + ["fireworks"] = L["Fireworks"], ["disabled"] = L["Disabled"] } @@ -651,6 +652,15 @@ local function AnimationOnUpdate() _, yOffset = verticalPath(elapsed, fontString.animatingDuration, -fontString.distance) xOffset = fontString.rainfallX yOffset = yOffset + fontString.rainfallStartY + elseif (fontString.animation == "fireworks") then + -- 烟花效果:从中心点向四周发散 + local angle = fontString.fireworksAngle or (math.random() * 2 * math.pi) + local progress = elapsed / fontString.animatingDuration + -- 使用自定义的缓动函数:起始快,滞留慢 + local easedProgress = progress < 0.5 and 2 * progress * progress or 1 - math.pow(-2 * progress + 2, 2) / 2 + local distance = (fontString.fireworksDistance or 100) * easedProgress + xOffset = distance * math.cos(angle) + yOffset = distance * math.sin(angle) -- elseif (fontString.animation == "shake") then -- TODO end @@ -698,6 +708,9 @@ function NameplateSCT:Animate(fontString, anchorFrame, duration, animation) fontString.distance = math.random(ANIMATION_RAINFALL_Y_MIN, ANIMATION_RAINFALL_Y_MAX) fontString.rainfallX = math.random(-ANIMATION_RAINFALL_X_MAX, ANIMATION_RAINFALL_X_MAX) fontString.rainfallStartY = -math.random(ANIMATION_RAINFALL_Y_START_MIN, ANIMATION_RAINFALL_Y_START_MAX) + elseif (animation == "fireworks") then + fontString.fireworksAngle = math.random() * 2 * math.pi + fontString.fireworksDistance = math.random(80, 150) -- elseif (animation == "shake") then -- fontString.deflection = ANIMATION_SHAKE_DEFLECTION -- fontString.numShakes = ANIMATION_SHAKE_NUM_SHAKES From e77cf951cfd874f1b538d8f61e1f5a897532aad9 Mon Sep 17 00:00:00 2001 From: cfy2015 <519196476@qq.com> Date: Sat, 22 Nov 2025 11:34:24 +0800 Subject: [PATCH 2/4] animation update animation update --- NameplateSCT.lua | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/NameplateSCT.lua b/NameplateSCT.lua index 961df7e..ea1059c 100644 --- a/NameplateSCT.lua +++ b/NameplateSCT.lua @@ -653,23 +653,31 @@ local function AnimationOnUpdate() xOffset = fontString.rainfallX yOffset = yOffset + fontString.rainfallStartY elseif (fontString.animation == "fireworks") then - -- 烟花效果:从中心点向四周发散 + -- 烟花效果:从半径80的圆周向四周发散 local angle = fontString.fireworksAngle or (math.random() * 2 * math.pi) local progress = elapsed / fontString.animatingDuration -- 使用自定义的缓动函数:起始快,滞留慢 local easedProgress = progress < 0.5 and 2 * progress * progress or 1 - math.pow(-2 * progress + 2, 2) / 2 local distance = (fontString.fireworksDistance or 100) * easedProgress - xOffset = distance * math.cos(angle) - yOffset = distance * math.sin(angle) + + -- 固定起始半径 80 + local startRadius = 80 + xOffset = (startRadius + distance) * math.cos(angle) + yOffset = (startRadius + distance) * math.sin(angle) -- elseif (fontString.animation == "shake") then -- TODO end if (not UnitIsDead(fontString.unit) and fontString.anchorFrame and fontString.anchorFrame:IsShown()) then - if fontString.unit == "player" then -- player frame - fontString:SetPoint("CENTER", fontString.anchorFrame, "CENTER", NameplateSCT.db.global.xOffsetPersonal + xOffset + randomX[fontString], NameplateSCT.db.global.yOffsetPersonal + yOffset + randomY[fontString]) -- Only allows for adjusting vertical offset - else -- nameplate frames - fontString:SetPoint("CENTER", fontString.anchorFrame, "CENTER", NameplateSCT.db.global.xOffset + xOffset + randomX[fontString], NameplateSCT.db.global.yOffset + yOffset + randomY[fontString]) + if fontString.animation == "fireworks" then + -- 烟花效果忽略全局偏移和随机抖动,始终相对于中心 + fontString:SetPoint("CENTER", fontString.anchorFrame, "CENTER", xOffset, yOffset) + else + if fontString.unit == "player" then -- player frame + fontString:SetPoint("CENTER", fontString.anchorFrame, "CENTER", NameplateSCT.db.global.xOffsetPersonal + xOffset + randomX[fontString], NameplateSCT.db.global.yOffsetPersonal + yOffset + randomY[fontString]) -- Only allows for adjusting vertical offset + else -- nameplate frames + fontString:SetPoint("CENTER", fontString.anchorFrame, "CENTER", NameplateSCT.db.global.xOffset + xOffset + randomX[fontString], NameplateSCT.db.global.yOffset + yOffset + randomY[fontString]) + end end else recycleFontString(fontString) From 4b8e7921a3a89ce6955e45a527bbbcc107980f48 Mon Sep 17 00:00:00 2001 From: cfy2015 <519196476@qq.com> Date: Sat, 22 Nov 2025 16:43:38 +0800 Subject: [PATCH 3/4] fireworks config Add configuration for fireworks animation --- Locales/deDE.lua | 2 ++ Locales/enUS.lua | 2 ++ Locales/esES.lua | 2 ++ Locales/esMX.lua | 2 ++ Locales/frFR.lua | 2 ++ Locales/koKR.lua | 2 ++ Locales/ruRU.lua | 2 ++ Locales/zhCN.lua | 2 ++ Locales/zhTW.lua | 2 ++ NameplateSCT.lua | 20 +++++++++++++++++--- 10 files changed, 35 insertions(+), 3 deletions(-) diff --git a/Locales/deDE.lua b/Locales/deDE.lua index c422a08..155f229 100644 --- a/Locales/deDE.lua +++ b/Locales/deDE.lua @@ -51,6 +51,8 @@ L["Enable"] = "Aktivieren" L["Font"] = "Schriftart" --L["Fountain"] = "Fountain" L["Fireworks"] = "Feuerwerk" +L["Fireworks Radius"] = "Fireworks Radius" +L["Start radius for fireworks animation"] = "Start radius for fireworks animation" --L["Has soft max/min, you can type whatever you'd like into the editbox"] = "Has soft max/min, you can type whatever you'd like into the editbox" --L["Hide hits that are below a running average of your recent damage output"] = "Hide hits that are below a running average of your recent damage output" --L["Hide hits that are below this threshold."] = "Hide hits that are below this threshold." diff --git a/Locales/enUS.lua b/Locales/enUS.lua index debfa6d..2fc4093 100644 --- a/Locales/enUS.lua +++ b/Locales/enUS.lua @@ -50,6 +50,8 @@ L["Font Flags"] = true L["Font"] = true L["Fountain"] = true L["Fireworks"] = true +L["Fireworks Radius"] = true +L["Start radius for fireworks animation"] = true L["Has soft max/min, you can type whatever you'd like into the editbox"] = true L["Hide hits that are below a running average of your recent damage output"] = true L["Hide hits that are below this threshold."] = true diff --git a/Locales/esES.lua b/Locales/esES.lua index a1302ee..6283faf 100644 --- a/Locales/esES.lua +++ b/Locales/esES.lua @@ -51,6 +51,8 @@ L["Display only the icon for damage.\nWill not change Miss, Dodge, Parry, etc di --L["Font"] = "Font" --L["Fountain"] = "Fountain" L["Fireworks"] = "Fuegos artificiales" +L["Fireworks Radius"] = "Fireworks Radius" +L["Start radius for fireworks animation"] = "Start radius for fireworks animation" --L["Has soft max/min, you can type whatever you'd like into the editbox"] = "Has soft max/min, you can type whatever you'd like into the editbox" --L["Hide hits that are below a running average of your recent damage output"] = "Hide hits that are below a running average of your recent damage output" --L["Hide hits that are below this threshold."] = "Hide hits that are below this threshold." diff --git a/Locales/esMX.lua b/Locales/esMX.lua index 818f6d1..25bbc79 100644 --- a/Locales/esMX.lua +++ b/Locales/esMX.lua @@ -51,6 +51,8 @@ if not L then return end --L["Font"] = "Font" --L["Fountain"] = "Fountain" L["Fireworks"] = "Fuegos artificiales" +L["Fireworks Radius"] = "Fireworks Radius" +L["Start radius for fireworks animation"] = "Start radius for fireworks animation" --L["Has soft max/min, you can type whatever you'd like into the editbox"] = "Has soft max/min, you can type whatever you'd like into the editbox" --L["Hide hits that are below a running average of your recent damage output"] = "Hide hits that are below a running average of your recent damage output" --L["Hide hits that are below this threshold."] = "Hide hits that are below this threshold." diff --git a/Locales/frFR.lua b/Locales/frFR.lua index 003ed12..af88595 100644 --- a/Locales/frFR.lua +++ b/Locales/frFR.lua @@ -51,6 +51,8 @@ L["Evaded"] = "Évité" L["Font"] = "Police de caractère" L["Fountain"] = "Fontaine" L["Fireworks"] = "Feux d'artifice" +L["Fireworks Radius"] = "Fireworks Radius" +L["Start radius for fireworks animation"] = "Start radius for fireworks animation" --L["Has soft max/min, you can type whatever you'd like into the editbox"] = "Has soft max/min, you can type whatever you'd like into the editbox" L["Hide hits that are below a running average of your recent damage output"] = "Cacher les dégâts qui sont en dessous de la moyenne des dégâts récents" --L["Hide hits that are below this threshold."] = "Hide hits that are below this threshold." diff --git a/Locales/koKR.lua b/Locales/koKR.lua index 5978eb1..eacb9ca 100644 --- a/Locales/koKR.lua +++ b/Locales/koKR.lua @@ -51,6 +51,8 @@ L["Font Flags"] = "글꼴 외곽선" L["Font"] = "글꼴" L["Fountain"] = "분수" L["Fireworks"] = "불꽃놀이" +L["Fireworks Radius"] = "Fireworks Radius" +L["Start radius for fireworks animation"] = "Start radius for fireworks animation" L["Has soft max/min, you can type whatever you'd like into the editbox"] = "최대/최소 값이 있습니다, 입력창에 원하는 값을 입력할 수 있습니다." L["Hide hits that are below a running average of your recent damage output"] = "피해량이 최근 피해량의 평균보다 낮으면 숨깁니다" --L["Hide hits that are below this threshold."] = "Hide hits that are below this threshold." diff --git a/Locales/ruRU.lua b/Locales/ruRU.lua index d2d04ae..6c6c2c0 100644 --- a/Locales/ruRU.lua +++ b/Locales/ruRU.lua @@ -51,6 +51,8 @@ L["Font Flags"] = "Параметры шрифта" L["Font"] = "Шрифт" L["Fountain"] = "Фонтан" L["Fireworks"] = "Фейерверк" +L["Fireworks Radius"] = "Fireworks Radius" +L["Start radius for fireworks animation"] = "Start radius for fireworks animation" L["Has soft max/min, you can type whatever you'd like into the editbox"] = "Имеет неограниченный минимум/максимум, можно ввести любое число в поле ввода" L["Hide hits that are below a running average of your recent damage output"] = "Скрыть слабые удары, которые ниже среднего урона персонажа" --L["Hide hits that are below this threshold."] = "Hide hits that are below this threshold." diff --git a/Locales/zhCN.lua b/Locales/zhCN.lua index f7c26d8..99f17df 100644 --- a/Locales/zhCN.lua +++ b/Locales/zhCN.lua @@ -51,6 +51,8 @@ L["Font Flags"] = "字体描边" L["Font"] = "字体" L["Fountain"] = "弧形" L["Fireworks"] = "烟花" +L["Fireworks Radius"] = "烟花起始半径" +L["Start radius for fireworks animation"] = "烟花动画的起始半径" L["Has soft max/min, you can type whatever you'd like into the editbox"] = "有最大值/最小值限制,可在输入框中输入规则内的任意数值" L["Hide hits that are below a running average of your recent damage output"] = "隐藏低于最近攻击平均值的伤害" L["Hide hits that are below this threshold."] = "隐藏低于此阈值的命中伤害。" diff --git a/Locales/zhTW.lua b/Locales/zhTW.lua index 457b5a0..f2f21dc 100644 --- a/Locales/zhTW.lua +++ b/Locales/zhTW.lua @@ -51,6 +51,8 @@ L["Font Flags"] = "文字樣式" L["Font"] = "字體" L["Fountain"] = "潮吹噴泉" L["Fireworks"] = "煙花" +L["Fireworks Radius"] = "煙火起始半徑" +L["Start radius for fireworks animation"] = "煙火動畫的起始半徑" L["Has soft max/min, you can type whatever you'd like into the editbox"] = "有軟上限 / 下限,請隨意輸入喜愛的數值。" L["Hide hits that are below a running average of your recent damage output"] = "隱藏低於最近輸出平均值的傷害。" L["Hide hits that are below this threshold."] = "隱藏低於此閥值的命中。" diff --git a/NameplateSCT.lua b/NameplateSCT.lua index ea1059c..20bf7f9 100644 --- a/NameplateSCT.lua +++ b/NameplateSCT.lua @@ -170,6 +170,7 @@ local defaults = { autoattack = "fountain", autoattackcrit = "verticalUp", animationspeed = 1, + fireworksRadius = 150, }, animationsPersonal = { @@ -653,15 +654,15 @@ local function AnimationOnUpdate() xOffset = fontString.rainfallX yOffset = yOffset + fontString.rainfallStartY elseif (fontString.animation == "fireworks") then - -- 烟花效果:从半径80的圆周向四周发散 + -- 烟花效果:从配置的起始半径圆周向四周发散 local angle = fontString.fireworksAngle or (math.random() * 2 * math.pi) local progress = elapsed / fontString.animatingDuration -- 使用自定义的缓动函数:起始快,滞留慢 local easedProgress = progress < 0.5 and 2 * progress * progress or 1 - math.pow(-2 * progress + 2, 2) / 2 local distance = (fontString.fireworksDistance or 100) * easedProgress - -- 固定起始半径 80 - local startRadius = 80 + -- 获取配置的起始半径 + local startRadius = NameplateSCT.db.global.animations.fireworksRadius xOffset = (startRadius + distance) * math.cos(angle) yOffset = (startRadius + distance) * math.sin(angle) -- elseif (fontString.animation == "shake") then @@ -1440,6 +1441,19 @@ local menu = { order = 1, width = "full", }, + fireworksRadius = { + type = 'range', + name = L["Fireworks Radius"], + desc = L["Start radius for fireworks animation"], + disabled = function() return not NameplateSCT.db.global.enabled end, + min = 100, + max = 250, + step = 10, + get = function() return NameplateSCT.db.global.animations.fireworksRadius end, + set = function(_, newValue) NameplateSCT.db.global.animations.fireworksRadius = newValue end, + order = 1.5, + width = "full", + }, ability = { type = 'select', name = L["Abilities"], From 71aa881828032447c0e7d386e615d62c72078a09 Mon Sep 17 00:00:00 2001 From: cfy2015 <519196476@qq.com> Date: Sat, 22 Nov 2025 17:53:30 +0800 Subject: [PATCH 4/4] animation update 1.LinearEasing animation 2.add more configuration --- Locales/deDE.lua | 4 ++ Locales/enUS.lua | 3 ++ Locales/esES.lua | 4 ++ Locales/esMX.lua | 4 ++ Locales/frFR.lua | 4 ++ Locales/koKR.lua | 4 ++ Locales/ruRU.lua | 4 ++ Locales/zhCN.lua | 4 ++ Locales/zhTW.lua | 4 ++ NameplateSCT.lua | 105 +++++++++++++++++++++++++++++++++++++++++++---- 10 files changed, 131 insertions(+), 9 deletions(-) diff --git a/Locales/deDE.lua b/Locales/deDE.lua index 155f229..3b0b2b7 100644 --- a/Locales/deDE.lua +++ b/Locales/deDE.lua @@ -1,6 +1,10 @@ local L = LibStub("AceLocale-3.0"):NewLocale("NameplateSCT", "deDE") if not L then return end +L["Fireworks Settings"] = "Fireworks Settings" +L["Fireworks Duration"] = "Fireworks Duration" +L["Duration of the fireworks animation"] = "Duration of the fireworks animation" + --L["%s (A: %s)"] = "%s (A: %s)" -- A for Absorb --L["%s (O: %s)"] = "%s (O: %s)" -- O for Overkill L["Abilities"] = "Fähigkeiten" diff --git a/Locales/enUS.lua b/Locales/enUS.lua index 2fc4093..d4fa102 100644 --- a/Locales/enUS.lua +++ b/Locales/enUS.lua @@ -51,6 +51,9 @@ L["Font"] = true L["Fountain"] = true L["Fireworks"] = true L["Fireworks Radius"] = true +L["Fireworks Settings"] = true +L["Fireworks Duration"] = true +L["Duration of the fireworks animation"] = true L["Start radius for fireworks animation"] = true L["Has soft max/min, you can type whatever you'd like into the editbox"] = true L["Hide hits that are below a running average of your recent damage output"] = true diff --git a/Locales/esES.lua b/Locales/esES.lua index 6283faf..f8cec97 100644 --- a/Locales/esES.lua +++ b/Locales/esES.lua @@ -1,6 +1,10 @@ local L = LibStub("AceLocale-3.0"):NewLocale("NameplateSCT", "esES") if not L then return end +L["Fireworks Settings"] = "Fireworks Settings" +L["Fireworks Duration"] = "Fireworks Duration" +L["Duration of the fireworks animation"] = "Duration of the fireworks animation" + --L["%s (A: %s)"] = "%s (A: %s)" -- A for Absorb --L["%s (O: %s)"] = "%s (O: %s)" -- O for Overkill L["Abilities"] = "Habilidades" diff --git a/Locales/esMX.lua b/Locales/esMX.lua index 25bbc79..89b33ae 100644 --- a/Locales/esMX.lua +++ b/Locales/esMX.lua @@ -1,6 +1,10 @@ local L = LibStub("AceLocale-3.0"):NewLocale("NameplateSCT", "esMX") if not L then return end +L["Fireworks Settings"] = "Fireworks Settings" +L["Fireworks Duration"] = "Fireworks Duration" +L["Duration of the fireworks animation"] = "Duration of the fireworks animation" + --L["%s (A: %s)"] = "%s (A: %s)" -- A for Absorb --L["%s (O: %s)"] = "%s (O: %s)" -- O for Overkill --L["Abilities"] = "Abilities" diff --git a/Locales/frFR.lua b/Locales/frFR.lua index af88595..6fc4250 100644 --- a/Locales/frFR.lua +++ b/Locales/frFR.lua @@ -1,6 +1,10 @@ local L = LibStub("AceLocale-3.0"):NewLocale("NameplateSCT", "frFR") if not L then return end +L["Fireworks Settings"] = "Fireworks Settings" +L["Fireworks Duration"] = "Fireworks Duration" +L["Duration of the fireworks animation"] = "Duration of the fireworks animation" + --L["%s (A: %s)"] = "%s (A: %s)" -- A for Absorb --L["%s (O: %s)"] = "%s (O: %s)" -- O for Overkill L["Abilities"] = "Abilités" diff --git a/Locales/koKR.lua b/Locales/koKR.lua index eacb9ca..dc3b808 100644 --- a/Locales/koKR.lua +++ b/Locales/koKR.lua @@ -1,6 +1,10 @@ local L = LibStub("AceLocale-3.0"):NewLocale("NameplateSCT", "koKR") if not L then return end +L["Fireworks Settings"] = "Fireworks Settings" +L["Fireworks Duration"] = "Fireworks Duration" +L["Duration of the fireworks animation"] = "Duration of the fireworks animation" + --L["%s (A: %s)"] = "%s (A: %s)" -- A for Absorb --L["%s (O: %s)"] = "%s (O: %s)" -- O for Overkill L["Abilities"] = "능력" diff --git a/Locales/ruRU.lua b/Locales/ruRU.lua index 6c6c2c0..65bdb86 100644 --- a/Locales/ruRU.lua +++ b/Locales/ruRU.lua @@ -1,6 +1,10 @@ local L = LibStub("AceLocale-3.0"):NewLocale("NameplateSCT", "ruRU") if not L then return end +L["Fireworks Settings"] = "Fireworks Settings" +L["Fireworks Duration"] = "Fireworks Duration" +L["Duration of the fireworks animation"] = "Duration of the fireworks animation" + --L["%s (A: %s)"] = "%s (A: %s)" -- A for Absorb --L["%s (O: %s)"] = "%s (O: %s)" -- O for Overkill L["Abilities"] = "Способности" diff --git a/Locales/zhCN.lua b/Locales/zhCN.lua index 99f17df..2df34fa 100644 --- a/Locales/zhCN.lua +++ b/Locales/zhCN.lua @@ -1,6 +1,10 @@ local L = LibStub("AceLocale-3.0"):NewLocale("NameplateSCT", "zhCN") if not L then return end +L["Fireworks Settings"] = "烟花设置" +L["Fireworks Duration"] = "烟花持续时间" +L["Duration of the fireworks animation"] = "烟花动画的持续时间" + L["%s (A: %s)"] = "%s (吸收: %s)" -- A for Absorb L["%s (O: %s)"] = "%s (过量: %s)" -- O for Overkill L["Abilities"] = "技能" diff --git a/Locales/zhTW.lua b/Locales/zhTW.lua index f2f21dc..79a9b1e 100644 --- a/Locales/zhTW.lua +++ b/Locales/zhTW.lua @@ -1,6 +1,10 @@ local L = LibStub("AceLocale-3.0"):NewLocale("NameplateSCT", "zhTW") if not L then return end +L["Fireworks Settings"] = "煙火設定" +L["Fireworks Duration"] = "煙火持續時間" +L["Duration of the fireworks animation"] = "煙火動畫的持續時間" + L["%s (A: %s)"] = "%s (吸收: %s)" -- A for Absorb L["%s (O: %s)"] = "%s (過量: %s)" -- O for Overkill L["Abilities"] = "技能" diff --git a/NameplateSCT.lua b/NameplateSCT.lua index 20bf7f9..55ea6c3 100644 --- a/NameplateSCT.lua +++ b/NameplateSCT.lua @@ -170,7 +170,8 @@ local defaults = { autoattack = "fountain", autoattackcrit = "verticalUp", animationspeed = 1, - fireworksRadius = 150, + fireworksRadius = 100, + fireworksDuration = 1, }, animationsPersonal = { @@ -580,6 +581,56 @@ local function powSizing(elapsed, duration, start, middle, finish) return size end +-- CSS linear() points +local linearPoints = { + {0, 0}, + {0.036, 0.21}, + {0.074, 0.402}, + {0.113, 0.568}, + {0.153, 0.711}, + {0.173, 0.772}, + {0.194, 0.83}, + {0.215, 0.882}, + {0.237, 0.929}, + {0.259, 0.97}, + {0.282, 1.008}, + {0.306, 1.04}, + {0.33, 1.067}, + {0.349, 1.084}, + {0.369, 1.099}, + {0.389, 1.111}, + {0.41, 1.12}, + {0.432, 1.127}, + {0.454, 1.13}, + {0.477, 1.132}, + {0.501, 1.13}, + {0.54, 1.124}, + {0.585, 1.111}, + {0.629, 1.095}, + {0.755, 1.044}, + {0.795, 1.03}, + {0.832, 1.019}, + {0.873, 1.01}, + {0.913, 1.004}, + {0.954, 1.001}, + {1, 1} +} + +local function GetLinearEasing(p) + if p <= 0 then return linearPoints[1][2] end + if p >= 1 then return linearPoints[#linearPoints][2] end + + for i = 1, #linearPoints - 1 do + local p1 = linearPoints[i] + local p2 = linearPoints[i+1] + if p >= p1[1] and p < p2[1] then + local percent = (p - p1[1]) / (p2[1] - p1[1]) + return p1[2] + (p2[2] - p1[2]) * percent + end + end + return linearPoints[#linearPoints][2] +end + local function AnimationOnUpdate() if (next(animating)) then for fontString, _ in pairs(animating) do @@ -657,8 +708,8 @@ local function AnimationOnUpdate() -- 烟花效果:从配置的起始半径圆周向四周发散 local angle = fontString.fireworksAngle or (math.random() * 2 * math.pi) local progress = elapsed / fontString.animatingDuration - -- 使用自定义的缓动函数:起始快,滞留慢 - local easedProgress = progress < 0.5 and 2 * progress * progress or 1 - math.pow(-2 * progress + 2, 2) / 2 + -- 使用自定义的 linear() 缓动函数 + local easedProgress = GetLinearEasing(progress) local distance = (fontString.fireworksDistance or 100) * easedProgress -- 获取配置的起始半径 @@ -1160,7 +1211,11 @@ function NameplateSCT:DisplayText(guid, text, size, animation, spellId, pow, spe end end end - self:Animate(fontString, nameplate, NameplateSCT.db.global.animations.animationspeed, animation) + local duration = NameplateSCT.db.global.animations.animationspeed + if animation == "fireworks" then + duration = NameplateSCT.db.global.animations.fireworksDuration + end + self:Animate(fontString, nameplate, duration, animation) end function NameplateSCT:DisplayIconWithoutText(guid, size, animation, spellId, pow, spellName) @@ -1226,7 +1281,11 @@ function NameplateSCT:DisplayIconWithoutText(guid, size, animation, spellId, pow end end end - self:Animate(fontString, nameplate, NameplateSCT.db.global.animations.animationspeed, animation) + local duration = NameplateSCT.db.global.animations.animationspeed + if animation == "fireworks" then + duration = NameplateSCT.db.global.animations.fireworksDuration + end + self:Animate(fontString, nameplate, duration, animation) end function NameplateSCT:DisplayTextOverkill(guid, text, size, animation, spellId, pow, spellName) @@ -1288,7 +1347,11 @@ function NameplateSCT:DisplayTextOverkill(guid, text, size, animation, spellId, end end end - self:Animate(fontString, nameplate, NameplateSCT.db.global.animations.animationspeed, animation) + local duration = NameplateSCT.db.global.animations.animationspeed + if animation == "fireworks" then + duration = NameplateSCT.db.global.animations.fireworksDuration + end + self:Animate(fontString, nameplate, duration, animation) end function NameplateSCT:ColorText(startingText, guid, playerGUID, school, spellName, crit) @@ -1441,16 +1504,40 @@ local menu = { order = 1, width = "full", }, + fireworksSettings = { + type = 'header', + name = L["Fireworks Settings"], + order = 1.2, + }, fireworksRadius = { type = 'range', name = L["Fireworks Radius"], desc = L["Start radius for fireworks animation"], disabled = function() return not NameplateSCT.db.global.enabled end, - min = 100, - max = 250, - step = 10, + min = 0, + max = 200, + step = 20, get = function() return NameplateSCT.db.global.animations.fireworksRadius end, set = function(_, newValue) NameplateSCT.db.global.animations.fireworksRadius = newValue end, + order = 1.3, + width = "normal", + }, + fireworksDuration = { + type = 'range', + name = L["Fireworks Duration"], + desc = L["Duration of the fireworks animation"], + disabled = function() return not NameplateSCT.db.global.enabled end, + min = 0.5, + max = 3, + step = 0.5, + get = function() return NameplateSCT.db.global.animations.fireworksDuration end, + set = function(_, newValue) NameplateSCT.db.global.animations.fireworksDuration = newValue end, + order = 1.4, + width = "normal", + }, + fireworksSpacer = { + type = 'description', + name = "", order = 1.5, width = "full", },