Skip to content

Instantly share code, notes, and snippets.

@hamoid
Created October 23, 2017 14:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hamoid/4e7db65411a22881401ae0987582b45e to your computer and use it in GitHub Desktop.
Save hamoid/4e7db65411a22881401ae0987582b45e to your computer and use it in GitHub Desktop.
Generative spreadsheet for LibreOffice
REM ***** BASIC *****
Sub Main
Dim Doc As Object
Dim Sheet As Object
Dim Cell As Object
Dim s As String
Doc = ThisComponent
Sheet = Doc.Sheets(0)
baseR = 6.28 * Rnd
baseG = 6.28 * Rnd
baseB = 6.28 * Rnd
k0 = Rnd
k1 = Rnd
k2 = Rnd
k3 = Rnd
FOR x = 0 TO 8
FOR y = 0 TO 23
Cell = Sheet.getCellByPosition(x, y)
r = 128+127*Sin(baseR + y*k0+x*k1)
g = 80+79*Sin(baseG + y*k2)
b = 100+99*Sin(baseB + x*k3)
Cell.CellBackColor = RGB( r, g, b)
h = 1 + Rnd*Rnd*39
l = 1 + Int(50 / h)
s = ""
FOR t = 0 TO l
s = s & Mid(" ¯.°·¸´¨0123456789═╔╗╚╝╠╣╦╩╬█░▒▓", 1+Int(r/10+Rnd*6), 1)
NEXT t
Cell.String = s
Cell.CharHeight = h
Cell.CharColor = RGB(255-r, 255-g, 255-b)
NEXT y
NEXT x
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment