by Bogdan Soban (2 Submissions)
Category: Graphics
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Tue 11th January 2005
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Draw Mandala - 16 lines of code
Form1.Show: Randomize Timer: On Error Resume Next: Cls
n1 = 10 + Rnd * 20: n2 = 10 + Rnd * 20: n3 = 2 * Int(3 + Rnd * 10)
k1 = Int(100 + Rnd * 50): k2 = Int(100 + Rnd * 50): k3 = Int(100 + Rnd * 50)
b1 = Int(150 + Rnd * 80): b2 = Int(340 + Rnd * 80): b3 = Int(530 + Rnd * 80)
For i = 0 To 400: For j = 0 To 400
x = (i - 400 / 2) / (400 / 6): y = (400 / 2 - j) / (400 / 6)
r = Sqr(x * x + y * y): fi = Atn(y / x)
re = k1 * (1 + Sin(n1 * r)): gr = k2 * (1 + Cos(n2 * r))
bl = k3 * (1 + Sin(n3 * fi)): col = re + gr + bl
If col < b1 Then c = 0: GoTo draw
If col < b2 Then c = 85: GoTo draw
If col < b3 Then c = 190: GoTo draw
c = 255
draw: Form1.PSet (i, j), RGB(c, c, c): Next j: Next i
End Sub