Here is a beta scaling, that bounces back to its original size.
Code:
RDX.RegisterFeature({
name = "animation_scale"; version = 1;
title = i18n("Animation: Scale"); category = i18n("Animations");
multiple = true;
IsPossible = function(state)
if not state:Slot("UnitFrame") then return nil; end
if not state:Slot("Base") then return nil; end
return true;
end;
ExposeFeature = function(desc, state, errs)
if not desc then VFL.AddError(errs, i18n("No Descriptor.")); return nil; end
if not (desc.owner) or (not state:Slot("Tex_" .. desc.owner)) then
VFL.AddError(errs, i18n("Invalid texture")); return nil;
end
return true;
end;
ApplyFeature = function(desc, state)
local fname = "frame.Tex_" .. desc.owner;
local createCode =
fname .. [[_animation = ]] .. fname .. [[:CreateAnimationGroup();
]] .. fname .. [[_animation:SetLooping("BOUNCE");
]] .. fname .. [[_rotation = ]] .. fname .. [[_animation:CreateAnimation("SCALE");
]] .. fname .. [[_rotation:SetScale(]] .. desc.xscale .. [[, ]] .. desc.yscale .. [[);
]] .. fname .. [[_rotation:SetDuration(]] .. desc.duration .. [[);
]] .. fname .. [[_rotation:SetOrigin(']] .. desc.origin .. [[', 0, 0);
]] .. fname .. [[_animation:Play();
]];
local paintCode = [[
if not ]] .. fname .. [[_animation:IsPlaying() then ]] .. fname .. [[_animation:Play(); else return; end
]];
state:Attach(state:Slot("EmitPaint"), true, function(code) code:AppendCode(paintCode); end);
state:Attach(state:Slot("EmitCreate"), true, function(code) code:AppendCode(createCode); end);
end;
UIFromDescriptor = function(desc, parent, state)
local ui = VFLUI.CompoundFrame:new(parent);
local owner = RDXUI.MakeSlotSelectorDropdown(ui, i18n("Target texture"), state, "Tex_", nil);
if desc and desc.owner then owner:SetSelection(desc.owner); end
local duration = VFLUI.LabeledEdit:new(ui, 50);
duration:SetText(i18n("Duration"));
duration:Show();
if desc and desc.duration then duration.editBox:SetText(desc.duration); end
ui:InsertFrame(duration);
local xscale = VFLUI.LabeledEdit:new(ui, 50);
xscale:SetText(i18n("X Scale"));
xscale:Show();
if desc and desc.xscale then xscale.editBox:SetText(desc.xscale); end
ui:InsertFrame(xscale);
local yscale = VFLUI.LabeledEdit:new(ui, 50);
yscale:SetText(i18n("Y Scale"));
yscale:Show();
if desc and desc.yscale then yscale.editBox:SetText(desc.yscale); end
ui:InsertFrame(yscale);
--Origin
local er = RDXUI.EmbedRight(ui, i18n("Origin"));
local origin = VFLUI.Dropdown:new(er, RDXUI.AnchorPointSelectionFunc);
origin:SetWidth(100); origin:Show(); origin:SetSelection("CENTER");
if desc and desc.origin then origin:SetSelection(desc.origin); end
er:EmbedChild(origin); er:Show();
ui:InsertFrame(er);
--local edy = VFLUI.LabeledEdit:new(ctr, 75); edy:SetText(i18n("Offset X/Y:")); edy:Show();
--local edx = VFLUI.Edit:new(edy); edx:Show();
--edx:SetHeight(24); edx:SetWidth(75); edx:SetPoint("RIGHT", edy.editBox, "LEFT");
--edy.Destroy = VFL.hook(function() edx:Destroy(); end, edy.Destroy);
--ui:InsertFrame(edy);
function ui:GetDescriptor()
return {
feature = "animation_scale"; version = 1;
name = "Scale";
owner = owner:GetSelection();
duration = duration.editBox:GetText();
xscale = xscale.editBox:GetText();
yscale = yscale.editBox:GetText();
origin = origin:GetSelection();
};
end
return ui;
end;
CreateDescriptor = function()
return {
feature = "animation_scale", version = 1,
name = "Scale", owner = "Base", duration = 10, xscale = 1, yscale = 1,
origin = "CENTER",
};
end;
});
This has the same issue with moving unit frames as the rotation code I posted above.