Code to draw a leaf using Qbasic programming language.
# Code to Draw a leaf.
1. Screen 12
2. Color _RGB(Rnd * 255, Rnd * 255, Rnd * 255)
3. Dim As Single X, Y, xx, yy
4. Dim As Integer n, i
5. For i = 1 To 100000
6. n = Rnd * 100
7. If n < 1 Then
8. Xp = 0
9. Yp = .16 * Y
10. ElseIf n >= 1 And n <= 8 Then
11. Xp = .2 * X - .26 * Y
12. Yp = .23 * X + .22 * Y + 1.6
13. ElseIf n >= 8 And n <= 15 Then
14. Xp = -.15 * X + .28 * Y
15. Yp = .26 * X + .24 * Y + .44
16. Else
17. Xp = .85 * X + .04 * Y
18. Yp = -.04 * X + .85 * Y + 1.6
19. End If
20. X = Xp
21. Y = Yp
22. xx = X * 45
23. yy = Y * 45 - 225
24. PSet (xx + 320, -yy + 240)
25. Next i
Note : If you copy this code. Make sure remove numbers from first.
0 Comments