question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

code typo on jspsych-canvas-button-response page

See original GitHub issue

Hi gang!

Just wanted to report a typo in the example code on the jspsych-canvas-button-response webpage.

The example code works well there’s just a comma missing at prompt: <p>What color is the circle?</p>

Current code:

function filledCirc(canvas, radius, color){
    var ctx = canvas.getContext("2d");
    ctx.beginPath();
    ctx.arc(250, 250, radius, 0, 2 * Math.PI);
    ctx.fillStyle = color;
    ctx.fill()
}

var circle_1 = {
    type: 'canvas-button-response',
    stimulus: function (c) {
        filledCirc(c, 100, 'blue');
    },
    choices: ['Red', 'Green', 'Blue'],
    prompt: '<p>What color is the circle?</p>'
    data: {color: 'blue', radius: 100}
};

var circle_2 = {
    type: 'canvas-button-response',
    stimulus: function (c) {
        filledCirc(c, 150, 'green');
    },
    choices: ['Larger', 'Smaller'],
    prompt: '<p>Is this circle larger or smaller than the last one?</p>',
    data: {color: 'green', radius: 150}
};

Fixed code:

function filledCirc(canvas, radius, color){
    var ctx = canvas.getContext("2d");
    ctx.beginPath();
    ctx.arc(250, 250, radius, 0, 2 * Math.PI);
    ctx.fillStyle = color;
    ctx.fill()
}

var circle_1 = {
    type: 'canvas-button-response',
    stimulus: function (c) {
        filledCirc(c, 100, 'blue');
    },
    choices: ['Red', 'Green', 'Blue'],
    prompt: '<p>What color is the circle?</p>',
    data: {color: 'blue', radius: 100}
};

var circle_2 = {
    type: 'canvas-button-response',
    stimulus: function (c) {
        filledCirc(c, 150, 'green');
    },
    choices: ['Larger', 'Smaller'],
    prompt: '<p>Is this circle larger or smaller than the last one?</p>',
    data: {color: 'green', radius: 150}
};

Thanks!

Nathalie

Note: I put this issue in the wrong place, I had it on the discussion board as discussion #1839!

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
becky-gilbertcommented, May 19, 2021

This fix should be on the live website now. Thanks again @LMD-nat!

0reactions
becky-gilbertcommented, May 20, 2021

Fixed! Thanks again 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

jspsych-canvas-button-response
This plugin can be used to draw a stimulus on a HTML canvas element, and record a button click response and response time....
Read more >
canvas-keyboard-response - jsPsych
This plugin can be used to draw a stimulus on a HTML canvas element and record a keyboard response. The canvas stimulus can...
Read more >
jspsych-html-button-response
This plugin displays HTML content and records responses generated by button click. The stimulus can be displayed until a response is given, ...
Read more >
html-keyboard-response - jsPsych
This plugin displays HTML content and records responses generated with the keyboard.The stimulus can be displayed until a response is given, ...
Read more >
Controlling Visual Appearance - jsPsych
It might also depend on whether you want the style/formatting change(s) to apply to specific trials, to the whole experiment (HTML page), ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found