Millisecond Forums

resizing cross

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

By tecnika - 6/26/2018

Hello, is there a quick way to resize the two dimension of a cross separately with the arrow keys?
e.g. making vertical line longer with top arrow key, shorter with low arrow key; horizontal line longer with right arrow key and shorter with left arrow key?

Thank you
By Dave - 6/27/2018

tecnika - Wednesday, June 27, 2018
Hello, is there a quick way to resize the two dimension of a cross separately with the arrow keys?
e.g. making vertical line longer with top arrow key, shorter with low arrow key; horizontal line longer with right arrow key and shorter with left arrow key?

Thank you

You would define two <shape> elements that make up your cross -- one horizontal line, one vertical line. You can then manipulate those lines' sizes separately based on the response. Something like this:

<block myblock>
/ trials = [1=sizetrial]
</block>

<values>
/ h = 20px
/ v = 20px
/ stepsize = 5px
</values>

203 = left
205 = right
200 = up
208 = down
<trial sizetrial>
/ ontrialend = [
    if (trial.sizetrial.response == 203 && values.h >= 0) values.h -= values.stepsize;
    if (trial.sizetrial.response == 205) values.h += values.stepsize;
    if (trial.sizetrial.response == 200 && values.v >= 0) values.v -= values.stepsize;
    if (trial.sizetrial.response == 208) values.v += values.stepsize;
]
/ stimulusframes = [1=clearscreen, h, v]
/ validresponse = (203, 205, 200, 208, 28)
/ branch = [
    if (trial.sizetrial.response!=28) trial.sizetrial;
]
</trial>

<shape h>
/ shape = rectangle
/ color = black
/ erase = false
/ position = (50%, 50%)
/ size = (values.h, 10px)
</shape>

<shape v>
/ shape = rectangle
/ color = black
/ erase = false
/ position = (50%, 50%)
/ size = (10px, values.v)
</shape>