Multi-coloured Mouse Trail
Original weakaura link:
https://wago.io/RzZVq4F1a
Enjoy.
|
|
| Quick Facts |
|---|
Original weakaura link:
https://wago.io/RzZVq4F1a
Enjoy.
Contains custom functions.
Code has been reviewed and is safe to use, custom functions might affect in-game performance.
{
"m": "d",
"d": {
"wagoID": "RzZVq4F1a",
"xOffset": 0,
"yOffset": 0,
"anchorPoint": "TOP",
"url": "https:\/\/wago.io\/RzZVq4F1a\/13",
"actions": {
"start": [],
"finish": [],
"init": {
"custom": "local MaxSpacing = aura_env.config.dotdistance\nlocal duration = aura_env.config.lifetime\nlocal ElementCap = aura_env.config.maxdots\nlocal onlyincombat = aura_env.config.combatoption\nlocal cursorLayer = aura_env.config.cursorlayer\nlocal rainbowx = aura_env.config.changeWithTime\nlocal colourspeed = aura_env.config.colourspeed\n\nlocal LastX, LastY = GetCursorPosition()\nlocal colour1 = aura_env.config.colour1\nlocal colour2 = aura_env.config.colour2\nlocal colour3 = aura_env.config.colour3\nlocal colour4 = aura_env.config.colour4\nlocal colour5 = aura_env.config.colour5\nlocal colour6 = aura_env.config.colour6\nlocal colour7 = aura_env.config.colour7\nlocal colour8 = aura_env.config.colour8\nlocal colour9 = aura_env.config.colour9\nlocal colour10 = aura_env.config.colour10\n\n\n\n\nlocal blendmode\nif aura_env.config.blendmode == 1 then\n blendmode = \"ADD\"\nelseif aura_env.config.blendmode == 2 then\n blendmode = \"DISABLE\"\nend\n\nif not aura_env.startTime then\n aura_env.startTime = GetTime()\nend\n\nlocal cursorLayer\nif aura_env.config.cursorlayer == 1 then\n cursorLayer = \"TOOLTIP\"\nelseif aura_env.config.cursorlayer == 2 then\n cursorLayer = \"BACKGROUND\"\nend\n\nlocal numPhases = aura_env.config.phasecount\nlocal phaseColors = {\n colour1,\n colour2,\n colour3,\n colour4,\n colour5,\n colour6,\n colour7,\n colour8,\n colour9,\n colour10\n}\n\n\nlocal function TimeBasedTransitionColor(startTime)\n local elapsedTime = GetTime() - startTime\n local cycleDuration = colourspeed\n local phaseDuration = cycleDuration \/ numPhases\n local phaseProgress = (elapsedTime % cycleDuration) \/ phaseDuration\n local currentPhase = math.floor(phaseProgress)\n local nextPhase = (currentPhase + 1) % numPhases\n local phaseFraction = phaseProgress - currentPhase\n \n currentPhase = (currentPhase % numPhases) + 1\n nextPhase = (nextPhase % numPhases) + 1\n \n -- Reverse the phase order\n local r1, g1, b1 = unpack(phaseColors[nextPhase])\n local r2, g2, b2 = unpack(phaseColors[currentPhase])\n local r = r2 + (r1 - r2) * phaseFraction\n local g = g2 + (g1 - g2) * phaseFraction\n local b = b2 + (b1 - b2) * phaseFraction\n \n return r, g, b\nend\nlocal function TransitionColor(remainingDuration, totalDuration)\n local phaseProgress = (1 - remainingDuration \/ totalDuration) * numPhases\n local currentPhase = math.min(math.floor(phaseProgress), numPhases - 1)\n local nextPhase = math.min(currentPhase + 1, numPhases - 1)\n local phaseFraction = phaseProgress - currentPhase\n local r1, g1, b1 = unpack(phaseColors[currentPhase + 1])\n local r2, g2, b2 = unpack(phaseColors[nextPhase + 1])\n local r = r1 + (r2 - r1) * phaseFraction\n local g = g1 + (g2 - g1) * phaseFraction\n local b = b1 + (b2 - b1) * phaseFraction\n \n return r, g, b\nend\n\n\n\n\n\nif not aura_env.elements then\n aura_env.elements = {}\n aura_env.elementsGenerated = {}\n local tooltipStrataFrame = CreateFrame(\"Frame\", nil, UIParent)\n tooltipStrataFrame:SetFrameStrata(cursorLayer)\n \n for i = 1, ElementCap do\n local element = tooltipStrataFrame:CreateTexture(nil, \"OVERLAY\")\n element:Hide()\n aura_env.elements[i] = element\n end\nend\n\n-- Trail function\naura_env.Trail = function(self)\n \n if WeakAuras.IsOptionsOpen() then return end\n \n local elapsed = self.present and GetTime() - self.present or 0\n self.present = GetTime()\n \n local isInCombat = UnitAffectingCombat(\"player\")\n if (onlyincombat and isInCombat) or not onlyincombat then\n local PresentCursorX, PresentCursorY = GetCursorPosition()\n local Scale = UIParent:GetEffectiveScale()\n PresentCursorX, PresentCursorY = PresentCursorX \/ Scale, PresentCursorY \/ Scale\n \n local xDiff = PresentCursorX - LastX\n local yDiff = PresentCursorY - LastY\n local distance = math.sqrt(xDiff * xDiff + yDiff * yDiff)\n local referenceAuraRegion = WeakAuras.GetRegion(aura_env.id)\n if not referenceAuraRegion then \n return \n end\n \n local refTexture = referenceAuraRegion.texture:GetTexture()\n \n if distance >= MaxSpacing then\n local steps = math.floor(distance \/ MaxSpacing)\n for i = 1, steps do\n if #aura_env.elements > 0 then\n local ratio = i \/ steps\n local elementX = LastX + xDiff * ratio\n local elementY = LastY + yDiff * ratio\n \n local element = table.remove(aura_env.elements)\n aura_env.elementsGenerated[#aura_env.elementsGenerated + 1] = element\n \n element.duration = duration\n element:SetTexture(refTexture)\n \n element:SetSize(Scale, Scale)\n element:SetBlendMode(blendmode)\n element:SetPoint(\"CENTER\", UIParent, \"BOTTOMLEFT\", elementX, elementY)\n element:Show()\n end\n end\n LastX, LastY = PresentCursorX, PresentCursorY\n end\n end\n for i, element in ipairs(aura_env.elementsGenerated) do\n element.duration = element.duration - elapsed\n if element.duration < 0.05 then\n element:Hide()\n aura_env.elements[#aura_env.elements + 1] = table.remove(aura_env.elementsGenerated, i)\n else\n local ElementScale = math.max(0.1, element.duration \/ duration)\n local alpha = aura_env.config.Alphax * (element.duration \/ duration)\n element:SetSize(aura_env.config.widthx * ElementScale, aura_env.config.heightx * ElementScale)\n element:SetAlpha(alpha)\n \n if rainbowx then \n local r, g, b = TimeBasedTransitionColor(1 - element.duration)\n element:SetVertexColor(r, g, b, alpha)\n end\n if not rainbowx then \n local r, g, b = TransitionColor(element.duration, duration)\n element:SetVertexColor(r, g, b, alpha)\n end\n end\n end\nend",
"do_custom": true
}
},
"triggers": {
"1": {
"trigger": {
"type": "custom",
"subeventSuffix": "_CAST_START",
"event": "Health",
"unit": "player",
"custom_type": "stateupdate",
"spellIds": [],
"names": [],
"check": "update",
"subeventPrefix": "SPELL",
"custom": "function(...)\n \n aura_env:Trail()\n return true\nend",
"debuffType": "HELPFUL"
},
"untrigger": []
},
"disjunctive": "any",
"customTriggerLogic": "function(t) \n return aura_env.config.ShowTrail == true and (t[1] and t[2])\nend\n",
"activeTriggerMode": -10
},
"internalVersion": 70,
"selfPoint": "BOTTOM",
"desaturate": false,
"discrete_rotation": 0,
"version": 13,
"subRegions": [
{
"type": "subbackground"
}
],
"height": 50,
"rotate": false,
"load": {
"use_never": false,
"talent": {
"multi": []
},
"size": {
"multi": []
},
"class": {
"multi": []
},
"spec": {
"multi": []
},
"zoneIds": ""
},
"textureWrapMode": "CLAMP",
"source": "import",
"mirror": false,
"regionType": "texture",
"blendMode": "ADD",
"texture": "Interface\\AddOns\\WeakAuras\\Media\\Textures\\Circle_Smooth2.tga",
"animation": {
"start": {
"colorR": 1,
"duration": "1000",
"alphaType": "custom",
"colorA": 1,
"colorG": 1,
"alphaFunc": "function(progress, start, delta)\n \n --[[if aura_env.config[\"HideOnRightClick\"] then\n if IsMouseButtonDown(\"RightButton\") then\n aura_env.region:Color(255,255,255,0)\n return 0\n else\n aura_env.region:Color(255,255,255,255)\n return 1\n end\n end\n]]--\n \n if aura_env.config[\"ShowOnKeyPress\"] then\n \n if aura_env.config[\"KeyOption\"] == 1 then\n if IsLeftAltKeyDown() then\n aura_env.region:Color(255,255,255,1)\n return 1\n else\n aura_env.region:Color(255,255,255,0)\n return 0\n end\n elseif aura_env.config[\"KeyOption\"] == 2 then\n if IsLeftShiftKeyDown() then\n aura_env.region:Color(255,255,255,1)\n return 1\n else\n aura_env.region:Color(255,255,255,0)\n return 0\n end\n else\n if IsLeftControlKeyDown() then\n aura_env.region:Color(255,255,255,1)\n return 1\n else\n aura_env.region:Color(255,255,255,0)\n return 0\n end\n end\n \n end\n \n \nend\n\n\n",
"use_alpha": true,
"type": "none",
"easeType": "none",
"preset": "fade",
"alpha": 0,
"y": 0,
"x": 0,
"duration_type": "seconds",
"colorB": 1,
"rotate": 0,
"easeStrength": 3,
"scaley": 1,
"scalex": 1
},
"main": {
"type": "none",
"easeType": "none",
"easeStrength": 3,
"duration_type": "seconds",
"preset": "pulse"
},
"finish": {
"type": "none",
"easeType": "none",
"easeStrength": 3,
"duration_type": "seconds",
"preset": "fade"
}
},
"semver": "1.0.12",
"tocversion": 30300,
"id": "Multicolored Mouse Trail",
"authorOptions": [
{
"type": "range",
"useDesc": false,
"max": 10,
"step": 1,
"width": 1,
"min": 1,
"key": "phasecount",
"default": 8,
"name": "Nr. of colours"
},
{
"type": "color",
"key": "colour1",
"default": [
0,
0.11373,
1,
1
],
"name": "1 - colour",
"useDesc": false,
"width": 2
},
{
"type": "color",
"key": "colour2",
"default": [
0,
0.32941,
0.34118,
1
],
"name": "2 - colour",
"useDesc": false,
"width": 2
},
{
"type": "color",
"key": "colour3",
"default": [
0.10196,
0,
1,
1
],
"name": "3 - colour",
"useDesc": false,
"width": 2
},
{
"type": "color",
"key": "colour4",
"default": [
0.30588,
0.19608,
0.28627,
1
],
"name": "4 - colour",
"useDesc": false,
"width": 2
},
{
"type": "color",
"key": "colour5",
"default": [
1,
0.61176,
0,
1
],
"name": "5 - colour",
"useDesc": false,
"width": 2
},
{
"type": "color",
"key": "colour6",
"default": [
1,
0.15686,
0,
1
],
"name": "6 - colour",
"useDesc": false,
"width": 2
},
{
"type": "color",
"key": "colour7",
"default": [
1,
0.10196,
0,
1
],
"name": "7 - colour",
"useDesc": false,
"width": 2
},
{
"type": "color",
"key": "colour8",
"default": [
1,
0.035294,
0,
1
],
"name": "8 - colour",
"useDesc": false,
"width": 2
},
{
"type": "color",
"key": "colour9",
"default": [
0,
0,
0,
1
],
"name": "9 - colour",
"useDesc": false,
"width": 2
},
{
"type": "color",
"key": "colour10",
"default": [
0,
0,
0,
1
],
"name": "10 - colour",
"useDesc": false,
"width": 2
},
{
"text": "\n",
"type": "description",
"fontSize": "medium",
"width": 2
},
{
"text": "\nDynamic color flow in time:\n",
"type": "description",
"fontSize": "large",
"width": 2
},
{
"type": "toggle",
"default": false,
"width": 2,
"name": "Colour flow",
"useDesc": true,
"key": "changeWithTime",
"desc": "When enabled the colours change in time, when disabled the colours are static."
},
{
"type": "range",
"useDesc": false,
"max": 10,
"step": 0.1,
"width": 2,
"min": 0.1,
"key": "colourspeed",
"default": 0.6,
"name": "Colour flow speed",
"desc": "When enabled the colours change in time, when disabled the colours are static."
},
{
"type": "range",
"useDesc": false,
"max": 400,
"step": 5,
"width": 1,
"min": 0,
"key": "widthx",
"default": 60,
"name": "Width"
},
{
"type": "range",
"useDesc": false,
"max": 400,
"step": 5,
"width": 1,
"min": 0,
"key": "heightx",
"default": 60,
"name": "Height"
},
{
"text": "\n",
"type": "description",
"fontSize": "medium",
"width": 2
},
{
"type": "toggle",
"key": "combatoption",
"default": false,
"name": "Display only in combat",
"useDesc": false,
"width": 2
},
{
"type": "select",
"values": [
"\"TOOLTIP\"",
"\"BACKGROUND\""
],
"default": 1,
"name": "Display layer",
"useDesc": false,
"key": "cursorlayer",
"width": 2
},
{
"type": "select",
"values": [
"\"GLOW\"",
"\"OPAQUE\""
],
"default": 1,
"name": "Blend mode",
"useDesc": false,
"key": "blendmode",
"width": 2
},
{
"type": "range",
"useDesc": false,
"max": 1,
"step": 0.1,
"width": 2,
"min": 0.1,
"key": "Alphax",
"default": 1,
"name": "Alpha"
},
{
"text": "\n\nWarrning! the longer the dots live and the more dots are on screen the more FPS they consume!\n\n\n",
"type": "description",
"fontSize": "large",
"width": 2
},
{
"text": "If the trail breaks that means it lives for too long and there are too few dots. Play with the values.",
"type": "description",
"fontSize": "medium",
"width": 2
},
{
"type": "range",
"useDesc": false,
"max": 1,
"step": 0.05,
"width": 1,
"min": 0.05,
"key": "lifetime",
"default": 0.25,
"name": "Lifetime of a dot."
},
{
"type": "range",
"useDesc": false,
"max": 4000,
"step": 100,
"width": 1,
"min": 200,
"key": "maxdots",
"default": 800,
"name": "Max dots on screen."
},
{
"type": "range",
"useDesc": false,
"max": 5,
"step": 1,
"width": 2,
"min": 1,
"key": "dotdistance",
"default": 2,
"name": "Distance between dots - HUGE FPS and trail brightness inpact"
}
],
"frameStrata": 1,
"anchorFrameType": "SCREEN",
"color": [
0.94902,
0.93725,
1,
1
],
"uid": ")05NV1DpzHk",
"width": 50,
"rotation": 0,
"config": {
"changeWithTime": false,
"maxdots": 800,
"blendmode": 1,
"widthx": 60,
"colour6": [
1,
0.15686,
0,
1
],
"lifetime": 0.25,
"Alphax": 1,
"dotdistance": 2,
"colour2": [
0,
0.32941,
0.34118,
1
],
"colour10": [
0,
0,
0,
1
],
"colourspeed": 0.6,
"combatoption": false,
"colour3": [
0.10196,
0,
1,
1
],
"cursorlayer": 1,
"colour7": [
1,
0.10196,
0,
1
],
"colour8": [
1,
0.035294,
0,
1
],
"colour9": [
0,
0,
0,
1
],
"colour5": [
1,
0.61176,
0,
1
],
"heightx": 60,
"colour4": [
0.30588,
0.19608,
0.28627,
1
],
"colour1": [
0,
0.11373,
1,
1
],
"phasecount": 8
},
"conditions": [],
"information": {
"forceEvents": false,
"ignoreOptionsEventErrors": false
},
"alpha": 0.1
},
"s": "4.2.5",
"v": 1421
}