How to fade from slide1 to slide2 (inline?)

liwenna liwenna at gmail.com
Tue Apr 19 13:06:21 UTC 2011


Michiel, I was planning on suggesting exactly that :)

Although I'd like to propose doing it without a list and with a single
proc that switches back and forth to show the same slide over again
with the necessary variables modified... it's about as easy and gives
less mess in the edat files...  I did this for a moving object,
inspired by your example, only a week ago... :)

I can't test this idea right now for I don't have e-prime where I am,
but you could try these steps:

First off.. try this in a new and experiment/e-studiofile, you can add
all the other elements of your task once you got the fading working.

Your experiment file (blank! not basic...) shows you a sessionproc. On
the sessionproc add a list, call it triallist for instance, and
associate a procedure by typing the desired name of the procedure
(trialproc?) into the column 'procedure'. You could make several
levels, but for now a single level will also suffice.

At the beginning of the trialprocedure place an inline with the
following code  (copy/paste everything between ****'s. The lines that
start wat a '  should colour green in e-prime, they are comments, not
code... if e-prime breaks up the sentences differently and part of the
comments do show up in black, blue or orange font, then add ' s  at
the beginning of each line that is not code, so that they turn green):

****************
'create all the variables you'll need:
dim r as integer
dim g as integer
dim b as integer
dim vr as string
dim vb as string
dim vg as string
dim stepcounter as integer

'assign value 255 to the red green and blue channels, rgb 255,255,255
is white
r=255
b=255
g=255

'map the integer values of r, g, and b onto the string variables vr,
vb and vg (there is probably a far better way to do this, but I don't
know how)
vr$= r
vb$= b
vg$= g

'use the string rgb variables to modify the backgroundcolor of the
textobject
'this is the line that I am most unsecure about and as said can't test
it right now.... It assumes a slide text subobject (so.. the textbox
on your slide) to be called text1, which 'afaik is the default setting
for the first textbox you place on the slide, text2 for the next etc.
if you didn't change these names this might work... also might not...
I'll test it 'myself tomorrow. I could not find the proper code
anywhere and I kinda wonder how the program would know what text1 on
which slide to manipulate...
text1.BackColor = CColor (""& vr$ &","& vg$ &","& vb$ &"")

*****************

Now after this inline place your slide and put a textbox on it (which
will likely be named text1 by default).
In this example I'll try to change the color from white to red in 51
steps... each phase (52, including the starting phase) will then be
shown for the duration of the slide... say that you want the
transition to take about 1,5 second... then each phase shoudl be shown
for 1500/52 = 28,8 ms... this is impossible so for now set the
duration of the slide to 29ms, which probably won't work exactly as
well timed as one would want, but let's focus on the fading first....

Directly after the slide place another inline with the following code:

******************
'first the values of green and blue will be decreased by 5 points, we
started at 255,255,255 and this way after 51 repeats we will end at
255,0,0, which is pure red
r = r
g = g - 5
b = b - b

'map the integer values of rgb onto the string variables of rgb
vr$= r
vb$= b
vg$= g

'assign the new value to text1.backcolor
Text1.BackColor = CColor (""& vr$ &","& vg$ &","& vb$ &"")

'stepcounter keeps track of the number of times the above code is
executed, after the 52 step the fading is done and the values of g and
b will actually be negative (-5) so
'it's time to stop the sequence and move on... for that place a label
after this inline (on the same procedure!), that you call endlabel, at
step 52 the program will continue at 'that label.
stepcounter = stepcounter + 1
if stepcounter = 52 then goto endlabel

'if however the fading is completed yet, the program should return
back and show the same slide again, but now with the new values of RGB
that were modified in the 'above lines. For that place a label
inbetween the first inline and the slide. This label should be called
againlabel.
if stepcounter < 52 then goto againlabel
************


I think... that if you run the little program that you just created,
you should see some fading happening.... :)  although things kinda
depend on the line "Text1.BackColor = ..." that I am fairly unsure
about :/


best,

liw


On Apr 19, 12:53 pm, Michiel Spape <Michiel.Sp... at nottingham.ac.uk>
wrote:
> Hiya,
> Sounds like a nice paradigm!
> ... however, fading, much like movement, is not all that easy in E-Prime, though it can be done. For a nice example, see the E-Primer thingy (on my website, about me, underneath everything else - it takes some time to download) in which you learn, somewhere, to make a box move. Knowing that, you can do the same, but then with the colour.
> So, one, you realise that colours in E-Prime are represented as 3 bytes (i.e. 3 values between 0 and 255) in RGB (redgreenblue) space. Thus, from Red (255, 0, 0) to Blue (0,0,255), should be possible by going linearly from 255->0 on the first (red) dimension, and 0->255 on the third (blue) dimension - passing, for instance, somewhere along the way 128,0,128 (purple).
> Knowing that, you could do all this neatly using a little list in between your stimuli to do the whole fading. The list can then have an exit-time of exactly the amount of time you wish to spend fading. Inside the list is the simple procedure with a slide taking, say, 15 ms, and then you change the colour attributes just before every time the slide is shown. For instance, if the slide would have a text display showing [name], in forecolour being [colour], you could simply change the attribute as long as you know:
> - How much time has passed since beginning of the fading?
> - How long should the slide take?
> - What's the begin colour?
> - What's the end colour?
> Then, you could simply linearly interpolate between colours and set the [colour] accordingly.
>
> Well, there are quite a few ways to go about this, but none, as far as I can see, for a first-time E-Prime user exactly simple. As for pixel-by-pixel fading, you could do that... but it will take some canvas programming. More difficult than the above.
> Best,
> Mich
>
> Michiel Spapé
> Research Fellow
> Perception & Action group
> University of Nottingham
> School of Psychologywww.cognitology.eu
>
> -----Original Message-----
> From: e-prime at googlegroups.com [mailto:e-prime at googlegroups.com] On Behalf Of miamalika
> Sent: 19 April 2011 11:32
> To: E-Prime
> Subject: How to fade from slide1 to slide2 (inline?)
>
> Hey there!
>
> I have a problem. I want to create a Stroop imagery task which
> functions as following: first, a color NAME is presented and the
> subjects have to imagine that color in a following box (white text
> frame in a slide). Then, a second slide is presented (same text frame
> in a slide) but with a back color varying.
>
> Now I want a gradual change between the white empty text box and the
> colored text box so that the colors appear to "fade in".
>
> How can I do this? I'm pretty new to e-prime so it should be an easy
> solution..
>
> I also thought about fading a picture in pixel by pixel or to have the
> brightness of 1 slide gradually changing from white to the color.
>
> What appears best to you? How could I do this?
>
> Thank you and best regards
> Mia
>
> --
> You received this message because you are subscribed to the Google Groups "E-Prime" group.
> To post to this group, send email to e-prime at googlegroups.com.
> To unsubscribe from this group, send email to e-prime+unsubscribe at googlegroups.com.
> For more options, visit this group athttp://groups.google.com/group/e-prime?hl=en.
>
> This message and any attachment are intended solely for the addressee and may contain confidential information. If you have received this message in error, please send it back to me, and immediately delete it.   Please do not use, copy or disclose the information contained in this message or in any attachment.  Any views or opinions expressed by the author of this email do not necessarily reflect the views of the University of Nottingham.
>
> This message has been checked for viruses but the contents of an attachment
> may still contain software viruses which could damage your computer system:
> you are advised to perform your own checks. Email communications with the
> University of Nottingham may be monitored as permitted by UK legislation.

-- 
You received this message because you are subscribed to the Google Groups "E-Prime" group.
To post to this group, send email to e-prime at googlegroups.com.
To unsubscribe from this group, send email to e-prime+unsubscribe at googlegroups.com.
For more options, visit this group at http://groups.google.com/group/e-prime?hl=en.



More information about the Eprime mailing list