Looming pictures

David McFarlane mcfarla9 at msu.edu
Thu Jun 17 19:15:44 UTC 2010


Craig,

When I want to manipulate the size of images 
(either an ImageDisplay or a SlideImage on a Slide), I do the following:

- Open the property pages for the image.  On the 
General tab, set Stretch to Yes.  On the Frame 
tab, enter attribute references for Width and 
Height (e.g., [StimWidth], [StimHeight]).

- On the User tab of the Script window, add a 
global variable to hold the latest value of width 
& height (see Chapter 4 of the User Guide that 
came with E-Prime).  E.g. (note that variables 
and attributes may use the same name with no 
conflict, as long as you can keep track of which is which),

Dim  StimHeight as Single, StimWidth as Single

- In inline code before the image object, update 
the width & height as needed and use c.SetAttrib 
to set the attribute values for use.  You may use 
units of either % or pixels, as you like.  E.g.,

' Magnify geometrically (i.e., constant factor)...
Const  ImageFactor as Single = 1.5  ' might instead make this global
StimHeight = StimHeight * ImageFactor
StimWidth = StimWidth * ImageFactor
c.SetAttrib "StimHeight", StimHeight
c.SetAttrib "StimWidth", StimWidth

or

' Increment arithmetically...
Const  ImageIncrement as Integer = 50  ' might instead make this global
StimHeight = StimHeight + ImageIncrement
StimWidth = StimWidth + ImageIncrement
c.SetAttrib "StimHeight", StimHeight
c.SetAttrib "StimWidth", StimWidth

You would still have to wrap these in the 
appropriate If...Then...Else clauses, etc.


I think this makes the code more manageable, 
although there are probably methods with better 
performance if you don't mind more code.

-- David McFarlane, Professional Faultfinder


At 6/17/2010 01:02 PM Thursday, you wrote:
>Hiya all,
>Not sure whether this has been said already, but 
>one of the questions was regarding polling the 
>direction of joystick presses. I do know someone 
>else asked this question not too long ago, and 
>also went to e-prime support to ask this. The answer, apparently, was this:
>
>-------------
>From: e-prime at googlegroups.com 
>[mailto:e-prime at googlegroups.com] On Behalf Of Nick
>Sent: 04 February 2010 22:10
>To: E-Prime
>Subject: Re: Joystick direction as response & RT
>
>Hi All,
>
>Below is the great solution I received from E-Prime support.  Does
>exactly what I need it to, I hope it helps others as well.
>
>If you do not want subjects to press a button after moving the
>joystick to the desired position, you can simply access the cursor
>position directly instead of checking for a button press. This means
>that you should set the Duration of Stimulus to zero so that the
>script can be processed immediately; for an example of this method,
>please see SAMPLE:Process Responses Template. By constantly checking
>the Y position of the cursor, you can determine whether the subject
>has responded. Here is an example of the script to use:
>
>Dim nInitY As Integer
>Dim nCurrentY As Integer
>Dim nDiff As Integer
>
>nInitY = Joystick.CursorY
>
>Do
>    nCurrentY = Joystick.CursorY
>    nDiff = nInitY - nCurrentY
>
>Loop Until Abs(nDiff) > 50
>
>Stimulus.RTTime = Clock.Read
>Stimulus.RT = Stimulus.RTTime - Stimulus.OnsetTime
>
>If nDiff > 0 Then
>    Stimulus.RESP = "Up"
>Else
>    Stimulus.RESP = "Down"
>End If
>-----------------------
>
>
>
>Michiel Spapé
>Research Fellow
>Perception & Action group
>University of Nottingham
>School of Psychology
>
>
>-----Original Message-----
>From: e-prime at googlegroups.com 
>[mailto:e-prime at googlegroups.com] On Behalf Of gilis
>Sent: 17 June 2010 11:55
>To: E-Prime
>Subject: Re: Looming pictures
>
>Never tried to do something like this, but it seems that if the
>picture size is increasing or decreasing in constant rate for each
>pull, then you have to build set of stimuli with the different
>possible sizes (a lot of work, there is possibly much easier way if
>you have the time and knowledge to program it all into inline that
>change the size of given pictures in accordance with its present size
>and the direction in which the joystick was pulled) for each picture.
>
>Then, you name each stimulus x as x&"y", with y representing number in
>a given direction. Say that if subject pull the joystick six times in
>one direction then y=6 and the size of the stimulus is corresponding
>to that. Y=0 stand for the stimuli initial size and numbers preceded
>by "-", for instance, represent the number of pullings in the opposite
>dierction.Then, if the subject pulled the joystick in the positive
>numbers direction three times (y=3) and then in the following trial
>pulled it in the negative numbers direction you set the Y attrbiute to
>Y-1, or to Y+1 in the opposite case. You always have to update your
>programe after each trial what is the value of Y.
>
>You do that by setting an attribute called y (c.setattrib "Y", 0+z),
>with z dimmed as integer. You have to tell your computer that z=1 in
>case of pulling in one direction and -1 in the other direction.
>
>It's only on the surface of the things, and it may be that I'm over
>simplfying them, but I think this is a start.
>
>Rgds
>Gilis
>
>On Jun 15, 8:05 pm, Craig <cmark... at gmail.com> wrote:
> > Hello,
> >  I am trying to program a task in which there are looming pictures
> > that change depending on the person's response with the joystick.  I
> > am currently trying to program an experiment in which pictures are
> > presented on the screen, and participants are required to push or pull
> > a joystick and squeeze the trigger based on the color of the
> > background (e.g., a blue background means push the joystick away).
> > When the joystick is pushed, the image size needs to gradually
> > decrease (to strengthen the feeling that the picture is pushed
> > away). When the joystick is pulled, the image size should increase.
> >
> > I am using E-prime version 2.0. Professional.  I found a similar
> > question on the list, but I didn't see an answer.
> >
> > I was wondering whether:
> > 1) anyone has programmed a looming task where pictures get bigger or
> > smaller (I think I need to use the Object Slide, but I am not so sure
> > how to do it)
> > and
> > 2) whether anyone has programmed a task where pressing a joystick in a
> > particular direction and squeezing the trigger causes a picture to
> > change (i.e.,  how can I collect joystick-movement-data and how I can
> > subsequently use this information to present the next picture.).
> >   Thanks so much in advance.
> > Craig

-- 
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