Author Topic: Flower  (Read 1131 times)

0 Members and 1 Guest are viewing this topic.

Offline SierraKen

  • Forum Resident
  • Posts: 1454
Flower
« on: March 20, 2022, 08:06:58 pm »
I made my first rose today for the First Day of Spring. I posted the picture of it below.

Code: QB64: [Select]
  1. Screen _NewImage(800, 600, 32)
  2. _Title "Happy First Day Of Spring!"
  3.  
  4. Paint (1, 1), _RGB32(128, 255, 255)
  5. For sz = .1 To 600 Step .1
  6.     Circle (400, 900), sz, _RGB32(127, 255, 127)
  7. Next sz
  8.  
  9. Line (398, 300)-(402, 250), _RGB32(127, 255, 0), BF
  10.  
  11. For sz2 = -5 To 5 Step .5
  12.     Circle (400 - sz2, 150 + sz2), sz2 + 100, _RGB32(255, 0, 0), _Pi, (3 * _Pi) / 2
  13.     Circle (300 + sz2, 250 - sz2), sz2 + 100, _RGB32(255, 0, 0), (2 * _Pi), _Pi / 2
  14. Next sz2
  15.  
  16. For sz3 = -5 To 5 Step .5
  17.     Circle (400 + sz3, 150 + sz3), sz3 + 100, _RGB32(255, 0, 0), (3 * _Pi) / 2, 2 * _Pi
  18.     Circle (500 - sz3, 250 - sz3), sz3 + 100, _RGB32(255, 0, 0), (_Pi / 2), _Pi
  19. Next sz3
  20.  
  21. Line (399, 200)-(401, 150), _RGB32(127, 255, 127), BF
  22. For sz4 = .1 To 5 Step .1
  23.     Circle (400, 145), sz4, _RGB32(255, 255, 127)
  24. Next sz4
  25.  
  26. Paint (375, 225), _RGB32(255, 0, 1), _RGB32(255, 0, 0)
  27. Paint (425, 225), _RGB32(255, 0, 1), _RGB32(255, 0, 0)
  28.  
  29.  
Happy First Day Of Spring - By Ken.jpg
* Happy First Day Of Spring - By Ken.jpg (Filesize: 54.13 KB, Dimensions: 801x623, Views: 54)
« Last Edit: March 20, 2022, 08:21:06 pm by SierraKen »

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
Re: Flower
« Reply #1 on: March 20, 2022, 08:52:24 pm »
Makes me think we need a new QB64 keyword...

_ROUNDUP

Pete :D
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
Re: Flower
« Reply #2 on: March 20, 2022, 10:01:28 pm »
OK for spring!
Code: QB64: [Select]
  1. _Title "May Flowers" 'b+ trans 2022-03-20
  2. 'May flowers.bas SmallBASIC 2015-05-06 B+
  3. Const xmax = 800, ymax = 600
  4. Screen _NewImage(xmax, ymax, 32)
  5. _ScreenMove 200, 100
  6. sq = (ymax - 100) ^ 4
  7. For i = 0 To 100
  8.     Line (0, i)-(xmax, i), _RGB32(0, 0, 155 + i)
  9. For i = 100 To ymax
  10.     Line (0, i)-(xmax, i), _RGB32(0, 210 - .25 * i, 0)
  11. For i = 1 To 125
  12.     x = Rnd * xmax: s = Rnd * 8: y = 100 - s: cc = Rnd * 75: col~& = _RGB32(cc, cc, cc)
  13.     Line (x, y)-Step(s, s), col~&, BF
  14.     cc = Int(Rnd * 12) * 5 + 200
  15.     col~& = _RGB32(cc, cc, 0)
  16.     petals = (20 * Rnd) + 5
  17.     xoff = Rnd * xmax
  18.     yoff = ymax - (Rnd * sq) ^ .25
  19.     size = (yoff / 100) ^ 2
  20.     For theta = 0 To 2 * 3.14159 Step 0.001
  21.         r = Cos(petals * theta)
  22.         For fil = 0 To size
  23.             x = r * Cos(theta) * fil + xoff
  24.             y = r * Sin(theta) * fil + yoff
  25.             PSet (x, y), col~&
  26.         Next fil
  27.     Next theta
  28.     _Limit 20
  29.  
  30.  

How much Roundup does Pete have?

Offline SierraKen

  • Forum Resident
  • Posts: 1454
Re: Flower
« Reply #3 on: March 20, 2022, 10:05:31 pm »
LOL Thanks B+. My pollen allergies!!! LOL