Ich freue mich sehr, dass sie inspiriert sind und Ideen wachsen lassen. (google translate) 🙌
Hier ein kleines Skript zum Anzeigen des Parallax Effektes. Original Idee stammt von Fernando Cohen und kann hier betrachtet werden: https://codepen.io/designfenix/pen/pYyOJE
C Alles anzeigen;Coded by UEZ build 2020-01-07 ;Original idea and graphic concept by Fernando Cohen -> https://codepen.io/designfenix/pen/pYyOJE #pragma compile(Icon, "c:\Program Files (x86)\AutoIt3\Icons\au3.ico") #AutoIt3Wrapper_Run_Au3Stripper=y #Au3Stripper_Parameters=/so /pe /rm #AutoIt3Wrapper_Run_After=del /f /q "%scriptdir%\%scriptfile%_stripped.au3" #include <GDIPlus.au3> #include <GuiConstantsEx.au3> #include <InetConstants.au3> #include <WindowsConstants.au3> _GDIPlus_Startup() Global $hGUI, $iFPS = 0, $iShowFPS = 0, $bExit Global Const $iW = 1200, $iH = 700, $iWh = $iW / 2, $iHh = $iH / 2, $sTitle = "GDI+ Parallax Effect v0.55" Global Const $fPi = ACos(-1), $fRad = $fPi / 180, $fDeg = 180 / $fPi AutoItSetOption("GUIOnEventMode", 1) ParallaxFX() AutoItSetOption("GUIOnEventMode", 0) _GDIPlus_Shutdown() Func ParallaxFX() ConsoleWrite("Downloading images if images don't exist locally...Please wait!" & @CRLF) Local Const $sImg1 = @ScriptDir & "\mountain.png", $sImg2 = @ScriptDir & "\island.png", $sImg3 = @ScriptDir & "\bird.png", $sImg4 = @ScriptDir & "\boat.png" If Not FileExists($sImg1) Then InetGet("http://www.design-fenix.com.ar/parallax/mountain.png", $sImg1, BitOR($INET_FORCERELOAD, $INET_BINARYTRANSFER)) If Not FileExists($sImg2) Then InetGet("http://www.design-fenix.com.ar/parallax/island.png", $sImg2, BitOR($INET_FORCERELOAD, $INET_BINARYTRANSFER)) If Not FileExists($sImg3) Then InetGet("http://www.design-fenix.com.ar/parallax/bird.png", $sImg3, BitOR($INET_FORCERELOAD, $INET_BINARYTRANSFER)) If Not FileExists($sImg4) Then InetGet("http://www.design-fenix.com.ar/parallax/boat.png", $sImg4, BitOR($INET_FORCERELOAD, $INET_BINARYTRANSFER)) $bExit = False $hGUI = GUICreate($sTitle, $iW, $iH) ;, 0, 0, $WS_POPUP) Local Const $iLabel = GUICtrlCreateLabel("", 0, 0, $iW, $iH) GUISetState(@SW_SHOW, $hGUI) GUISetCursor(9, 1) ;create canvas elements Local Const $hDC = _WinAPI_GetDC($hGUI) Local Const $hHBitmap = _WinAPI_CreateCompatibleBitmap($hDC, $iW, $iH) Local Const $hDC_backbuffer = _WinAPI_CreateCompatibleDC($hDC) Local Const $DC_obj = _WinAPI_SelectObject($hDC_backbuffer, $hHBitmap) Local Const $hCanvas = _GDIPlus_GraphicsCreateFromHDC($hDC_backbuffer) _GDIPlus_GraphicsSetSmoothingMode($hCanvas, $GDIP_SMOOTHINGMODE_HIGHQUALITY) _GDIPlus_GraphicsSetPixelOffsetMode($hCanvas, $GDIP_PIXELOFFSETMODE_HIGHQUALITY) _GDIPlus_GraphicsSetTextRenderingHint($hCanvas, $GDIP_TEXTRENDERINGHINT_ANTIALIASGRIDFIT) Local Const $hBrush_Clr = _GDIPlus_BrushCreateSolid(0xFFF4F9FA), _ $hBrush_FPS = _GDIPlus_BrushCreateSolid(0xF0808080), _ $hFormat_FPS = _GDIPlus_StringFormatCreate(), _ $hFamily_FPS = _GDIPlus_FontFamilyCreate("Arial"), _ $hFont_FPS = _GDIPlus_FontCreate($hFamily_FPS, 8), _ $tLayout_FPS = _GDIPlus_RectFCreate(0, 0, 60, 16) $iFPS = 0 Local $tObj = DllStructCreate("float x1;float y1;float x2;float y2;float x3;float y3;float x4;float y4;" & _ "float dx1;float dy1;float dx2;float dy2;float dx3;float dy3;float dx4;float dy4;" & _ "ptr bmp1;ptr bmp2;ptr bmp3;ptr bmp4") $tObj.bmp1 = _GDIPlus_ImageLoadFromFile($sImg1) $tObj.bmp2 = _GDIPlus_ImageLoadFromFile($sImg2) $tObj.bmp3 = _GDIPlus_ImageLoadFromFile($sImg3) $tObj.bmp4 = _GDIPlus_ImageLoadFromFile($sImg4) $tObj.x1 = ($iW - _GDIPlus_ImageGetWidth($tObj.bmp1)) / 2 $tObj.y1 = 60 $tObj.x2 = ($iW - _GDIPlus_ImageGetWidth($tObj.bmp2)) / 2 $tObj.y2 = 250 $tObj.x3 = 210 $tObj.y3 = 250 $tObj.x4 = $iW - _GDIPlus_ImageGetWidth($tObj.bmp4) - 300 $tObj.y4 = 430 Local $hFamily = _GDIPlus_FontFamilyCreate("Impact"), $hFont = _GDIPlus_FontCreate($hFamily, 120), $hFormat = _GDIPlus_StringFormatCreate(), _ $tLayout = _GDIPlus_RectFCreate(), $hBrush = _GDIPlus_BrushCreateSolid(0xD8FFFFFF), _ $hFamily_s = _GDIPlus_FontFamilyCreate("Palatino Linotype"), $hFont_s = _GDIPlus_FontCreate($hFamily_s, 24), _ $tLayout_s = _GDIPlus_RectFCreate($iW + 1, $iH - 44, $iW * 2, 50), $hBrush_s = _GDIPlus_BrushCreateSolid(0x2884898A) Local $aDim = _GDIPlus_GraphicsMeasureString($hCanvas, "Parallax", $hFont, $tLayout, $hFormat) Local $sScrollerTxt = "Parallax Effect ported to AutoIt by UEZ. Original idea and graphic concept by Fernando Cohen." Local $aDim2 = _GDIPlus_GraphicsMeasureString($hCanvas, $sScrollerTxt, $hFont_s, $tLayout_s, $hFormat) $tLayout.x = ($iW - $aDim[0].width) / 2 $tLayout.y = 190 Local $aMPos, $aDir[4][2] = [[16, 128], [32, 64], [64, 32], [128, 16]], $iDir = 0, _ $iPosX = GUIGetCursorInfo($hGUI)[0], $iPosY = GUIGetCursorInfo($hGUI)[1] GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit_About") AdlibRegister("CalcFPS", 1000) Local $fVx, $fVy, $fAcc = 0.925, $fVmax = 32 Do DllCall($__g_hGDIPDll, "int", "GdipFillRectangle", "handle", $hCanvas, "handle", $hBrush_Clr, "float", 0, "float", 0, _ "float", $iW, "float", $iH) ;erase canvas background $aMPos = GUIGetCursorInfo($hGUI) If ($iPosX <> $aMPos[0] Or $iPosY <> $aMPos[1]) And $aMPos[4] = $iLabel Then $fVx = $aMPos[0] - $iPosX $fVy = $aMPos[1] - $iPosY If $fVx < 0 Then $fVx = $fVx < -$fVmax ? -$fVmax : $fVx Else $fVx = $fVx > $fVmax ? $fVmax : $fVx EndIf If $fVy < 0 Then $fVy = $fVy < -$fVmax ? -$fVmax : $fVy Else $fVy = $fVy > $fVmax ? $fVmax : $fVy EndIf $tObj.dx1 = -$fVx / $aDir[0][$iDir] $tObj.dy1 = -$fVy / $aDir[0][$iDir] $tObj.dx2 = -$fVx / $aDir[1][$iDir] $tObj.dy2 = -$fVy / $aDir[1][$iDir] $tObj.dx3 = -$fVx / $aDir[2][$iDir] $tObj.dy3 = -$fVy / $aDir[2][$iDir] $tObj.dx4 = -$fVx / $aDir[3][$iDir] $tObj.dy4 = -$fVy / $aDir[3][$iDir] $tObj.x1 += $tObj.dx1 $tObj.y1 += $tObj.dy1 $tObj.x2 += $tObj.dx2 $tObj.y2 += $tObj.dy2 $tObj.x3 += $tObj.dx3 $tObj.y3 += $tObj.dy3 $tObj.x4 += $tObj.dx4 $tObj.y4 += $tObj.dy4 $iPosX = $aMPos[0] $iPosY = $aMPos[1] Else $tObj.dx1 *= $fAcc $tObj.dy1 *= $fAcc $tObj.dx2 *= $fAcc $tObj.dy2 *= $fAcc $tObj.dx3 *= $fAcc $tObj.dy3 *= $fAcc $tObj.dx4 *= $fAcc $tObj.dy4 *= $fAcc $tObj.x1 += $tObj.dx1 $tObj.y1 += $tObj.dy1 $tObj.x2 += $tObj.dx2 $tObj.y2 += $tObj.dy2 $tObj.x3 += $tObj.dx3 $tObj.y3 += $tObj.dy3 $tObj.x4 += $tObj.dx4 $tObj.y4 += $tObj.dy4 EndIf _GDIPlus_GraphicsDrawImage($hCanvas, $tObj.bmp1, $tObj.x1, $tObj.y1) _GDIPlus_GraphicsDrawStringEx($hCanvas, "Parallax", $hFont, $tLayout, $hFormat, $hBrush) _GDIPlus_GraphicsDrawImage($hCanvas, $tObj.bmp2, $tObj.x2, $tObj.y2) _GDIPlus_GraphicsDrawImage($hCanvas, $tObj.bmp3, $tObj.x3, $tObj.y3) _GDIPlus_GraphicsDrawImage($hCanvas, $tObj.bmp4, $tObj.x4, $tObj.y4) _GDIPlus_GraphicsDrawStringEx($hCanvas, $sScrollerTxt, $hFont_s, $tLayout_s, $hFormat, $hBrush_s) $tLayout_s.x -= 1.0 If $tLayout_s.x < -$aDim2[0].width Then $tLayout_s.x = $iW + 10 _GDIPlus_GraphicsDrawStringEx($hCanvas, "FPS: " & $iShowFPS, $hFont_FPS, $tLayout_FPS, $hFormat_FPS, $hBrush_FPS) ;draw background message text _WinAPI_BitBlt($hDC, 0, 0, $iW, $iH, $hDC_backbuffer, 0, 0, $SRCCOPY) ;blit drawn bitmap to GUI $iFPS += 1 If $bExit Then ExitLoop Until Not Sleep(10) AdlibUnRegister("CalcFPS") ;release resources _GDIPlus_ImageDispose($tObj.bmp1) _GDIPlus_ImageDispose($tObj.bmp2) _GDIPlus_ImageDispose($tObj.bmp3) _GDIPlus_ImageDispose($tObj.bmp4) _GDIPlus_StringFormatDispose($hFormat) _GDIPlus_BrushDispose($hBrush) _GDIPlus_FontDispose($hFont) _GDIPlus_FontFamilyDispose($hFamily) _GDIPlus_BrushDispose($hBrush_s) _GDIPlus_FontDispose($hFont_s) _GDIPlus_FontFamilyDispose($hFamily_s) _GDIPlus_FontFamilyDispose($hFamily_FPS) _GDIPlus_StringFormatDispose($hFormat_FPS) _GDIPlus_BrushDispose($hBrush_Clr) _GDIPlus_BrushDispose($hBrush_FPS) _GDIPlus_GraphicsDispose($hCanvas) _WinAPI_SelectObject($hDC_backbuffer, $DC_obj) _WinAPI_DeleteDC($hDC_backbuffer) _WinAPI_DeleteObject($hHBitmap) _WinAPI_ReleaseDC($hGUI, $hDC) GUIDelete($hGUI) EndFunc ;==>ParallaxFX Func _Exit_About() $bExit = True EndFunc ;==>_Exit_About Func CalcFPS() ;display FPS $iShowFPS = $iFPS $iFPS = 0 EndFunc ;==>CalcFPS
Die nötigen Bilder werden heruntergeladen und lokal in ScriptDir gespeichert.
Vorschau: