NYUCCL / psiTurk

An open platform for science on Amazon Mechanical Turk.
https://psiturk.org
MIT License
277 stars 140 forks source link

Stroop task #23

Closed bumble-bee-chuna closed 11 years ago

bumble-bee-chuna commented 11 years ago

UPDATE: this issue was resolved. thank you

Hello, I just recently started working with the code for the Stroop task.

I am interning in the LNCC at Brown and we are trying mess with the code to use images rather than the 64px, helvetica text with 3 color attributes that is used.

In the task.js file, there is the following code


var R = Raphael("stim", 400, 100),
    font = "64px Helvetica";

var show_word = function(text, color) {
    R.text( 200, 50, text ).attr({font: font, fill: color});
};
var remove_word = function(text, color) {
    R.clear();
};
$("body").focus().keydown(responsefun); 
    listening = false;

var stims = [
    ["ASTRONAUT", "red", "unrelated"],
    //first is actually suppose to be 'SHIP'
    ["MONKEY", "green", "unrelated"],
    ["ZAMBONI", "blue", "unrelated"],
    ["RED", "red", "congruent"],
    ["GREEN", "green", "congruent"],
    ["BLUE", "blue", "congruent"],
    ["GREEN", "red", "incongruent"],
    ["BLUE", "green", "incongruent"],
    ["RED", "blue", "incongruent"]
    ];
shuffle( stims );
nextword();
return this;"

which is where I'm assuming the browser reads what text and color to display; however, I do not know where the variable "color" is defined. I thought that this might be relevant to what I'm trying to do with this code.

Thank you!

jbmartin commented 11 years ago

Color is a string argument (e.g., "red", "blue", etc.) passed to the show_word and remove_word functions. Within those functions, the text's css color attributes are modified via the attr method. So if you call show_word("MONKEY", "red"), the word MONKEY will appear in red on the screen. For the stroop demo, we use an external library to handle our stimuli called Raphael.js. You can learn more about it here: http://raphaeljs.com/reference.html#Element.attr. If you have additional questions, please feel free to chat with us on Google Groups (https://groups.google.com/d/forum/psiturk).