Hi,
I want to draw two gabor patches using the canvas plugin. Here is the code for the two patches:
`function rightgabor(c) {
var context = c.getContext("2d");
const my_gradient = context.createLinearGradient(400,0,200,0);
const bands = 10;
const colors = ["#000", "#FFF"];
const stops = bands * colors.length;
var pos = 0;
while (pos <= stops) {
my_gradient.addColorStop(pos / stops, colors[pos % colors.length]);
pos++;
}
context.fillStyle = my_gradient;
context.filter = 'contrast(1)'
context.fillRect(400,200,100,100);
context.stroke()
}'
'function leftgabor(c) {
var context = c.getContext("2d");
const my_gradient = context.createLinearGradient(0,0,200,0);
const bands = 10;
const colors = ["#000", "#FFF"];
const stops = bands * colors.length;
var pos = 0;
while (pos <= stops) {
my_gradient.addColorStop(pos / stops, colors[pos % colors.length]);
pos++;
}
context.fillStyle = my_gradient;
context.filter = 'contrast(0.5)'
context.fillRect(0,200,100,100);
context.stroke()
}`
var trial1 = {
type: 'canvas-keyboard-response',
on_start: function(trial1){
trial1.contrast = Math.random(); //trial1a.contrast1 = randbet(0.05,0.35)
},
stimulus: [rightgabor, leftgabor],
choices: 'none',
trial_duration: 5000,
on_finish: function (data) {
if (data.key_press === 37) {
data.correct = true;
} else {
data.correct = false;
}
}
};
However, both stimuli don't get displayed at the same time on the screen. When I call them individually, the stimuli is easily displayed. Please suggest any solutions.