Jump to content

Draw 5 Point Star


JoHanatCent
 Share

Recommended Posts

Created because:

* Wanted to see if I can

* Can I use percentadges to control size?

* Visualization of the Random function

* Wanted to see if this can waist other peoples time as well

* See some reaction from other users.

;================================= * = * = * = * = * = * ===========================================================
#NoTrayIcon
SRandom(@AutoItPID)

WinMinimizeAll ()
HotKeySet("{ESC}", "OntSnap"); ==  *   *   *  == To stop the program
$lengte = 450
Dim $x0ne, $yone, $xtwo, $ytwo, $line, $Slaap, $LineColor, $LineWidth
While "Creating the Stars"
$Slaap = Random(1, 1000, 1)
    $lengte = Random(50, 450, 1)
    $LineWidth = Random(2, 20, 1)
    $x0ne = Random(10, @DesktopWidth - $lengte / 3, 1)
    Sleep($Slaap)
    $yone = Random(-1, @DesktopHeight - $lengte / 3, 1)
    $xtwo = $x0ne + $lengte * .328
    $ytwo = $yone + $lengte * .955
    $LineColor = Random(0x000000, 0xFFFFFF, 1)
    DrawALine()
    $x0ne = $x0ne - $lengte * .507
    $yone = $yone + $lengte * .373
    Sleep($Slaap)
    DrawALine()
    $xtwo = $xtwo + $lengte * .164
    $ytwo = $ytwo - $lengte * .582
    Sleep($Slaap)
    DrawALine()
    $x0ne = $x0ne + $lengte * .179
    $yone = $yone + $lengte * .582
    Sleep($Slaap)
    DrawALine()
    $xtwo = $xtwo - $lengte * .492
    $ytwo = $ytwo - $lengte * .373
    Sleep($Slaap)
    DrawALine()
    Sleep($Slaap)
WEnd
Func DrawALine()
    $hnd = DllCall("user32.dll", "int", "GetDC", "hwnd", 0)
    $pen = DllCall("gdi32.dll", "int", "CreatePen", "int", 0, "int", $LineWidth, "int", $LineColor)
    DllCall("gdi32.dll", "int", "SelectObject", "int", $hnd[0], "int", $pen[0])
    DllCall("GDI32.dll", "int", "MoveToEx", "hwnd", $hnd[0], "int", $x0ne, "int", $yone, "int", 0)
    DllCall("GDI32.dll", "int", "LineTo", "hwnd", $hnd[0], "int", $xtwo, "int", $ytwo)
    DllCall("user32.dll", "int", "ReleaseDC", "hwnd", 0, "int", $hnd[0])
EndFunc   ;==>DrawALine
Func OntSnap()
    WinMinimizeAllUndo ( )
    Exit
EndFunc   ;==>OntSnap
;================================= * = * = * = * = * = * ===========================================================
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...