Jump to content

Slide transition effect with millisecond


cramaboule
 Share

Recommended Posts

Hello all,

Here is an update of this topic:

I did the transition based on a real time input. Thus, if you put 200ms the transition will be made in reel 200ms (+~10ms on my PC)

From my first post (see link) just replace:

For $a = 0 To 254 Step $speed
   WinSetTrans($hGDI[$d], "", $a)
   Sleep($delay)
Next

by:

$ms = 200 ; set your time (ms)
$step = $ms/255
$TimerInit=TimerInit()
$i=1
$p = 1
$Diff=$step
$TimerInit2=TimerInit()
While 1
   If $i > 254 Then ExitLoop
   If $Diff >= $step And $p And $i < 256 Then
      WinSetTrans($hGDI[$d], "", int($i))
      $i += 1
      $TimerInit=TimerInit()
      $p = 0
   Else
      Do
         $Diff=TimerDiff($TimerInit)
      Until $Diff >= $step
      $p=1
   EndIf
WEnd
$Diff2=TimerDiff($TimerInit2)
ConsoleWrite("+ "&$Diff2 & @LF)

Of course you won't need $speed and $delay.

I wonder if it is working nice on your PC as well ?

Cramaboule

Link to comment
Share on other sites

Arrr I wonder why sometimes I make things more complicated than it appears....

$ms = 1000 ; set your time (ms)
$step = $ms/255
$TimerInit=TimerInit()
$Diff=$step
$TimerInit2=TimerInit()
For $i = 1 To 255
   WinSetTrans($hGDI[$d], "", $i)
   $TimerInit=TimerInit()
   Do
      $Diff=TimerDiff($TimerInit)
   Until $Diff >= $step
Next
$Diff2=TimerDiff($TimerInit2)
ConsoleWrite("+ "&$Diff2 & @LF)
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

×
×
  • Create New...