diff --git a/Iceshrimp.Frontend/Components/MfmText.razor.css b/Iceshrimp.Frontend/Components/MfmText.razor.css index 6a4439cf..040535d1 100644 --- a/Iceshrimp.Frontend/Components/MfmText.razor.css +++ b/Iceshrimp.Frontend/Components/MfmText.razor.css @@ -171,14 +171,13 @@ } ::deep { - .fn-jelly { + .fn-animation { display: inline-block; animation-delay: 0s; animation-duration: 1s; animation-fill-mode: both; animation-iteration-count: infinite; animation-timing-function: linear; - animation-name: fn-jelly; } } diff --git a/Iceshrimp.Frontend/Core/Miscellaneous/RenderMfm.cs b/Iceshrimp.Frontend/Core/Miscellaneous/RenderMfm.cs index 3368327c..34d60eb8 100644 --- a/Iceshrimp.Frontend/Core/Miscellaneous/RenderMfm.cs +++ b/Iceshrimp.Frontend/Core/Miscellaneous/RenderMfm.cs @@ -260,7 +260,7 @@ public static partial class MfmRenderer "x3" => MfmFnX(node.Name, document), "x4" => MfmFnX(node.Name, document), "blur" => MfmFnBlur(document), - "jelly" => MfmFnJelly(args, document), + "jelly" => MfmFnAnimation(node.Name, args, document), "tada" => throw new NotImplementedException($"{node.Name}"), "jump" => throw new NotImplementedException($"{node.Name}"), "bounce" => throw new NotImplementedException($"{node.Name}"), @@ -331,19 +331,18 @@ public static partial class MfmRenderer return el; } - private static INode MfmFnJelly(Dictionary args, IDocument document) + private static INode MfmFnAnimation(string name, Dictionary args, IDocument document) { var el = document.CreateElement("span"); - el.ClassName = "fn-jelly"; + el.ClassName = "fn-animation"; - var style = ""; - style += args.TryGetValue("speed", out var speed) ? $"animation-duration: {speed}; " : ""; - style += args.TryGetValue("delay", out var delay) ? $"animation-delay: {delay}; " : ""; - style += args.TryGetValue("loop", out var loop) ? $"animation-iteration-count: {loop}; " : ""; + var style = $"animation-name: fn-{name}-mfm;"; + style += args.TryGetValue("speed", out var speed) ? $" animation-duration: {speed};" : ""; + style += args.TryGetValue("delay", out var delay) ? $" animation-delay: {delay};" : ""; + style += args.TryGetValue("loop", out var loop) ? $" animation-iteration-count: {loop};" : ""; - if (!string.IsNullOrWhiteSpace(style)) - el.SetAttribute("style", style.Trim()); + el.SetAttribute("style", style.Trim()); return el; }