Timing of openCard with visual effect.

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10339
Joined: Wed May 06, 2009 2:28 pm

Timing of openCard with visual effect.

Post by dunbarx » Tue May 02, 2023 5:28 pm

Klaus has gone to the dark side. I will miss him.

He had asked on the use-list if an openCard message is sent before or after a visual effect runs its course. I made a stack with two cards. On card 1, a button with:

Code: Select all

global tStartTime

on mouseUp
   put the ticks into tStartTime
   visual effect "checkerBoard" 
   go cd 2
end mouseUp
On the card 2 script:

Code: Select all

global tStartTime

on openCard
   put the ticks -  tStartTime into fld 2
end openCard
I get about 44 ticks in field 2

If I instead use "preOpenCard" I always get 0 ticks. So "openCard" is sent after the visual effect finishes. I find this counterintuitive, but at least the fact should be somewhere in the dictionary, best in the "visual effect" page.

Craig

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10339
Joined: Wed May 06, 2009 2:28 pm

Re: Timing of openCard with visual effect.

Post by dunbarx » Tue May 02, 2023 5:41 pm

I generally dislike the message watcher, mainly because we still cannot filter for ONLY messages we want. This has been discussed and forgotten.

Anyway, if the message watcher is open when one clicks the button on card 1, the watcher records "mouseUp", navigation occurs and one can see the change to card 2 and then the visual effect. But only after that effect finishes does the watcher record "openCard".

Klaus, I think that about does it.

Craig

Klaus
Posts: 14206
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Timing of openCard with visual effect.

Post by Klaus » Tue May 02, 2023 5:49 pm

Klaus has gone to the dark side. I will miss him.
Oh, Craig, I'm not your father! :-D

And do you think that a "normal" visual effect only takes 44 ticks?
Please set the effectrate and try again with a "very slow" effect, so you know how much that should take.

There is also much more that I posted on the mailing list, you should add this here for further thoughts... 8)

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10339
Joined: Wed May 06, 2009 2:28 pm

Re: Timing of openCard with visual effect.

Post by dunbarx » Tue May 02, 2023 6:33 pm

Klaus.

"Very Slow" took 123 ticks. Things become clearer when going "very slow".

Watching this it seems that the process takes about 2 seconds (125 ticks). but the card seems to change from card 1 to card 2 right away, as you can see because the red graphic (which is only on cd 2) appears right away.

Craig
navwith effects.livecode.zip
(1.23 KiB) Downloaded 140 times

Klaus
Posts: 14206
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Timing of openCard with visual effect.

Post by Klaus » Tue May 02, 2023 6:39 pm

What did you set for -> the effectrate? And please use millisecs, that is more precise.
but the card seems to change from card 1 to card 2 right away, as you can see because the red graphic (which is only on cd 2) appears right away.
Sorry, Craig, "seems" and my eyes are not precise enough, I already tried this.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10339
Joined: Wed May 06, 2009 2:28 pm

Re: Timing of openCard with visual effect.

Post by dunbarx » Tue May 02, 2023 7:03 pm

Klaus.

If I set the effectRate to, say "1000", or 200 or 2000, it still shows that the navigation occurs right away, then the effect runs, and then a tick value appears in fld 2 of cd 2.

Craig

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10339
Joined: Wed May 06, 2009 2:28 pm

Re: Timing of openCard with visual effect.

Post by dunbarx » Tue May 02, 2023 7:09 pm

Klaus.

I do not quite see how the effectRate and the various "speed" parameters associated with the visual effects themselves interact, but they certainly do. But the strict sequence of events does not seem to alter. To me it appears that the "openCard' message is sent after the visual effect terminates.

Other opinions, anyone?

Craig

Klaus
Posts: 14206
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Timing of openCard with visual effect.

Post by Klaus » Tue May 02, 2023 10:04 pm

Hi Craig,
dunbarx wrote:
Tue May 02, 2023 7:03 pm
Klaus.

If I set the effectRate to, say "1000", or 200 or 2000, it still shows that the navigation occurs right away, then the effect runs, and then a tick value appears in fld 2 of cd 2.

Craig
the effectrate only works when using the VERY SLOW*** option with a visual effect

Code: Select all

...
## half a second
set the effectrate to 500
lock screen for visual effect
go next cd
unlock screen with visual wipe left very slow
## Et voilà, half a second :-)
## more or less...
...
*** I find this mentally very challenging! :-D :-D :-D

Post Reply