Func LayeredPB_Skin_CometOrbital()
Local $fK = 1.0
Static $iBaseW = 400, $iBaseH = 400
_LayeredPB_ResizeCanvas($iBaseW * $fK, $iBaseH * $fK)
_GDIPlus_GraphicsClear($hL_Graphics, 0x00000000)
_GDIPlus_GraphicsSetSmoothingMode($hL_Graphics, 4)
; --- 1. ПАРАМЕТРЫ ---
Local $fOrbit = 120 * $fK
Local $iRadius = 15 * $fK
Static $iTailLength = 30
Static $aHistory[$iTailLength][2]
; Таймер для независимого обновления хвоста
Static $hTailTimer = 0
If $hTailTimer = 0 Then $hTailTimer = TimerInit()
; Угол привязан к прогрессу
Local $fAngle = ($fL_Progress / 100) * 6.2831853 - 1.5707963
Local $fX = ($iL_W / 2) + $fOrbit * Cos($fAngle)
Local $fY = ($iL_H / 2) + $fOrbit * Sin($fAngle)
; --- 2. ЛОГИКА "УМНОГО" ХВОСТА ---
; Если прошло больше 30 мс, мы сдвигаем хвост, даже если $fL_Progress стоит на месте!
If TimerDiff($hTailTimer) >= 30 Then
For $i = $iTailLength - 1 To 1 Step -1
$aHistory[$i][0] = $aHistory[$i - 1][0]
$aHistory[$i][1] = $aHistory[$i - 1][1]
Next
$aHistory[0][0] = $fX
$aHistory[0][1] = $fY
$hTailTimer = TimerInit() ; Сбрасываем таймер
EndIf
; --- 3. РИСОВАНИЕ ХВОСТА ---
Local $hBrush
For $i = $iTailLength - 1 To 0 Step -1
If $aHistory[$i][0] = 0 Then ContinueLoop
Local $iAlpha = Int(255 * (1 - ($i / $iTailLength)))
$hBrush = _GDIPlus_BrushCreateSolid("0x" & Hex($iAlpha, 2) & "00BFFF")
Local $iCurR = $iRadius * (1 - ($i / $iTailLength) * 0.8)
_GDIPlus_GraphicsFillEllipse($hL_Graphics, $aHistory[$i][0] - $iCurR, $aHistory[$i][1] - $iCurR, $iCurR * 2, $iCurR * 2, $hBrush)
_GDIPlus_BrushDispose($hBrush)
Next
; --- 4. ВСПОМОГАТЕЛЬНАЯ ОРБИТА ---
Local $hPenOrbit = _GDIPlus_PenCreate(0x3300BFFF, 2 * $fK)
_GDIPlus_GraphicsDrawEllipse($hL_Graphics, ($iL_W / 2) - $fOrbit, ($iL_H / 2) - $fOrbit, $fOrbit * 2, $fOrbit * 2, $hPenOrbit)
_GDIPlus_PenDispose($hPenOrbit)
; --- 5. ТЕКСТ ПРОЦЕНТОВ ---
Local $hFamily = _GDIPlus_FontFamilyCreate("Segoe UI")
Local $hFont = _GDIPlus_FontCreate($hFamily, 40 * $fK, 1)
Local $hFormat = _GDIPlus_StringFormatCreate()
_GDIPlus_StringFormatSetAlign($hFormat, 1)
_GDIPlus_StringFormatSetLineAlign($hFormat, 1)
Local $hBrushT = _GDIPlus_BrushCreateSolid(0xFF00BFFF)
Local $tRect = _GDIPlus_RectFCreate(0, 0, $iL_W, $iL_H)
_GDIPlus_GraphicsDrawStringEx($hL_Graphics, Int($fL_Progress) & "%", $hFont, $tRect, $hFormat, $hBrushT)
; ОЧИСТКА ТЕКСТОВЫХ РЕСУРСОВ
_GDIPlus_BrushDispose($hBrushT)
_GDIPlus_StringFormatDispose($hFormat)
_GDIPlus_FontDispose($hFont)
_GDIPlus_FontFamilyDispose($hFamily)
_LayeredPB_Update()
EndFunc