Jump to content
Sign in to follow this  
Lakes

TriSpiral - A work in Progress

Recommended Posts

Lakes

Original post> here.

Drawing the outer spirals requires further work. :)

#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>
#include <Math.au3>


Global Const $width     = 800
Global Const $height    = 800
Global Const $Black     = "0xFF000000"
Global Const $White = "0xFFFFFFFF"

Global Const $Red   = "0xFFFF0000"
Global Const $Green     = "0xFF00FF00"
Global Const $Blue      = "0xFF0000FF"
Global Const $Yellow    = "0xFFFFFF00"

Global Const $Gray      = "0xFFdfdcd6"
Global $Dot_Size = 4
Global $XOrigin, $YOrigin, $Size, $Stp, $OuterXorg1, $Outeryorg1
Global $title = "Spirals"

Global Const $nPI  = 3.1415926535897932384626433832795

Global $hGUI, $hWnd, $hGraphic

    ; Create GUI
    $hGUI = GUICreate($title, $width, $height)
    $hWnd = WinGetHandle($title)
    GUISetState()

    _GDIPlus_Startup ()
    $hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hWnd)
    $hPenBlk = _GDIPlus_PenCreate ($Black)
    $hPenWht = _GDIPlus_PenCreate ($White,4)
    $hPenBlue = _GDIPlus_PenCreate ($Blue)
    $hPenGrn = _GDIPlus_PenCreate ($Green)
    $hBrushWht = _GDIPlus_BrushCreateSolid($White)

$OrgX = $Width/2
$OrgY = $Height/2
$Size = 150
ControlFocus("Spirals","","")

;--------------------------- Draw Spirals ------------------------------------

; Spiral 1
    $Stp = 2 ;  <<--------- Defines the smoothness and the size of the Sprial, Smaller value = larger Spiral -------
    $Size = 1
        For $R = 0 to 360 *5 step $Stp
            $Rad = _Radian ($R)
            $X = Sin($Rad)*$Size + $OrgX
            $Y = Cos($Rad)*$Size + $OrgY
;           _GDIPlus_GraphicsDrawEllipse($hGraphic, $X - $Dot_Size/2, $Y - $Dot_Size/2 , $Dot_Size, $Dot_Size, $hPenBlk)
;           _GDIPlus_GraphicsFillEllipse($hGraphic, $X - $Dot_Size/2, $Y - $Dot_Size/2 ,$Dot_Size , $Dot_Size, $hBrushWht)
            $R1   = $R + $Stp
            $Rad1 = _Radian ($R1)
            $Px   = Sin($Rad1)*$Size + $OrgX
            $Py   = Cos($Rad1)*$Size + $OrgY

            _GDIPlus_GraphicsDrawLine ($hGraphic,$X,$Y,$Px,$Py,$hPenBlk)
;           _GDIPlus_GraphicsDrawLine ($hGraphic,$OrgX,$OrgY,$Px,$Py,$hPenBlk)
            $Size += 0.3
_SlowDraw() ; looks nicer if you slow the drawing down
        Next
_Pause()

; Spiral 2
    $Size = 1
    $Start = 180
        For $R = $Start to ($Start *10)+ $Start step $Stp
            $Rad = _Radian ($R)
            $X = Sin($Rad)*$Size + $OrgX
            $Y= Cos($Rad)*$Size + $OrgY
            $R1   = $R + $Stp
            $Rad1 = _Radian ($R1)
            $Px   = Sin($Rad1)*$Size + $OrgX
            $Py   = Cos($Rad1)*$Size + $OrgY
            _GDIPlus_GraphicsDrawLine ($hGraphic,$X,$Y,$Px,$Py,$hPenBlue)
;           _GDIPlus_GraphicsDrawLine ($hGraphic,$X,$Y,$Px,$Py,$hPenBlk)
            $Size += 0.3
_SlowDraw() ; looks nicer if you slow the drawing down
        Next
_Pause()

;Spiral 3
    $Size = 1
    $Start = 270
        For $R = $Start to ($Start * 6.65) + $Start step $Stp
            $Rad = _Radian ($R)
            $X = Sin($Rad)*$Size + $OrgX
            $Y= Cos($Rad)*$Size + $OrgY
            $R1   = $R + $Stp
            $Rad1 = _Radian ($R1)
            $Px   = Sin($Rad1)*$Size + $OrgX
            $Py   = Cos($Rad1)*$Size + $OrgY
            _GDIPlus_GraphicsDrawLine ($hGraphic,$X,$Y,$Px,$Py,$hPenWht)
;           _GDIPlus_GraphicsDrawLine ($hGraphic,$OrgX,$OrgY,$Px,$Py,$hPenBlue)
            $Size += 0.3
_SlowDraw() ; looks nicer if you slow the drawing down
        Next


Func _SlowDraw()
    Sleep(5)
EndFunc

Func _Pause()
    msgbox(0,"", "Done")
;_GDIPlus_GraphicsClear($hGraphic ,$Gray)
EndFunc

    ; Loop until user exits
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE

    ; Clean up resources
    _GDIPlus_GraphicsDispose ($hGraphic)
    _GDIPlus_PenDispose($hPenBlk)
    _GDIPlus_PenDispose($hPenWht)
    _GDIPlus_PenDispose($hPenBlue)
    _GDIPlus_PenDispose($hPenGrn)
    _GDIPlus_BrushDispose($hBrushWht)

    _GDIPlus_Shutdown ()

2015 - Still no flying cars, instead blankets with sleeves.

Share this post


Link to post
Share on other sites
Lakes

Nearly there, the position of the outer spirals needs adjusting.

#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>
#include <Math.au3>


Global Const $width     = 800
Global Const $height     = 800
Global Const $Black     = "0xFF000000"
Global Const $White        = "0xFFFFFFFF"

Global Const $Red          = "0xFFFF0000"
Global Const $Green      = "0xFF00FF00"
Global Const $Blue      = "0xFF0000FF"
Global Const $Yellow     = "0xFFFFFF00"

Global Const $Gray        = "0xFFdfdcd6"
Global $Dot_Size = 4
Global $XOrigin, $YOrigin, $Size, $Stp, $OuterXorg1, $Outeryorg1
Global $title = "Spirals"

Global Const $nPI  = 3.1415926535897932384626433832795

Global $hGUI, $hWnd, $hGraphic

    ; Create GUI
    $hGUI = GUICreate($title, $width, $height)
    $hWnd = WinGetHandle($title)
    GUISetState()

    _GDIPlus_Startup ()
    $hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hWnd)
    $hPenBlk = _GDIPlus_PenCreate ($Black)
    $hPenWht = _GDIPlus_PenCreate ($White,4)
    $hPenBlue = _GDIPlus_PenCreate ($Blue)
    $hPenGrn = _GDIPlus_PenCreate ($Green)
    $hBrushWht = _GDIPlus_BrushCreateSolid($White)

$OrgX = $Width/2
$OrgY = $Height/2
$Size = 150
ControlFocus("Spirals","","")

;--------------------------- Draw Spirals ------------------------------------

; Spiral 1
    $Stp = 3 ;  <<--------- Defines the smoothness and the size of the Sprial, Smaller value = larger Spiral -------
    $Size = 0
        For $R = 0 to 360 *5 step $Stp
            $Rad = _Radian ($R)
            $X = Sin($Rad)*$Size + $OrgX
            $Y = Cos($Rad)*$Size + $OrgY
;            _GDIPlus_GraphicsDrawEllipse($hGraphic, $X - $Dot_Size/2, $Y - $Dot_Size/2 , $Dot_Size, $Dot_Size, $hPenBlk)
;            _GDIPlus_GraphicsFillEllipse($hGraphic, $X - $Dot_Size/2, $Y - $Dot_Size/2 ,$Dot_Size , $Dot_Size, $hBrushWht)
            $R1   = $R + $Stp
            $Rad1 = _Radian ($R1)
            $Px   = Sin($Rad1)*$Size + $OrgX
            $Py   = Cos($Rad1)*$Size + $OrgY

            _GDIPlus_GraphicsDrawLine ($hGraphic,$X,$Y,$Px,$Py,$hPenBlk)
;            _GDIPlus_GraphicsDrawLine ($hGraphic,$OrgX,$OrgY,$Px,$Py,$hPenBlk)
            $Size += 0.3
_SlowDraw() ; looks nicer if you slow the drawing down
        Next
;_Pause()


;  ** Outer Spiral 1 **
    $OuterSize = 90
    $Start = 180
    $Size = 90
    $Stp = 2
$OuterXorg1 = $Px
$OuterYOrg1 = $Py + $OuterSize
        For $R = $Start + 360 * 5 to $Start step -$Stp
            $Rad = _Radian ($R)
            $X = Sin($Rad)*$OuterSize + $OuterXorg1
            $Y = Cos($Rad)*$OuterSize + $OuterYOrg1
;            _GDIPlus_GraphicsDrawEllipse($hGraphic, $X - $Dot_Size/2, $Y - $Dot_Size/2 , $Dot_Size, $Dot_Size, $hPenBlk)
;            _GDIPlus_GraphicsFillEllipse($hGraphic, $X - $Dot_Size/2, $Y - $Dot_Size/2 ,$Dot_Size , $Dot_Size, $hBrushWht)
            $R1   = $R + $Stp
            $Rad1 = _Radian ($R1)
            $Px   = Sin($Rad1)*$OuterSize + $OuterXorg1
            $Py   = Cos($Rad1)*$OuterSize + $OuterYOrg1

            _GDIPlus_GraphicsDrawLine ($hGraphic,$X,$Y,$Px,$Py,$hPenBlk)
;            _GDIPlus_GraphicsDrawLine ($hGraphic,$OrgX,$OrgY,$Px,$Py,$hPenBlk)
            $OuterSize -= 0.09
_SlowDraw() ; looks nicer if you slow the drawing down
        Next

; Spiral 2
    $Stp = 3
    $Size = 0
    $Start = 180
        For $R = $Start to ($Start *10)+ $Start step $Stp
            $Rad = _Radian ($R)
            $X = Sin($Rad)*$Size + $OrgX
            $Y= Cos($Rad)*$Size + $OrgY
            $R1   = $R + $Stp
            $Rad1 = _Radian ($R1)
            $Px   = Sin($Rad1)*$Size + $OrgX
            $Py   = Cos($Rad1)*$Size + $OrgY
            _GDIPlus_GraphicsDrawLine ($hGraphic,$X,$Y,$Px,$Py,$hPenBlue)
;            _GDIPlus_GraphicsDrawLine ($hGraphic,$X,$Y,$Px,$Py,$hPenBlk)
            $Size += 0.3
_SlowDraw() ; looks nicer if you slow the drawing down
        Next
;_Pause()

;  *** Outer Spiral 2 ***
    $OuterSize = 90
    $Start = 0
    $Stp = 2
$OuterXorg1 = $Px
$OuterYOrg1 = $Py - $OuterSize
        For $R = $Start + 360 * 5 to $Start  step -$Stp
            $Rad = _Radian ($R)
            $X = Sin($Rad)*$OuterSize + $OuterXorg1
            $Y = Cos($Rad)*$OuterSize + $OuterYOrg1
;            _GDIPlus_GraphicsDrawEllipse($hGraphic, $X - $Dot_Size/2, $Y - $Dot_Size/2 , $Dot_Size, $Dot_Size, $hPenBlk)
;            _GDIPlus_GraphicsFillEllipse($hGraphic, $X - $Dot_Size/2, $Y - $Dot_Size/2 ,$Dot_Size , $Dot_Size, $hBrushWht)
            $R1   = $R + $Stp
            $Rad1 = _Radian ($R1)
            $Px   = Sin($Rad1)*$OuterSize + $OuterXorg1
            $Py   = Cos($Rad1)*$OuterSize + $OuterYOrg1

            _GDIPlus_GraphicsDrawLine ($hGraphic,$X,$Y,$Px,$Py,$hPenBlue)
;            _GDIPlus_GraphicsDrawLine ($hGraphic,$OrgX,$OrgY,$Px,$Py,$hPenBlk)
            $OuterSize -= 0.09
_SlowDraw() ; looks nicer if you slow the drawing down
        Next


;Spiral 3
    $Size = 0
    $Stp = 3
    $Start = 270
        For $R = $Start to ($Start * 6.65) + $Start step $Stp
            $Rad = _Radian ($R)
            $X = Sin($Rad)*$Size + $OrgX
            $Y= Cos($Rad)*$Size + $OrgY
            $R1   = $R + $Stp
            $Rad1 = _Radian ($R1)
            $Px   = Sin($Rad1)*$Size + $OrgX
            $Py   = Cos($Rad1)*$Size + $OrgY
            _GDIPlus_GraphicsDrawLine ($hGraphic,$X,$Y,$Px,$Py,$hPenWht)
;            _GDIPlus_GraphicsDrawLine ($hGraphic,$OrgX,$OrgY,$Px,$Py,$hPenBlue)
            $Size += 0.3
_SlowDraw() ; looks nicer if you slow the drawing down
        Next

;  **** Outer Spiral 3 ****
    $OuterSize = 90
    $Start = 90
    $Stp = 2
$OuterXorg1 = $Px - $OuterSize
$OuterYOrg1 = $Py
        For $R = $Start + 360 * 5 to $Start  step -$Stp
            $Rad = _Radian ($R)
            $X = Sin($Rad)*$OuterSize + $OuterXorg1
            $Y = Cos($Rad)*$OuterSize + $OuterYOrg1
;            _GDIPlus_GraphicsDrawEllipse($hGraphic, $X - $Dot_Size/2, $Y - $Dot_Size/2 , $Dot_Size, $Dot_Size, $hPenBlk)
;            _GDIPlus_GraphicsFillEllipse($hGraphic, $X - $Dot_Size/2, $Y - $Dot_Size/2 ,$Dot_Size , $Dot_Size, $hBrushWht)
            $R1   = $R + $Stp
            $Rad1 = _Radian ($R1)
            $Px   = Sin($Rad1)*$OuterSize + $OuterXorg1
            $Py   = Cos($Rad1)*$OuterSize + $OuterYOrg1

            _GDIPlus_GraphicsDrawLine ($hGraphic,$X,$Y,$Px,$Py,$hPenWht)
;            _GDIPlus_GraphicsDrawLine ($hGraphic,$OrgX,$OrgY,$Px,$Py,$hPenBlk)
            $OuterSize -= 0.09
_SlowDraw() ; looks nicer if you slow the drawing down
        Next

Func _SlowDraw()
    Sleep(5)
EndFunc

Func _Pause()
    msgbox(0,"", "Done")
;_GDIPlus_GraphicsClear($hGraphic ,$Gray)
EndFunc

    ; Loop until user exits
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE

    ; Clean up resources
    _GDIPlus_GraphicsDispose ($hGraphic)
    _GDIPlus_PenDispose($hPenBlk)
    _GDIPlus_PenDispose($hPenWht)
    _GDIPlus_PenDispose($hPenBlue)
    _GDIPlus_PenDispose($hPenGrn)
    _GDIPlus_BrushDispose($hBrushWht)

    _GDIPlus_Shutdown ()
Edited by Lakes
  • Like 1

2015 - Still no flying cars, instead blankets with sleeves.

Share this post


Link to post
Share on other sites
mLipok

for now just looks good...


Signature beginning:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest begining - comunication with GitHub REST API Forum Rules *
ADO.au3 UDF     POP3.au3 UDF     XML.au3 UDF    How to use IE.au3  UDF with  AutoIt v3.3.14.x  for other useful stuff click the following button

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library
 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection *

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2018-10-15

Share this post


Link to post
Share on other sites
mLipok

I think this:

'?do=embed' frameborder='0' data-embedContent>>

can be interesting for you.

mLipok


Signature beginning:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest begining - comunication with GitHub REST API Forum Rules *
ADO.au3 UDF     POP3.au3 UDF     XML.au3 UDF    How to use IE.au3  UDF with  AutoIt v3.3.14.x  for other useful stuff click the following button

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library
 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection *

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2018-10-15

Share this post


Link to post
Share on other sites
LarsJ
Lakes

Super!, I`ll have a play with that, thanks!


2015 - Still no flying cars, instead blankets with sleeves.

Share this post


Link to post
Share on other sites
Lakes

This is close enough to the original ">drawing"

#include <WindowsConstants.au3>
#include <StaticConstants.au3>
#include <GUIConstantsEx.au3>
#include <GDIPlus.au3>
#include <Math.au3>

Opt("MustDeclareVars", 1)

Global $hGraphics

; Main window
Local $iWidth = 600, $iHeight = 600
Local $hGui = GUICreate("Spirals", $iWidth, $iHeight)
GUICtrlCreateLabel("", -2, $iHeight - 49, $iWidth + 4, 1, $SS_ETCHEDFRAME)
;   Local $idNext = GUICtrlCreateButton( "Next example", 50, $iHeight - 40, 200, 30 )
;   Local $idPrev = GUICtrlCreateButton( "Previous example", $iWidth - 250, $iHeight - 40, 200, 30 )
GUISetState(@SW_SHOW)
;   Local $iExample = 0
;   Local $iExMax = 10

; Graphics window
Local $hChild = GUICreate("", $iWidth, $iHeight - 50, 0, 0, $WS_POPUP, $WS_EX_MDICHILD, $hGui)
GUISetState(@SW_SHOWNOACTIVATE)

; GDIPlus
_GDIPlus_Startup()
$hGraphics = _GDIPlus_GraphicsCreateFromHWND($hChild)
_GDIPlus_GraphicsSetSmoothingMode($hGraphics, $GDIP_SMOOTHINGMODE_HIGHQUALITY)

Global $xOrg = $iWidth / 2 - 50, $yOrg = $iHeight / 2 - 29, $SleepClear = 500

Main()
While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            ExitLoop
    EndSwitch
WEnd

_GDIPlus_GraphicsDispose($hGraphics)
_GDIPlus_Shutdown()

Func Delay()
    Local $i
    For $i = 0 To 20000 ; better control of plot delay time
    Next
EndFunc   ;==>Delay

Func Main()
    ; Blue, green and red spiral
    ; Green spiral at offset 120 degrees
    ; Red spiral at offset 240 degrees

    _GDIPlus_GraphicsClear($hGraphics, 0xFFFFFFFF)
    Local $hBrushRed  = _GDIPlus_BrushCreateSolid(0xFFFF0000)
    Local $hBrushGrn  = _GDIPlus_BrushCreateSolid(0xFF00FF00)
    Local $hBrushBlue = _GDIPlus_BrushCreateSolid(0xFF0000FF)
    Local $hBrushWht  = _GDIPlus_BrushCreateSolid(0xFFFFFFFF)
    Local $Rot = 210   ; Rotation = 210
    Local $MainSpiralSize = 0.25
    Local $SmallSpiralSize = 0.3

    ; --- Blue spiral ---
    Local $CenterSpirals = 3 ; was 4
    Local $Offset = $Rot
    ; ---- Large Blue Spiral -----
    Local $x0 = $xOrg, $y0 = $yOrg, $iDegrees = 360 * $CenterSpirals, $iStep = $CenterSpirals - 1, $fSize = 0
    Local $iPoints = $iDegrees / $iStep, $aPoints[$iPoints + 2][2] = [[$iPoints + 1]], $r, $i = 1
    Local $X, $Y, $Dot_Size = 4, $ClrDots = 6

    For $a = $Offset To $iDegrees + $Offset Step $iStep
        $r = _Radian($a)
        $X = Sin($r) * $fSize + $x0
        $aPoints[$i][0] = $X
        $Y = Cos($r) * $fSize + $y0
        $aPoints[$i][1] = $Y
        _GDIPlus_GraphicsFillEllipse($hGraphics, $X - $Dot_Size / 2, $Y - $Dot_Size / 2, $Dot_Size, $Dot_Size, $hBrushBlue)
        $fSize += $MainSpiralSize
        $i += 1
        Delay()
    Next
    $fSize -= $MainSpiralSize

    ; ----- Small Blue Spiral  -----
    $iDegrees = 360 * 4.5
    $iStep = 8 ; iStep 4 = large Spiral, iStep6 = This creates a smaller spiral
    ;   Local $fSize2 = $iDegrees/$iStep * 0.3  ; $fSize2 for smaller spiral, $fSize2 = iDeg/iStep * 0.3
    Local $iPoints2 = $iDegrees / $iStep ; Additional points for smaller spiral array

    Local $fSize2 = $iPoints2 * 0.4 ; $fSize for smaller spiral
    $iPoints = $iPoints + $iPoints2 ; add array points for smaller spiral
    ReDim $aPoints[$iPoints + 360 * 1.5 + 3][2] ; extra array points for more spirals path
    $aPoints[0][0] = $iPoints + 68
    $x0 = $xOrg - ($fSize + $fSize2) * Cos(_Radian(60)) ; X-displacement (60 degrees -> see Example7)
    $y0 = $yOrg - ($fSize + $fSize2) * Sin(_Radian(60)) ; Y-displacement
    Local $y1

    For $a = -$Offset To $iDegrees + (360 * 1.5) - $Offset Step $iStep ; more spirals for small Spiral
        $r = _Radian($a)
        $X = Sin($r) * $fSize2 + $x0
        $aPoints[$i][0] = $X
        $y1 = Cos($r) * $fSize2 + $y0
        ;    $Y =  $y1                          ; Non Mirrored
        $Y = (2 * $y0) - $y1 ;  2 * y0  = Spiral mirrored around horizontal line through origin
        $aPoints[$i][1] = $Y
        _GDIPlus_GraphicsFillEllipse($hGraphics, $X - $Dot_Size / 2, $Y - $Dot_Size / 2, $Dot_Size, $Dot_Size, $hBrushBlue) ;mirrored
        $fSize2 -= $SmallSpiralSize ;  **** Note that $fSize is DECREASING => Spiral turned the OPPOSITE way around! ****
        $i += 1
        Delay()
    Next

    ; Draw graphics
    Local $hPen = _GDIPlus_PenCreate(0xFF0000FF, 4)
    Local $hPath = _GDIPlus_PathCreate()
    _GDIPlus_PathAddCurve($hPath, $aPoints)
    _GDIPlus_GraphicsDrawPath($hGraphics, $hPath, $hPen)
    _GDIPlus_PathDispose($hPath)
    _GDIPlus_PenDispose($hPen)

    ; --- Large Green spiral ---
    ; Angles starts at an offset of 120 degrees
    Local $Offset = 120 + $Rot
    Local $x0 = $xOrg, $y0 = $yOrg, $iDegrees = 360 * $CenterSpirals, $iStep = $CenterSpirals - 1, $fSize = 0
    Local $iPoints = $iDegrees / $iStep, $aPoints[$iPoints + 2][2] = [[$iPoints + 1]], $r, $i = 1
    For $a = $Offset To $iDegrees + $Offset Step $iStep ; Angle $a starts at an offset of 120 degrees
        $r = _Radian($a)
        $X = Sin($r) * $fSize + $x0
        $aPoints[$i][0] = $X
        $Y = Cos($r) * $fSize + $y0
        $aPoints[$i][1] = $Y
        _GDIPlus_GraphicsFillEllipse($hGraphics, $X - $Dot_Size / 2, $Y - $Dot_Size / 2, $Dot_Size, $Dot_Size, $hBrushGrn)
        $fSize += $MainSpiralSize
        $i += 1
        Delay()
    Next
    $fSize -= 0.3

    ; ----- Small green Spiral
    $iDegrees = 360 * 4.5
    $iStep = 8 ; This creates a smaller spiral
    Local $iPoints2 = $iDegrees / $iStep ; Additional points for smaller spiral
    Local $fSize2 = $iPoints2 * 0.4 ; $fSize for smaller spiral
    $iPoints = $iPoints + $iPoints2
    ReDim $aPoints[$iPoints + 360 * 1.5 + 3][2] ; 540 = 360 *1.5 extra array points for more spirals path
    $aPoints[0][0] = $iPoints + 68
    $x0 = $xOrg - ($fSize + $fSize2) * Cos(_Radian(300)) ; X-displacement (300 degrees -> see Example7)
    $y0 = $yOrg - ($fSize + $fSize2) * Sin(_Radian(300)) ; Y-displacement
    Local $y1

    For $a = -$Offset To $iDegrees + (360 * 1.5) - $Offset Step $iStep ; Angle $a starts at an offset of -120 degrees
        $r = _Radian($a) ; (-120 degrees because the spiral is turned the opposite way around)
        $X = Sin($r) * $fSize2 + $x0
        $aPoints[$i][0] = $X
        $y1 = Cos($r) * $fSize2 + $y0
        $Y = 2 * $y0 - $y1
        $aPoints[$i][1] = $Y ; Spiral mirrored around horizontal line through origin

        $fSize2 -= $SmallSpiralSize ; Note that $fSize is decreasing => Spiral turned the opposite way around
        _GDIPlus_GraphicsFillEllipse($hGraphics, $X - $Dot_Size / 2, $Y - $Dot_Size / 2, $Dot_Size, $Dot_Size, $hBrushGrn)
        $i += 1
        Delay()
    Next

    ; Draw graphics
    Local $hPen = _GDIPlus_PenCreate(0xFF00FF00, 4)
    Local $hPath = _GDIPlus_PathCreate()
    _GDIPlus_PathAddCurve($hPath, $aPoints)
    _GDIPlus_GraphicsDrawPath($hGraphics, $hPath, $hPen)
    _GDIPlus_PathDispose($hPath)
    _GDIPlus_PenDispose($hPen)

    ; --- Large Red spiral ---
    ; Angles start at an offset of 240 degrees
    Local $Offset = 240 + $Rot
    Local $x0 = $xOrg, $y0 = $yOrg, $iDegrees = 360 * $CenterSpirals, $iStep = $CenterSpirals - 1, $fSize = 0
    Local $iPoints = $iDegrees / $iStep, $aPoints[$iPoints + 2][2] = [[$iPoints + 1]], $r, $i = 1
    For $a = $Offset To $iDegrees + $Offset Step $iStep ; Angle $a starts at an offset of 240 degrees
        $r = _Radian($a)
        $X = Sin($r) * $fSize + $x0
        $aPoints[$i][0] = $X
        $Y = Cos($r) * $fSize + $y0
        $aPoints[$i][1] = $Y
        _GDIPlus_GraphicsFillEllipse($hGraphics, $X - $Dot_Size / 2, $Y - $Dot_Size / 2, $Dot_Size, $Dot_Size, $hBrushRed)
        $fSize += $MainSpiralSize
        $i += 1
        Delay()
    Next
    $fSize -= 0.3

    ; ----- Small Red Spiral ------
    $Offset = 240 + $Rot
    $iDegrees = 360 * 4.5
    $iStep = 8 ; This creates a smaller spiral
    Local $iPoints2 = $iDegrees / $iStep ; Additional points for smaller spiral
    Local $fSize2 = $iPoints2 * 0.4 ; $fSize for smaller spiral
    $iPoints = $iPoints + $iPoints2
    ReDim $aPoints[$iPoints + 360 * 1.5 + 3][2]
    $aPoints[0][0] = $iPoints + 68
    $x0 = $xOrg - ($fSize + $fSize2) * Cos(_Radian(180)) ; X-displacement
    $y0 = $yOrg - ($fSize + $fSize2) * Sin(_Radian(180)) ; Y-displacement
    Local $y1

    For $a = -$Offset To $iDegrees + (360 * 1.5) - $Offset Step $iStep ; Angle $a starts at an offset of -240 degrees
        $r = _Radian($a) ; (-240 degrees because the spiral is turned the opposite way around)
        $X = Sin($r) * $fSize2 + $x0
        $aPoints[$i][0] = $X
        $y1 = Cos($r) * $fSize2 + $y0
        $Y = 2 * $y0 - $y1 ; Spiral mirrored around horizontal line through origin
        $aPoints[$i][1] = $Y
        _GDIPlus_GraphicsFillEllipse($hGraphics, $X - $Dot_Size / 2, $Y - $Dot_Size / 2, $Dot_Size, $Dot_Size, $hBrushRed)
        $fSize2 -= $SmallSpiralSize ; Note that $fSize is decreasing => Spiral turned the opposite way around
        $i += 1
        Delay()
    Next

    ; Draw graphics
    Local $hPen = _GDIPlus_PenCreate(0xFFFF0000, 4)
    Local $hPath = _GDIPlus_PathCreate()
    _GDIPlus_PathAddCurve($hPath, $aPoints)
    _GDIPlus_GraphicsDrawPath($hGraphics, $hPath, $hPen)

    ; Delete part of red spiral
    For $i = 15 To 30
        _GDIPlus_GraphicsFillEllipse($hGraphics, $aPoints[$i][0] - $ClrDots / 2, $aPoints[$i][1] - $ClrDots / 2, $ClrDots, $ClrDots, $hBrushWht)
    Next
            _GDIPlus_GraphicsFillEllipse($hGraphics, $aPoints[$i][0] - $ClrDots / 2, $aPoints[$i][1] - $ClrDots / 2, $ClrDots, $ClrDots, $hBrushRed)

    _GDIPlus_PathDispose($hPath)
    _GDIPlus_PenDispose($hPen)
    _GDIPlus_BrushDispose($hBrushRed)
    _GDIPlus_BrushDispose($hBrushGrn)
    _GDIPlus_BrushDispose($hBrushBlue)
    _GDIPlus_BrushDispose($hBrushWht)
EndFunc   ;==>Main
Edited by Lakes

2015 - Still no flying cars, instead blankets with sleeves.

Share this post


Link to post
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
Sign in to follow this  

×