|
Post by charliejv on Nov 5, 2022 22:53:14 GMT -5
|
|
|
Post by bplus on Nov 6, 2022 10:33:17 GMT -5
For snow flakes you would do better with hexagonal 6 spokes from center point. _Title "draw flake test 2" ' B+ 2018-12-05 from JB 2016-11-07 ' revist 2021-11-24 and demo better. ' revise again for 2022-07-14 post Const XMAX = 400, YMAX = 400 Randomize Timer Screen _NewImage(XMAX, YMAX, 32) _ScreenMove 400, 150
Do DV = 2.1 + .4 * Rnd 'global dictates density of flake rr = 45 * Rnd + 3 For rAng = 0 To _Pi / 16 Step _Pi(1 / 120) Cls rFlake XMAX * .5, YMAX * .5, rr, DV, rAng _Display _Limit 6 Next Loop Until _KeyDown(27)
Sub rFlake (x, y, r, DV, rAng) 'DV = flake density Color _RGBA32(225, 225, 245, 100) For a = 0 To 5 armX = x + r * Cos(a * _Pi(1 / 3) + rAng) armY = y + r * Sin(a * _Pi(1 / 3) + rAng) Line (x, y)-(armX, armY) If r > 2.5 Then rFlake armX, armY, r / DV, DV, rAng Next End Sub
|
|
|
Post by charliejv on Nov 6, 2022 13:23:58 GMT -5
For snow flakes you would do better with hexagonal 6 spokes from center point. _Title "draw flake test 2" ' B+ 2018-12-05 from JB 2016-11-07 ' revist 2021-11-24 and demo better. ' revise again for 2022-07-14 post Const XMAX = 400, YMAX = 400 Randomize Timer Screen _NewImage(XMAX, YMAX, 32) _ScreenMove 400, 150
Do DV = 2.1 + .4 * Rnd 'global dictates density of flake rr = 45 * Rnd + 3 For rAng = 0 To _Pi / 16 Step _Pi(1 / 120) Cls rFlake XMAX * .5, YMAX * .5, rr, DV, rAng _Display _Limit 6 Next Loop Until _KeyDown(27)
Sub rFlake (x, y, r, DV, rAng) 'DV = flake density Color _RGBA32(225, 225, 245, 100) For a = 0 To 5 armX = x + r * Cos(a * _Pi(1 / 3) + rAng) armY = y + r * Sin(a * _Pi(1 / 3) + rAng) Line (x, y)-(armX, armY) If r > 2.5 Then rFlake armX, armY, r / DV, DV, rAng Next End Sub
View AttachmentYeah, I played with 3 to 10 (well, anything about 7 was total giggles), but I liked 5 to see what individual lines were like compared to each other. The "space" between the lines made it way easier. But I agree, the 6 lines makes for a much prettier snowflake.
|
|