the surrounding stuff for my next set with livecode.nyc
It basically just prints emoji for a vim buffer but with more livecode
gwen fc28fe01e4 Update 'README.md' | 1 rok temu | |
---|---|---|
constellations @ 95eb6b2345 | 1 rok temu | |
examples | 1 rok temu | |
plugin | 1 rok temu | |
.gitignore | 3 lat temu | |
.gitmodules | 1 rok temu | |
LICENSE | 3 lat temu | |
README.md | 1 rok temu | |
frame.lua | 1 rok temu | |
main.lua | 1 rok temu | |
ustring.lua | 3 lat temu |
Its a livecode framework for spewing emoji into vim buffers a 60fps. surprisingly satisfying visuals ensue.
git clone https://mygit.link/gwen/polonium.git --recursive
polonium/examples
directorynvim -c "so ../plugin/plugin.vim" example.po.lua
:Polonium
:w
you can install this with a plugin manage now!! I use packer like this:
use('wbthomason/packer.nvim')
you should still be able to source the file the old way!
:so plugin.vim
then you can use this command to start it:
:Polonium
So all together
$ cd polonium
$ nvim example.po.lua
# if you are not using a plugin manager
:so plugin.vim
:Polonium
:w
These are the vim commands you can run once the plugin is running
Starts the show!
Inserts a blank polonium function for oyu to start framework
Re-open the code window if you :q
by accident
makes a frame and sets every character to whatever is in fill (default characteris 🖤)
local f = require('frame').create(30,60, '🌿')
serializes a frame to a flat utf8 string with newlines. basically you use this to pass the frame out of your main function
return function(time, frameNumber)
local frame = require('frame').create(35, 35)
return frame:toString()
end
There is one other maybe useful trick in that you can make a small frame then use it as a stamp in a bigger frame.
local stamp = require('frame').create(5, 5, '💵')
stamp:set(1,1,'🔥')
stamp:set(2,2,'🔥')
stamp:set(3,3,'🔥')
local frame = require('frame').create(35, 35)
frame:set(10,10,stamp:toString())
used to blank out a frame.
frame:clear(' ')
sets a single character or applies a stamp to the supplied XY position
frame:set(2,2,'💗')
frame:set(3,3,[[
🆓🆒🆕
🆒🆕🆓
🆕🆓🆒]])
return the current value
local currentVal = frame:get(2,2)
⚠I basically havent tested this at all so 💁♀️ It should apply a "lookup table" where in you give it a table and each key is replaced with it's value
local tbl = {}
tbl['🅰] = '🅱
frame:lut(tbl) -- all the 🅰 will become 🅱
calls the callback once for each slot in the frame. Mostly just saves you from writing a bunch of double-fors
the callback should have the signature function(oldCharacter, x, y, xPercent, yPercent)
frame:forEach(function(oldCharacter, x, y, xPercent, yPercent)
return '🆙' -- will set the character ar X,Y to 🆙
end)
run a marquee like the old HTML tag 😎 not that the argument is a table with named things
frame{
time = time, -- should be the number of seconds since an epoch, but you ncan do fun stuff by patching a sine or something from the constellations beat library into it
text = 'hello ',
position = 4, -- the row to apply the marquee
}
Constelations is my go-everywhere lua library. I dont have a ton of docs right now but you can look at comments in the files