Millisecond Forums

Changing entire screen background color within same experiment

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

By seoho - 11/29/2017

Hi,

I was wondering if it was possible to have trials and change the color of the screen background within the same experiment. Thank you.
By Dave - 11/29/2017

seoho - Wednesday, November 29, 2017
Hi,

I was wondering if it was possible to have trials and change the color of the screen background within the same experiment. Thank you.

I assume you mean something like different types of trials within the experiment having different screen background colors, right? If so, you can achieve that by having the respective <trial> elements display a <shape> covering the entire screen in the background. Set that <shape> to whatever color you need.

Example:


<block example>
/ trials = [1-6 = noreplace(a,b,c)]
</block>

// sets backgroundcolor to red
<trial a>
/ ontrialbegin = [
    shape.backgroundcolor.color = red;
]
/ stimulusframes = [1=clearscreen, backgroundcolor, a_stim]
/ validresponse = (57)
</trial>

// sets backgroundcolor to green
<trial b>
/ ontrialbegin = [
    shape.backgroundcolor.color = green;
]
/ stimulusframes = [1=clearscreen, backgroundcolor, b_stim]
/ validresponse = (57)
</trial>

// sets backgroundcolor to blue
<trial c>
/ ontrialbegin = [
    shape.backgroundcolor.color = blue;
]
/ stimulusframes = [1=clearscreen, backgroundcolor, c_stim]
/ validresponse = (57)
</trial>

<shape backgroundcolor>
/ shape = rectangle
/ color = white
/ erase = false
/ size = (100%, 100%)
</shape>

<text a_stim>
/ items = ("A1", "A2")
/ txcolor = white
/ txbgcolor = transparent
/ erase = false
</text>

<text b_stim>
/ items = ("B1", "B2")
/ txcolor = white
/ txbgcolor = transparent
/ erase = false
</text>

<text c_stim>
/ items = ("C1", "C2")
/ txcolor = white
/ txbgcolor = transparent
/ erase = false
</text>