Naming the speed of visual effects with variables

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
Fermin
Posts: 149
Joined: Fri Jun 05, 2015 10:44 pm

Naming the speed of visual effects with variables

Post by Fermin » Mon Jul 25, 2016 11:00 am

Hi. Please,

Is there a way to invoke the speed of visual effects ("very fast", "fast", "slow", "very slow") with a variable?

Code: Select all

put "zoom out" into nameVF
put "very slow" into velVF
--
unlock screen with visual effect nameVF very slow -- Works fine
unlock screen with visual effect nameVF velVF -- It does not work
Thank you very much

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: Naming the speed of visual effects with variables

Post by jmburnod » Mon Jul 25, 2016 1:08 pm

Hi Fermin,
It seems "do" way works

Code: Select all

put "zoom out" into nameVF
put "very slow" into velVF
do "unlock screen with visual effect" && nameVF && velVF
Best regards
Jean-Marc
https://alternatic.ch

SparkOut
Posts: 2947
Joined: Sun Sep 23, 2007 4:58 pm

Re: Naming the speed of visual effects with variables

Post by SparkOut » Mon Jul 25, 2016 1:24 pm

You don't need to "do" it if you resolve the name and speed to one argument for the effect:

Code: Select all

unlock screen with visual effect (nameVF && velVF)

Fermin
Posts: 149
Joined: Fri Jun 05, 2015 10:44 pm

Re: Naming the speed of visual effects with variables

Post by Fermin » Mon Jul 25, 2016 7:18 pm

It works very well. Thank you very much.
It would be great if instead of those words (slow, very slow, etc) could use a numeric value but I guess LiveCode not allow that.
Anyway, I say thank you both.

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

Re: Naming the speed of visual effects with variables

Post by Klaus » Mon Jul 25, 2016 7:50 pm

Hi Fermin,
Fermin wrote:It works very well. Thank you very much.
It would be great if instead of those words (slow, very slow, etc) could use a numeric value but I guess LiveCode not allow that.
Anyway, I say thank you both.
LC DOES in fact allow this, check "the effectrate" in the dictionary.

This manages the exact time in millisecs that a "very slow" effect will take!
Yes, the "very slow" effect, which is a bit mentally challenging :D

Code: Select all

...
lock screen
## We want a duration for our visual effect of 300 millisecs
set the effectrate to 300

## Or whatever should happen with a visual effect
show img "an image"
unlock screen with visual dissolve very slow
...
Best

Klaus

Fermin
Posts: 149
Joined: Fri Jun 05, 2015 10:44 pm

Re: Naming the speed of visual effects with variables

Post by Fermin » Mon Jul 25, 2016 9:26 pm

Great, Klaus, is exactly what I need. I had not noticed that in the manual. Thank you very much.

Post Reply