Skip to content

feat: more anime combinators #161

@j-hui

Description

@j-hui

Animations like the ones suggested in #132 should not need to be hard-coded into our spinner library, since they just involve translating a static string across an empty space. Such animation frames can easily be generated with something like this:

-- UNTESTED CODE btw
local function bouncer(icon, width)
  local frames = {}
  local padding = width - vim.fn.strdisplaywidth(icon)
  assert(padding > 0)
  for i=0, padding do
    table.insert(frames, string.format("%s%s%s", string.rep(" ", i), icon, string.rep(" ", width - i))
  end
  for i=1, padding do
    table.insert(frames, string.format("%s%s%s", string.rep(" ", width - i), icon, string.rep(" ", width))
  end
  return frames
end

This kind of thing can and should be added to spinner as a combinator so that users can roll their own anime

Other combinator ideas (resurrect HTML tags with vengeance):

  • <marquee>-style scrolling text
  • <blink>-style blinkers

Fidget could even support animated epic gamer highlights (though this will require supporting _style fields as functions):

  • "breathing" highlights that fade brighter and darker 😎
  • rainbow highlights 🌈

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions