|
Post by bplus on May 23, 2024 18:11:00 GMT -5
_Title "orbit demo make hairy wreath " 'b+ 2024-05-11 Const Xmax = 700, Ymax = 700 Screen _NewImage(Xmax, Ymax, 32) _ScreenMove 290, 20 Randomize Timer x = _Width / 2: y = _Height / 2 ' start in center of screen pentAngle = 72 ' the angles inside a pentagram are 360 / 5 = 72 degrees forward = 10 angle = -36 stepper = 1 r = Rnd * Rnd: g = Rnd * Rnd: b = Rnd * Rnd: dc = 0 Do Until _KeyDown(27) orbit _Width / 2, _Height / 2, Rnd * 360, 200, x, y loops = loops + 1 Locate 1, 1: Print loops If loops = 10 Then Cls: loops = 0: r = Rnd * Rnd: g = Rnd * Rnd: b = Rnd * Rnd: dc = 0 While y > 0 And y < _Height orbit x, y, angle, forward, nextx, nexty Color _RGB32(127 + 127 * Sin(r * dc), 127 + 127 * Sin(g * dc), 127 + 127 * Sin(b * dc)) Line (x, y)-(nextx, nexty) forward = forward - stepper If forward < 0 Then forward = 20 orbit _Width / 2, _Height / 2, Rnd * 360, 200, nextx, nexty angle = Rnd * 360 pentAngle = Rnd * 90 If Rnd < .5 Then pentAngle = -pentAngle stepper = Rnd * 3 + .5 dc = dc + .00936 End If angle = angle + pentAngle ' the absolute angle from 0 degrees accumulates at every turn x = nextx: y = nexty ' restart where we left off _Limit 2000 Wend Loop ' !!!!!! featuring the use of this SUB routine !!!! Sub orbit (X_Origin, Y_Origin, Degrees, Radius, xOut, yOut) ' all default single should be ok xOut = X_Origin + Radius * Cos(_D2R(Degrees)) yOut = Y_Origin + Radius * Sin(_D2R(Degrees)) End Sub
|
|