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' 8 months ago
constellations @ 95eb6b2345 17bea080df Stuf from hex90 8 months ago
examples 17bea080df Stuf from hex90 8 months ago
plugin 05fac25e26 moved the sets into main.lua 1 year ago
.gitignore c4d71b5369 Initial commit 2 years ago
.gitmodules 89d3f78369 add submodule 1 year ago
LICENSE c4d71b5369 Initial commit 2 years ago
README.md fc28fe01e4 Update 'README.md' 8 months ago
frame.lua ec32e35fab fix the get in lut 1 year ago
main.lua 17bea080df Stuf from hex90 8 months ago
ustring.lua b187178454 got the stamp thingy working, its like most of the way to a livecode set now :) 2 years ago

README.md

Its a livecode framework for spewing emoji into vim buffers a 60fps. surprisingly satisfying visuals ensue.

Quick start

  1. clone the repo with git clone https://mygit.link/gwen/polonium.git --recursive
  2. navigate to the polonium/examples directory
  3. open an example file with the following command nvim -c "so ../plugin/plugin.vim" example.po.lua
  4. run :Polonium
  5. save the file :w
  6. start livecoding!

Setup

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

Commands

These are the vim commands you can run once the plugin is running

:Polonium

Starts the show!

:Poblank

Inserts a blank polonium function for oyu to start framework

:Powindow

Re-open the code window if you :q by accident

Frame Library

create(width, height, fill)

makes a frame and sets every character to whatever is in fill (default characteris 🖤)

local f = require('frame').create(30,60, '🌿')

toString()

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())

clear(fill)

used to blank out a frame.

frame:clear('  ')

set(x,y,str)

sets a single character or applies a stamp to the supplied XY position

frame:set(2,2,'💗')
frame:set(3,3,[[
🆓🆒🆕
🆒🆕🆓
🆕🆓🆒]])

get(x,y)

return the current value

local currentVal = frame:get(2,2)

lut(lookupTable)

⚠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 🅱

forEach(callback)

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)

marquee(optionsTable)

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

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