Millisecond Forums

Zooming in and out of a picture

https://forums.millisecond.com/Topic25473.aspx

By newbie - 9/2/2018

Hello.

I'm using an evaluative conditioning paradigm and I'd like the pictures to have the appearance of either being zoomed in and out on based on the participants response.
I've managed to achieve something similar just by making the picture reappear in a different size, but could someone help with the zoom feature?
By Dave - 9/3/2018

newbie - Monday, September 3, 2018
Hello.

I'm using an evaluative conditioning paradigm and I'd like the pictures to have the appearance of either being zoomed in and out on based on the participants response.
I've managed to achieve something similar just by making the picture reappear in a different size, but could someone help with the zoom feature?

You'll have to implement something along the lines of the Approach Avoidance Task: https://www.millisecond.com/download/library/aat/

I.e. making the image re-appear in different size / manipulating the size at runtime (in- or decrease depending on response) is exactly the right approach. Here's a basic example, press i to "zoom in" (make the text object become larger), press o to "zoom out" (make the text object become smaller):

<values>
/ startheight = 50%
/ startwidth = 50%
/ width = 0%
/ height = 0%
/ zoomcount = 0
/ stepsize = 2.5%
/ nsteps = 20
/ itemnumber = 1
</values>

<block myblock>
/ trials = [1-4 = mytrial]
</block>

<trial mytrial>
/ ontrialbegin = [
    values.itemnumber = list.itemnumbers.nextvalue;
    values.width = values.startwidth;
    values.height = values.startheight;
    text.mytext.width = values.width;
    text.mytext.height = values.height;
    values.zoomcount = 0;
]
/ stimulusframes = [1=clearscreen,mytext]
/ validresponse = ("i", "o")
/ branch = [
    if (trial.mytrial.response == 23) trial.zoomin;
]
/ branch = [
    if (trial.mytrial.response == 24) trial.zoomout;
]
</trial>

<trial zoomin>
/ ontrialbegin = [
    values.width += values.stepsize;
    values.height += values.stepsize;
    text.mytext.width = values.width;
    text.mytext.height = values.height;
    values.zoomcount += 1;
]
/ stimulusframes = [1=clearscreen, mytext]
/ validresponse = (0)
/ trialduration = 50
/ branch = [
    if (values.zoomcount < values.nsteps) trial.zoomin;
]
</trial>

<trial zoomout>
/ ontrialbegin = [
    values.width -= values.stepsize;
    values.height -= values.stepsize;
    text.mytext.width = values.width;
    text.mytext.height = values.height;
    values.zoomcount += 1;
]
/ stimulusframes = [1=clearscreen, mytext]
/ validresponse = (0)
/ trialduration = 50
/ branch = [
    if (values.zoomcount < values.nsteps) trial.zoomout;
]
</trial>

<list itemnumbers>
/ items = (1,2,3,4)
</list>

<text mytext>
/ size = (50%,50%)
/ vjustify = center
/ items = myitems
/ txbgcolor = blue
/ txcolor = white
/ erase = false
/ select = values.itemnumber
</text>

<item myitems>
/ 1 = "A"
/ 2 = "B"
/ 3 = "C"
/ 4 = "D"
</item>

Things would work the same with <picture> elements.
By newbie - 9/4/2018

Dave - Monday, September 3, 2018
newbie - Monday, September 3, 2018
Hello.

I'm using an evaluative conditioning paradigm and I'd like the pictures to have the appearance of either being zoomed in and out on based on the participants response.
I've managed to achieve something similar just by making the picture reappear in a different size, but could someone help with the zoom feature?

You'll have to implement something along the lines of the Approach Avoidance Task: https://www.millisecond.com/download/library/aat/

I.e. making the image re-appear in different size / manipulating the size at runtime (in- or decrease depending on response) is exactly the right approach. Here's a basic example, press i to "zoom in" (make the text object become larger), press o to "zoom out" (make the text object become smaller):

<values>
/ startheight = 50%
/ startwidth = 50%
/ width = 0%
/ height = 0%
/ zoomcount = 0
/ stepsize = 2.5%
/ nsteps = 20
/ itemnumber = 1
</values>

<block myblock>
/ trials = [1-4 = mytrial]
</block>

<trial mytrial>
/ ontrialbegin = [
    values.itemnumber = list.itemnumbers.nextvalue;
    values.width = values.startwidth;
    values.height = values.startheight;
    text.mytext.width = values.width;
    text.mytext.height = values.height;
    values.zoomcount = 0;
]
/ stimulusframes = [1=clearscreen,mytext]
/ validresponse = ("i", "o")
/ branch = [
    if (trial.mytrial.response == 23) trial.zoomin;
]
/ branch = [
    if (trial.mytrial.response == 24) trial.zoomout;
]
</trial>

<trial zoomin>
/ ontrialbegin = [
    values.width += values.stepsize;
    values.height += values.stepsize;
    text.mytext.width = values.width;
    text.mytext.height = values.height;
    values.zoomcount += 1;
]
/ stimulusframes = [1=clearscreen, mytext]
/ validresponse = (0)
/ trialduration = 50
/ branch = [
    if (values.zoomcount < values.nsteps) trial.zoomin;
]
</trial>

<trial zoomout>
/ ontrialbegin = [
    values.width -= values.stepsize;
    values.height -= values.stepsize;
    text.mytext.width = values.width;
    text.mytext.height = values.height;
    values.zoomcount += 1;
]
/ stimulusframes = [1=clearscreen, mytext]
/ validresponse = (0)
/ trialduration = 50
/ branch = [
    if (values.zoomcount < values.nsteps) trial.zoomout;
]
</trial>

<list itemnumbers>
/ items = (1,2,3,4)
</list>

<text mytext>
/ size = (50%,50%)
/ vjustify = center
/ items = myitems
/ txbgcolor = blue
/ txcolor = white
/ erase = false
/ select = values.itemnumber
</text>

<item myitems>
/ 1 = "A"
/ 2 = "B"
/ 3 = "C"
/ 4 = "D"
</item>

Things would work the same with <picture> elements.

That's brilliant! Thank you.
By pops - 5/27/2019


I am trying to do something similar with picture objects - it is not contingent on a response, I just want the pictures to start small and then get bigger.
However, at the moment it looks quite jerky -it is not a smooth zoom. I've tried with and without clearing all the stimuli at the start of the trial. Should I be using a different feature to achieve this constant zooming effect?

<values>
/ startheight = 50%;
/ startwidth = 50%;
/ width1 = 0%;
/ height1 = 0%;
/ zoomcount = 0;
/ stepsize = 2%;
/ nsteps = 10;
/medalUpCounter=1;
</values>

<trial medalUp1>
/ ontrialbegin =[values.width1 += values.stepsize;
  values.height1 += values.stepsize;
  picture.medal1pic.width = values.width1;
  picture.medal1pic.height = values.height1;
  values.zoomcount +=1;]
/ stimulusframes = [1=levelUp,ExpertiseLevelFinal,pointsEarned,medal1pic]
/ trialduration=50
/ branch = [if (values.zoomcount<values.nsteps) trial.medalUp1]
/ branch = [if (values.zoomcount<values.nsteps) trial.medalUp2]
</trial>

Many thanks
By Dave - 5/27/2019

pops - 5/27/2019

I am trying to do something similar with picture objects - it is not contingent on a response, I just want the pictures to start small and then get bigger.
However, at the moment it looks quite jerky -it is not a smooth zoom. I've tried with and without clearing all the stimuli at the start of the trial. Should I be using a different feature to achieve this constant zooming effect?

<values>
/ startheight = 50%;
/ startwidth = 50%;
/ width1 = 0%;
/ height1 = 0%;
/ zoomcount = 0;
/ stepsize = 2%;
/ nsteps = 10;
/medalUpCounter=1;
</values>

<trial medalUp1>
/ ontrialbegin =[values.width1 += values.stepsize;
  values.height1 += values.stepsize;
  picture.medal1pic.width = values.width1;
  picture.medal1pic.height = values.height1;
  values.zoomcount +=1;]
/ stimulusframes = [1=levelUp,ExpertiseLevelFinal,pointsEarned,medal1pic]
/ trialduration=50
/ branch = [if (values.zoomcount<values.nsteps) trial.medalUp1]
/ branch = [if (values.zoomcount<values.nsteps) trial.medalUp2]
</trial>

Many thanks

To get a smoother effect, decrease values.stepsize, increase values.nsteps, and possibly set a shorter /trialduration.