Hi,
ich habe dank UEZ's Vorlagen ein Skript erstellen können, dass die Mausbewegung nachzeichnet und nach einer bestimmten Zeitspanne nach und nach ausblendet.
Leider sind die nachgezeichneten Linien nicht wirklich rund bzw. 'flüssig' und meine Mathekenntnisse sind beschränkt, da ich wohl sonst sowas wie Splines probieren würde.
Wie kann man die beabsichtigten Kurven wirklich rund machen?
Zudem komme ich beim Ausführen auf genau 85 gezeichnete Linien, kann man das noch beschleunigen, sodass da noch mehr geht?
Die Anzahl der Linien wird im Titel angezeigt, bzw. in $time[0] gespeichert.
Hier das Skript:
Spoiler anzeigen
#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>
#include <Array.au3>
Opt("MustDeclareVars", 1)
Opt("GUIOnEventMode", 1)
Global Const $Width = 700
Global Const $Height = 700
Global $hGUI, $hWnd, $hGraphic, $ParticleBitmap, $ParticleBuffer, $Pen
Global $ParticlesX[1]
Global $ParticlesY[1]
$ParticlesX[0] = 0
$ParticlesY[0] = 0
Global $Time[1], $Pos
; Create GUI
$hGUI = GUICreate("Fading Polygon by XovoxKingdom - #Polygon = 0", $Width, $Height)
$hWnd = WinGetHandle($hGUI)
GUISetState()
_GDIPlus_Startup()
$hGraphic = _GDIPlus_GraphicsCreateFromHWND($hWnd)
$ParticleBitmap = _GDIPlus_BitmapCreateFromGraphics($Width, $Height, $hGraphic)
$ParticleBuffer = _GDIPlus_ImageGetGraphicsContext($ParticleBitmap)
_GDIPlus_GraphicsSetSmoothingMode($ParticleBuffer,4)
_GDIPlus_GraphicsClear($ParticleBuffer) ;clear buffer
GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
; Loop until user exits
Do
_GDIPlus_GraphicsClear($ParticleBuffer, 0xCF000000) ;clear buffer
$Pos = GUIGetCursorInfo()
If IsArray($Pos) Then
_ArrayAdd($ParticlesX, $Pos[0])
_ArrayAdd($ParticlesY, $Pos[1])
_ArrayAdd($Time, 255)
$Time[0] += 1
EndIf
For $i = $Time[0] To 1 Step -1
If $Time[$i] = 0 Then
_ArrayDelete($Time, $i)
_ArrayDelete($ParticlesX, $i)
_ArrayDelete($ParticlesY, $i)
$Time[0] -= 1
EndIf
Next
For $i = 1 To $Time[0]
$Pen = _GDIPlus_PenCreate("0x" & Hex($Time[$i], 2) & "FFFFFF", 1)
If $Time[0] = 1 Then
_GDIPlus_GraphicsDrawRect($ParticleBuffer, $ParticlesX[$i], $ParticlesY[$i], 1, 1, $Pen)
ElseIf $i < $Time[0] Then
_GDIPlus_GraphicsDrawLine($ParticleBuffer, $ParticlesX[$i], $ParticlesY[$i], $ParticlesX[$i + 1], $ParticlesY[$i + 1], $Pen)
Else
_GDIPlus_GraphicsDrawRect($ParticleBuffer, $ParticlesX[$i], $ParticlesY[$i], 1, 1, $Pen)
EndIf
_GDIPlus_PenDispose($Pen)
$Time[$i] -= 3
Next
_GDIPlus_GraphicsDrawImageRect($hGraphic, $ParticleBitmap, 0, 0, $Width, $Height) ;copy to bitmap
[/autoit] [autoit][/autoit] [autoit]WinSetTitle($hGUI, "", "Fading Polygon by XovoxKingdom - #Polygon = " & $Time[0])
[/autoit] [autoit][/autoit] [autoit]Until Not True
[/autoit] [autoit][/autoit] [autoit]Func _Exit()
; Clean up resources
_GDIPlus_GraphicsDispose($hGraphic)
_GDIPlus_BitmapDispose($ParticleBitmap)
_GDIPlus_GraphicsDispose($ParticleBuffer)
_GDIPlus_Shutdown()
Exit
EndFunc ;==>_Exit