gsl-shell.git - gsl-shell

index : gsl-shell.git
gsl-shell
summary refs log tree commit diff
path: root/examples/graphics.lua
diff options
context:
space:
mode:
Diffstat (limited to 'examples/graphics.lua')
-rw-r--r--examples/graphics.lua 24
1 files changed, 24 insertions, 0 deletions
diff --git a/examples/graphics.lua b/examples/graphics.lua
index 4316d9c0..f813858f 100644
--- a/examples/graphics.lua
+++ b/examples/graphics.lua
@@ -85,5 +85,29 @@ function demo2()
return p
end
+function demo3()
+ local n = 24
+ local color = {'red', 'yellow', 'blue', 'darkgreen', 'cyan'}
+ local p = window('black')
+ local txt = text()
+ txt.text = 'Hello world!'
+
+ p:setview(-1, -1, 1, 1)
+
+ local N = 128
+ for j=0, N do
+ local th = 2*pi*j/N
+ txt.angle = th
+ p:clear()
+ for k=0, n-1 do
+ local a = 2*pi*k/n - pi/2
+ local ch = |t| t[(k % #t)+1]
+ p:draw(txt, ch(color), {{'translate', x = 100*cos(a), y= 100*sin(a)}})
+ end
+ p:refresh()
+ end
+ return p
+end
+
p1 = demo1()
p2 = demo2()
generated by cgit v1.2.3 (git 2.39.1) at 2025年09月15日 23:16:28 +0000

AltStyle によって変換されたページ (->オリジナル) /