after seeing andybiochem's topic about the elastic radio buttons following the mouse pointer i decided to create something for my GF using this func for valentine's day
HAPPY VALENTINE DAY
ok now to test this u will have to save the script then save the PNGs to a folder named "Set" in the script directory
and it should look like this :

;====== Elastic Trail script ====== ; Original Javascript by Philip Winston - pwinston@yahoo.com ; Adapted for AutoIT by AndyBiochem ; Used with GDI+ for PNG's by yehia #include <WindowsConstants.au3> #include <GuiConstantsEx.au3> #include <GDIPlus.au3> ;----- Variables ----- Global $iDots = 7 ;..... Number of PNGs Global $aDots[$iDots][5] ;..... PNGs array Global $iXpos = 0 Global $iYpos = 0 Global $iDeltaT = 0.01 Global $iSegLen = 10 Global $iSpringK = 10 Global $iMass = 1 Global $iXGravity = 0 Global $iYGravity = 50 Global $iRes = 10 Global $iStopVel = 0.1 Global $iStopAcc = 0.1 Global $iDotSize = 25 Global $iBounce = 0.75 Global Const $AC_SRC_ALPHA = 1 Global $iHeight = @DesktopHeight Global $iWidth = @DesktopWidth ;----- 'PNGs' ----- Myname() ; just my name on the back :P For $i = 1 To ($iDots - 1) $iDotSize-=2 $aDots[$i][0] = GUICreate("", $iDotSize, $iDotSize, 144, 160, $WS_POPUP , $WS_EX_LAYERED + $WS_EX_TOOLWINDOW+$WS_EX_TOPMOST) _GDIPlus_Startup() $hImage = _GDIPlus_ImageLoadFromFile(@ScriptDir &"\Set\" &$i& ".png") SetBitMap($aDots[$i][0] , $hImage, 255) GUISetState(@SW_SHOW) Next ;############### LOOP ############### While 1 Sleep(10) $m = MouseGetPos() $iXpos = $m[0] $iYpos = $m[1] _Animate() WEnd ;#################################### Func _Animate() $aDots[0][1] = $iXpos $aDots[0][2] = $iYpos For $i = 1 To ($iDots - 1) Local $spring[3] $spring[1] = 0 $spring[2] = 0 _Spring_Force($i - 1, $i, $spring) If $i < ($iDots - 1) Then _Spring_Force($i + 1, $i, $spring) Local $resist[3] $resist[1] = -$aDots[$i][3] * $iRes $resist[2] = -$aDots[$i][4] * $iRes Local $accel[3] $accel[1] = ($spring[1] + $resist[1]) / $iMass + $iXGravity $accel[2] = ($spring[2] + $resist[2]) / $iMass + $iYGravity $aDots[$i][3] += ($iDeltaT * $accel[1]) $aDots[$i][4] += ($iDeltaT * $accel[2]) If Abs($aDots[$i][3]) < $iStopVel And Abs($aDots[$i][4]) < $iStopVel And Abs($accel[1]) < $iStopAcc And Abs($accel[2]) < $iStopAcc Then $aDots[$i][3] = 0 $aDots[$i][4] = 0 EndIf $aDots[$i][1] += $aDots[$i][3] $aDots[$i][2] += $aDots[$i][4] If ($aDots[$i][2] < 0) Then If ($aDots[$i][4] < 0) Then $aDots[$i][4] = $iBounce * - $aDots[$i][4] $aDots[$i][2] = 0 EndIf If ($aDots[$i][2] >= $iHeight - $iDotSize - 1) Then If ($aDots[$i][4] > 0) Then $aDots[$i][4] = $iBounce * - $aDots[$i][4] $aDots[$i][2] = $iHeight - $iDotSize - 1 EndIf If ($aDots[$i][1] >= $iWidth - $iDotSize) Then If ($aDots[$i][3] > 0) Then $aDots[$i][3] = $iBounce * - $aDots[$i][3] $aDots[$i][1] = $iWidth - $iDotSize - 1 EndIf If ($aDots[$i][1] < 0) Then If ($aDots[$i][3] < 0) Then $aDots[$i][3] = $iBounce * - $aDots[$i][3] $aDots[$i][1] = 0 EndIf WinMove($aDots[$i][0], "", $aDots[$i][1], $aDots[$i][2]) Next EndFunc ;==>_Animate Func _Spring_Force($i, $j, ByRef $spring) Local $springF $dx = $aDots[$i][1] - $aDots[$j][1] $dy = $aDots[$i][2] - $aDots[$j][2] $len = Sqrt($dx ^ 2 + $dy ^ 2) If Not ($len > $iSegLen) Then Return $springF = $iSpringK * ($len - $iSegLen) $spring[1] += ($dx / $len) * $springF $spring[2] += ($dy / $len) * $springF EndFunc ;==>_Spring_Force Func SetBitmap($hGUI, $hImage, $iOpacity) Local $hScrDC, $hMemDC, $hBitmap, $hOld, $pSize, $tSize, $pSource, $tSource, $pBlend, $tBlend $hScrDC = _WinAPI_GetDC(0) $hMemDC = _WinAPI_CreateCompatibleDC($hScrDC) $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) $hOld = _WinAPI_SelectObject($hMemDC, $hBitmap) $tSize = DllStructCreate($tagSIZE) $pSize = DllStructGetPtr($tSize ) DllStructSetData($tSize, "X", _GDIPlus_ImageGetWidth ($hImage)) DllStructSetData($tSize, "Y", _GDIPlus_ImageGetHeight($hImage)) $tSource = DllStructCreate($tagPOINT) $pSource = DllStructGetPtr($tSource) $tBlend = DllStructCreate($tagBLENDFUNCTION) $pBlend = DllStructGetPtr($tBlend) DllStructSetData($tBlend, "Alpha" , $iOpacity ) DllStructSetData($tBlend, "Format", $AC_SRC_ALPHA) _WinAPI_UpdateLayeredWindow($hGUI, $hScrDC, 0, $pSize, $hMemDC, $pSource, 0, $pBlend, $ULW_ALPHA) _WinAPI_ReleaseDC (0, $hScrDC) _WinAPI_SelectObject($hMemDC, $hOld) _WinAPI_DeleteObject($hBitmap) _WinAPI_DeleteDC ($hMemDC) EndFunc ;==>SetBitmap Func Myname() $yGUI = GUICreate("", 200, 120, (@DesktopWidth/2)-100, (@DesktopHeight/2)-60, $WS_POPUP , $WS_EX_LAYERED + $WS_EX_TOOLWINDOW+$WS_EX_TOPMOST) _GDIPlus_Startup() $yImage = _GDIPlus_ImageLoadFromFile(@ScriptDir &"\Set\y.png") SetBitMap($yGUI , $yImage, 255) GUISetState(@SW_SHOW) EndFunc ;==>Myname
NOW the PNGs, download this rar file attached put it in the script directory and bam u got it
HAPPY VALENTINE again
credit goes to andybiochem first then me, i just created the GDI part
Edit : spelling
Attached Files
Edited by yehia, 20 February 2009 - 08:21 AM.








