DIfferent positions

PennController for IBEX Forums Support DIfferent positions

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #10985
    jessicagomes
    Participant

    Hi Jeremy

    I’m trying to finish my attention network task, but I have some problems with the position of the cues and arrows. In my task, the cues and arrows should appear in the same position on the screen, i.e. 94.65 px above or below the center cross. But every time I try, the cues appear closer to the center cross than the arrows. Can you help me? Here is my code:

    // return a Text element containing the desired characters concatenated
    arrowText = (condition,direction,position) => {arrowElement = newText(“arrows”, [‘other’,’other’,’target’,’other’,’other’]
    .map(w=>arrowChars[condition][direction][w]).join(”))

    distanceToCenter = 94.65;

    if (position === ‘above’) {
    arrowElement
    .css({
    “margin-bottom”: ${distanceToCenter}px,
    “bottom”: “auto”, // Reset bottom property
    “top”: “calc(50vh – 100px – ” + distanceToCenter + “px)”, // Adjust top position
    })
    .print(“center at 50vw”, “middle at 50vh”);
    } else if (position === ‘below’) {
    arrowElement
    .css({
    “margin-top”: ${distanceToCenter}px,
    “top”: “auto”, // Reset top property
    “bottom”: “calc(50vh – 100px – ” + distanceToCenter + “px)”, // Adjust bottom position
    })
    .print(“center at 50vw”, “middle at 50vh”);
    }
    return arrowElement;
    };

    // list the different cues
    cueChars = {no: ”, center: ‘*’, spatial: ‘*’}
    // return a Text element with the desired cue
    cueText = (cue, position) => newText(“cue”, cueChars[cue], position)
    cueText = (cue, position) => {
    cueElement = newText(“cue”, cueChars[cue])
    .print(“center at 50vw”, “middle at 50vh”);

    // different positions

    distanceToCenter = 94.65;

    if (cue === ‘spatial’) {
    if (position === ‘above’) {
    cueElement
    .css({
    “margin-bottom”: ${distanceToCenter}px,
    “bottom”: “auto”,
    “top”: calc(50vh - 100px - ${distanceToCenter}px),
    })
    .print(“center at 50vw”, “middle at 50vh”);
    } else if (position === ‘below’) {
    const totalHeight = 100 + distanceToCenter;
    cueElement
    .css({
    “margin-top”: ${distanceToCenter}px,
    “top”: “auto”,
    “bottom”: calc(50vh - ${totalHeight}px),
    })
    .print(“center at 50vw”, “middle at 50vh”);
    }
    } else if (cue === ‘center’) {
    cueElement
    .css(“margin-top”, “50%”) //a pista central está feita. não mexer
    .print(“center at 50vw”, “middle at 50vh”);
    }

    return cueElement;
    };

    // return an array of PennController commands defining an ANT for the specified parameters
    antTask = ({condition,direction,cue,position}) => [
    defaultTimer.log().start() // all Timer elements will be logged and immediately start when created
    ,
    newText(“cross”, “+”)
    .css(“font-size”, “64px”)
    .print( “center at 50vw”,”middle at 50vh” )
    // .print(“center at 50vw”,”middle at 50vh”) // print at the middle of the page
    ,
    newTimer(“pre-cue”, 400 + 1200*Math.random()).wait() // random duration between 400ms and 1600ms
    ,
    cueText(cue, position) // Overwrite the cross when center, move above or below according to position
    .css(‘background’,cue==’center’?’U+FF0A’:’transparent’)
    .css(“font-size”, “64px”)
    .print(“center at 50vw”,”middle at 50vh”)
    ,
    newTimer(“in-cue”, 100).wait(),
    getText(“cue”)
    .css(“font-size”, “64px”)
    .remove(),
    newTimer(“post-cue”,400).wait()
    ,
    arrowText(condition,direction,position) // Move above or below according to position
    .css(“font-family”, “Brush Script MT”)
    .css(“font-size”, “64px”)
    .print(“center at 50vw”, “middle at 50vh”)
    ,
    newTimer(“in-target”, 1700), // Start the timer but don’t wait for it yet
    newKey(“response”,”�34″)
    .log(“last”) // Log the pressed key (if any) and stop the timer + disable the key upon keypres
    .callback( getTimer(“in-target”).stop(),getKey(“response”).disable() )
    ,
    getTimer(“in-target”).wait(), // Wait until the timer ends, either by elapsing entirely, or because of a keypres
    getText(“arrows”).remove(),
    getText(“cross”).remove()
    ]

Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.