Jump to content

Once upon a time I had an Autoit Script that would accept a few variables and then mathmatically draw spirograph designs


Recommended Posts

I tucked it away with plans to one day figure out the pieces that make it work.

I don't have any of my old storage devices or my old data. I cant remember if they called it spirograph but I seem to remember it was called something generic.

Anyone have a link or a copy of that tucked away and willing to share it again?

I was pretty sure it came from someone on this forum but I can't find any reference to it. I am trying to remember when I ran into it and I think it would have been 2010 ish

Thanks in advance if anyone can help.

Link to comment
Share on other sites

  • 1 month later...

Unfortunately I don't have the link you are looking for, but this script may generate something that (remotely) may look like what you are looking for

p.s. the script is not mine, it is a translation of an old script for an Apple 2 recovered at the following link:

https://www.calormen.com/jsbasic/    (select the script -->  Snowflakes (Kevin Riordan))

#cs

https://www.calormen.com/jsbasic/
SELECT -->  Snowflakes (Kevin Riordan)

100 REM *****************************************************************
110 REM *                                                               *
120 REM *                         SNOWFLAKE                             *
130 REM *             A GRAPHICS NONSENSE FOR APPLE II                  *
140 REM *                   KEVIN RIORDAN 1985                          *
150 REM *                                                               *
160 REM *****************************************************************
170 :

180 REM  THIS PROGRAM DRAWS SUCCESSIVE AND INCREASINGLY
190 REM  INTRICATE SYMMETRICAL DESIGNS ON THE HIRES SCREEN.
210 REM  IT RUNS IN AN ETERNAL LOOP
230 REM  IT'S VERY RESTFUL TO STARE AT!
240 :
#ce
#include <ColorConstantS.au3>
#include <GDIPlus.au3>
#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>

_GDIPlus_Startup()
OnAutoItExitRegister("_Terminate")

Global $graphheight = @DesktopHeight / 2
Global $graphwidth = $graphheight ; @DesktopWidth / 2
Global $iCX = $graphwidth / 2, $iCY = $graphheight / 2
Global $hMain, $PenColor = 0xFFFF0000
Global $hGraphics, $hPen, $hColor, $hDC, $hHBitmap, $hDC_backbuffer, $DC_obj
_GraphWindow($graphwidth, $graphheight)
Global $x = 3, $S = $iCX, $T = $iCY
_WinAPI_BitBlt($hDC_backbuffer, 0, 0, $graphwidth, $graphheight, $hDC_backbuffer, 0, 0, $WHITENESS)

Do
    For $y = 0 To Int(($x - 2) / 2)
        fn280()
        Sleep(750)
        _WinAPI_BitBlt($hDC_backbuffer, 0, 0, $graphwidth, $graphheight, $hDC_backbuffer, 0, 0, $WHITENESS)
    Next
    $x += 1
Until GUIGetMsg() = $GUI_EVENT_CLOSE

_Terminate()

Func fn280()
    $A1 = 2 * (22 / 7) / $x
    $A2 = $A1 * ($y + 1)
    $C = 1 / Sin((22 / 7) * ($y + 1) / $x)
    $D = $x
    $E = $y + 1
    Do
        $D = $D - Int($D / $E) * $E
        $ENDLOOP = True
        If Abs($D) > 0.5 Then
            $F = $E
            $E = $D
            $D = $F
            $ENDLOOP = False
        EndIf
    Until $ENDLOOP
    $E = Int($E + 0.5)
    $D = $x / $E
    If $D - Int($D / 2) * 2 > 0.5 Then $C += Cos((22 / 7) * $E / (2 * $x))
    $G = $x + 0.5
    $K = $D - 0.5
    For $L = 1 To Int($G)
        $M = 0
        $N = 0
        $R = ($L - 1) * $A1
        For $Q = 1 To Int($K)
            $M += Cos($R) / $C
            $N += Sin($R) / $C
            $U = $iCX + Int($iCY * $M + 0.5)
            $V = $iCY + Int($iCY * $N + 0.5)
            _GDIPlus_GraphicsDrawLine($hGraphics, $S, $T, $U, $V, $hPen)
            _WinAPI_BitBlt($hDC, 0, 0, $graphwidth, $graphheight, $hDC_backbuffer, 0, 0, $SRCCOPY) ;blit drawn bitmap to GUI
            $S = $U
            $T = $V
            $R += $A2
        Next
        $U = $iCX
        $V = $iCY
        _GDIPlus_GraphicsDrawLine($hGraphics, $S, $T, $U, $V, $hPen)
        _WinAPI_BitBlt($hDC, 0, 0, $graphwidth, $graphheight, $hDC_backbuffer, 0, 0, $SRCCOPY) ;blit drawn bitmap to GUI
        $S = $iCX
        $T = $iCY
        If GUIGetMsg() = $GUI_EVENT_CLOSE Then _Terminate()
    Next
EndFunc   ;==>fn280

Func _GraphWindow($graphwidth, $graphheight)
    $hMain = GUICreate("Spirograph", $graphwidth, $graphheight)
    GUISetState(@SW_SHOW, $hMain)
    $hDC = _WinAPI_GetDC($hMain)
    $hHBitmap = _WinAPI_CreateCompatibleBitmap($hDC, $graphwidth, $graphheight)
    $hDC_backbuffer = _WinAPI_CreateCompatibleDC($hDC)
    $DC_obj = _WinAPI_SelectObject($hDC_backbuffer, $hHBitmap)
    $hGraphics = _GDIPlus_GraphicsCreateFromHDC($hDC_backbuffer)
    _GDIPlus_GraphicsSetSmoothingMode($hGraphics, $GDIP_SMOOTHINGMODE_HIGHQUALITY)
    _GDIPlus_GraphicsSetPixelOffsetMode($hGraphics, $GDIP_PIXELOFFSETMODE_HIGHQUALITY)
    $hPen = _GDIPlus_PenCreate($PenColor, 2)
EndFunc   ;==>_GraphWindow

Func _Terminate()
    ; Clean up resources
    _WinAPI_SelectObject($hDC_backbuffer, $DC_obj)
    _WinAPI_DeleteDC($hDC_backbuffer)
    _WinAPI_DeleteObject($hHBitmap)
    _WinAPI_ReleaseDC($hMain, $hDC)
    _GDIPlus_GraphicsDispose($hGraphics)
    _GDIPlus_PenDispose($hPen)
    _GDIPlus_Shutdown()
    GUIDelete($hMain)
    Exit
EndFunc   ;==>_Terminate

 

Edited by Chimp

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...