Author Topic: Random Curly Hair  (Read 2643 times)

0 Members and 1 Guest are viewing this topic.

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Random Curly Hair
« on: August 02, 2020, 07:30:29 pm »
This little app draws a cartoon figure and randomly makes random hair on his or her head. Press Space Bar to randomly make a different hair style. lol Sometimes it's "The New Wave", sometimes it's a giant fuzzy Afro, sometimes it's just a bunch of long curly hair. :) The amount it chooses from is over 6000 but most of them practically the same. The hair color stays the same but if you want to change it, go right ahead. Or anything else of course. You can tell right off that I was playing with math graphics again. :)

Code: QB64: [Select]
  1. _LIMIT 100
  2. SCREEN _NEWIMAGE(800, 600, 32)
  3. _TITLE "Press Space Bar for random curly hair."
  4. start:
  5. 'Head
  6. CIRCLE (410, 350), 130, _RGB32(249, 155, 127)
  7. PAINT (410, 350), _RGB32(249, 155, 127)
  8.  
  9. 'Left Eye
  10. 'white
  11. CIRCLE (360, 300), 22, _RGB32(255, 255, 255), , , .75
  12. PAINT (360, 300), _RGB32(255, 255, 255)
  13. 'blue
  14. FOR sz = 7 TO 12 STEP .25
  15.     CIRCLE (360, 300), sz, _RGB32(0, 177, 255), , , .75
  16. NEXT sz
  17. 'pupil
  18. PAINT (360, 300), _RGB32(0, 0, 0), _RGB32(0, 177, 255)
  19.  
  20. 'Right Eye
  21. 'white
  22. CIRCLE (460, 300), 22, _RGB32(255, 255, 255), , , .75
  23. PAINT (460, 300), _RGB32(255, 255, 255)
  24. 'blue
  25. FOR sz = 7 TO 12 STEP .25
  26.     CIRCLE (460, 300), sz, _RGB32(0, 177, 255), , , .75
  27. NEXT sz
  28. 'pupil
  29. PAINT (460, 300), _RGB32(0, 0, 0), _RGB32(0, 177, 255)
  30.  
  31. 'Nose
  32. FOR sz = .25 TO 22 STEP .25
  33.     CIRCLE (410, 345), sz, _RGB(230, 140, 100), , , 1.5
  34. NEXT sz
  35.  
  36. 'Mouth
  37. FOR l = .25 TO 10 STEP .25
  38.     CIRCLE (410, 360 + l), 80, _RGB32(255, 94, 127), _PI, 2 * _PI, .75
  39.  
  40. 'Neck
  41. LINE (360, 460)-(460, 520), _RGB32(249, 155, 127), BF
  42. 'Body
  43. CIRCLE (410, 800), 300, _RGB32(127, 255, 128)
  44. PAINT (410, 550), _RGB32(127, 255, 128)
  45.  
  46. 'Hair
  47. hair:
  48. h = RND(30) + 1
  49. h2 = -RND(1) / 5
  50. fuzzy = (RND * 300) + 100
  51. FOR a = 1 TO 400 STEP 20
  52.     _LIMIT 50
  53.     seconds = seconds + 1
  54.     sec = (60 - seconds) * 6 + 240
  55.     xx = INT(SIN(sec / 180 * 3.141592) * 180) + 400
  56.     yy = INT(COS(sec / 180 * 3.141592) * 180) + 300
  57.     s = sec
  58.     FOR d = 100 TO 0 STEP h2
  59.         'step was originally -.125
  60.         s = s + h
  61.         'h was originally Pi
  62.         x = COS(s * 3.141592 / fuzzy) * d
  63.         y = SIN(s * 3.151492 / fuzzy) * d
  64.         x2 = x + xx: y2 = y + yy
  65.         FOR sz = .25 TO 1 STEP .25
  66.             CIRCLE (x2 + 3, y2 + 50 + h - (h2 * 10)), sz, _RGB32(127, 127, 0)
  67.         NEXT sz
  68.     NEXT d
  69. seconds = 0
  70. GOTO start:
  71.  
Curly Hair Random Program by Ken.jpg
* Curly Hair Random Program by Ken.jpg (Filesize: 126.07 KB, Dimensions: 801x628, Views: 202)
Curly Hair Random Program by Ken 5.jpg
* Curly Hair Random Program by Ken 5.jpg (Filesize: 139.63 KB, Dimensions: 804x627, Views: 212)
Curly Hair Random Program by Ken 3.jpg
* Curly Hair Random Program by Ken 3.jpg (Filesize: 137.47 KB, Dimensions: 802x625, Views: 218)
« Last Edit: August 02, 2020, 07:48:31 pm by SierraKen »