digital literacy for everyone


[lit]

[generate-title]

[lit] fig is a multi-purpose educational language-- originally designed to offer 16 colours in the term window or vt, with a compatible 16-colour palette in a graphics window. in 2017, i decided that rather than extend the language, a simple function (rgbcolour) would allow 24-bit colour without any change to the language itself. floral is one of the earlier programs that use this function. [img]https://ia801509.us.archive.org/29/items/fig_screencaps/floral.fig.png[img] [fig] #### license: creative commons cc0 1.0 (public domain) #### http://creativecommons.org/publicdomain/zero/1.0/ proginf "floral 2017 mn" function rgbcolour r g b c python figcgapal[c] = (r, g, b) fig fig function qline c d e f g ## draw 4 lines, points go 2x2 ## (cheap but avoids gaps) now line c d e f g d2 d plus 1 f2 f plus 1 now line c d2 e f2 g c2 c plus 1 e2 e plus 1 now line c2 d2 e2 f2 g now line c2 d e2 f g fig while rf randint 35 105 ## radius sf rf divby 2 int ## range of radius change xmin rf plus sf xmax xmin times -1 plus 800 ymin rf plus sf ymax ymin times -1 plus 600 pc randint 5 15 ## petal count xc randint xmin xmax ## horiz location yc randint ymin ymax ## vert location while cr randint 32 248 cg randint 32 248 cb randint 32 248 #fewer greens and dingy colors greenish cr plus cb minus cg times -1 ifless greenish 0 ifmore cr 160 break fig ifmore cg 160 break fig ifmore cb 160 break fig fig wend now display for p -3.14159 3.14159 0.00076698974609375 # 3.14159 / 2**12 r p times pc sin times sf plus rf plus 7 x p cos times r plus xc int y p sin times r plus yc int now line x y xc yc 15 next for p -3.14159 3.14159 0.00076698974609375 # 3.14159 / 2**12 r p times pc sin times sf plus rf x p cos times r plus xc int y p sin times r plus yc int now rgbcolour cr cg cb 14 qline x y xc yc 14 next now display wend now lineinput
fig main page: [url]https://codeinfig.neocities.org/fig/index.html[url] home: [lit]https://codeinfig.neocities.org[lit]