' ****** START INCLUDE Rgba Core:::RgbaBox(x1%, y1%, x2%, y2%, c&, a%b) ****** DIM r0%, g0%, b0%, a0%, r1%, g1%, b1%, a1% DIM RgbaAreaBorder& = &h1 SUB SetRgb0(x#,y#) DIM c& = (POINT(x#,y#)) r0% = _RED(c&) g0% = _GREEN(c&) b0% = _BLUE(c&) END SUB SUB SetRgb1(c&,a%b) r1% = _RED(c&) g1% = _GREEN(c&) b1% = _BLUE(c&) a0% = 255 - a%b a1% = a%b END SUB SUB RgbaCorePset(x#,y#) PSET(x#,y#), _RGB( [{ (r0%*a0%)+(r1%*a1%) }/255], [{ (g0%*a0%)+(g1%*a1%) }/255], [{ (b0%*a0%)+(b1%*a1%) }/255] ) END SUB SUB RgbaBox(x1#, y1#, x2#, y2#, c&, a%b) DIM x#, y# : SetRgb1(c&, a%b) FOR x# = FIX(MAX(MIN(x1#,x2#),0)) TO FIX(MIN(MAX(x1#,x2#), xMAX)) FOR y# = FIX(MAX(MIN(y1#,y2#),0)) TO FIX(MIN(MAX(y1#,y2#), yMAX)) SetRgb0(x#,y#) : RgbaCorePset(x#,y#) NEXT y# : NEXT x# END SUB ' ****** END INCLUDE Rgba Core:::RgbaBox(x1%, y1%, x2%, y2%, c&, a%b) ****** ' 🟠 PROGRAM DESCRIPTION ' This program exported from BASIC Anywhere Machine (Version [5.2.3].[2023.12.16.16.28]) on 2024.03.17 at 02:04 (Coordinated Universal Time) ' Program by Charlie Veniot ' Using DRAW statements for a "Spirograph-ish" way of creating interesting patterns ' The DRAW statements are used to position the pen for drawing circles ' Each DRAW statement (two of them) is a bit like a limb, with a joint connecting them, and each limb is drawn at a varying angle ' Circle drawn at the end of the second limb ' Each rendered image uses a color that is a transition from a previous target colour to a future target colour ' All circles in a rendering are the same size; the radius of the circles increases every second rendering up to a maximum, then decreases to a minimum, back and forth ' Each rendering leaves a dim echo of the previous rendering ' 🟠 DECLARATIONS and INITIALIZATION ' f% affects the angle of the arm in the second DRAW statement maxf% = 500 f% = INT( RND * ( maxf% - 1 ) ) + 1 finc% = 1 ' r% affects the radius of the circles maxr# = 21 r# = INT( RND * 19 ) + 1 rinc# = 0.25 ' Length of the "arms"; a1% drawn from center of screen to every 1 degree; a2% at same angle as a1%, plus f% maxa% = 90 a1% = INT( RND * 45 ) + maxr# + 20 a2% = INT( maxa% - a1% + 105 ) ' R1#, G1#, and B1# are the components of the previous target colour (initialized to a starting colour at program start) ' R2#, G2#, and B2# are the components of the next target colour ' the animation slowly transitions from (r1#,g1#,b1#) to (r2#,g2#,b2#), a random target colour selected when the target is reached ' radj#, gadj#, and badj# used to calculate the transition increments r1# = RND * 206 + 50 g1# = RND * 206 + 50 b1# = RND * 206 + 50 GOSUB 🎨100_NEXT_COLOR ' 🟠 MAIN PROGRAM SCREEN _NEWIMAGE(611,611,27) 🏁🏁🏁LOOP_START: GOSUB 🖥300_DrawImage SLEEP 1.75 : WHILE _MOUSEBUTTON : WEND GOSUB 🎨200_ColorsForNextLoop GOSUB ⚙400_IncrementVariables GOTO 🏁🏁🏁LOOP_START END ' 🟠 SUBROUTINES 🎨100_NEXT_COLOR: r2# = INT( RND * 206 ) + 50 g2# = INT( RND * 206 ) + 50 b2# = INT( RND * 206 ) + 50 radj# = ( r2# - r1# ) / 20 gadj# = ( g2# - g1# ) / 20 badj# = ( b2# - b1# ) / 20 RETURN 🎨200_ColorsForNextLoop: r1# = r1# + radj# : g1# = g1# + gadj# : b1# = b1# + badj# IF NOT ( BETWEEN( r1#, 0, 255 ) _ AND BETWEEN( g1#, 0, 255) _ AND BETWEEN( b1#, 0, 255) ) _ THEN r1# = r2# : g1# = g2# : b1# = b2# : GOSUB 🎨100_NEXT_COLOR RETURN 🖥300_DrawImage: RgbaBox( 0, 0, XMAX, YMAX, 0, 155 ) COLOR _RGB( INT( r1# ), INT( g1# ), INT( b1# ) ) FOR angle% = 0 TO 360 DRAW "B M" + XMAX/2 + "," + YMAX/2 DRAW "TA" + angle% + " B U" + ( a1% - INT( r# ) ) DRAW "TA" + ( angle% * f% ) + "B U" + a2% CIRCLE ( POINT( 0 ), POINT( 1 ) ),INT( r# ), , , , , T NEXT angle% RETURN ⚙400_IncrementVariables: f% = f% + finc% IF f% > maxf% THEN f% = maxf% : finc% = -finc% IF f% < 1 THEN f% = 1 : finc% = -finc% r# = r# + rinc# IF r# > maxr# THEN r# = maxr# : rinc# = -rinc# IF r# < 1 THEN r# = 1 : rinc# = -rinc# RETURN