added text text_2

parent 3602323d
......@@ -94,6 +94,7 @@ var scrollBar;
var scrollButton;
var bottomCrop;
var continueText;
var text_2;
var endClock;
var text;
var globalClock;
......@@ -172,6 +173,17 @@ function experimentInit() {
depth: -6.0
});
text_2 = new visual.TextStim({
win: psychoJS.window,
name: 'text_2',
text: ' ',
font: 'Arial',
units: undefined,
pos: [0.4, 0.4], height: 0.1, wrapWidth: undefined, ori: 0,
color: new util.Color('red'), opacity: 1,
depth: -7.0
});
// Initialize components for Routine "end"
endClock = new util.Clock();
text = new visual.TextStim({
......@@ -298,7 +310,8 @@ function trialRoutineBegin(snapshot) {
moving = 0;
scrollText.setPos([((- 0.45) * screenRatio), 0.45]);
maxScroll -=round(1.4/fontSize)+19;
maxScroll -=round(1.4/fontSize);
maxScroll +=19;
//.04 => 39 but needs to be 20
//.03 => 52
//.02 => 79 but needs to be 99
......@@ -311,6 +324,7 @@ function trialRoutineBegin(snapshot) {
trialComponents.push(scrollButton);
trialComponents.push(bottomCrop);
trialComponents.push(continueText);
trialComponents.push(text_2);
trialComponents.forEach( function(thisComponent) {
if ('status' in thisComponent)
......@@ -401,6 +415,7 @@ function trialRoutineEachFrame(snapshot) {
scrollButton.setPos([(screenRatio * 0.475), ((trackLength / 2) - ((trackLength * scroll) / maxScroll))]);
bottomCrop.setPos([((- 0.1) + (0.01 * (scroll % 2))), (- 0.475)]);
continueText.setOpacity((1 - (0.01 * (scroll % 2))));
text_2.text = ((scroll.toString() + " of ") + maxScroll.toString());
moving = 0;
}
......@@ -454,6 +469,16 @@ function trialRoutineEachFrame(snapshot) {
continueText.setAutoDraw(true);
}
// *text_2* updates
if (t >= 0.0 && text_2.status === PsychoJS.Status.NOT_STARTED) {
// keep track of start time/frame for later
text_2.tStart = t; // (not accounting for frame time here)
text_2.frameNStart = frameN; // exact frame index
text_2.setAutoDraw(true);
}
// check for quit (typically the Esc key)
if (psychoJS.experiment.experimentEnded || psychoJS.eventManager.getKeys({keyList:['escape']}).length > 0) {
return quitPsychoJS('The [Escape] key was pressed. Goodbye!', false);
......
......@@ -105,6 +105,7 @@ var scrollBar;
var scrollButton;
var bottomCrop;
var continueText;
var text_2;
var endClock;
var text;
var globalClock;
......@@ -183,6 +184,17 @@ function experimentInit() {
depth: -6.0
});
text_2 = new visual.TextStim({
win: psychoJS.window,
name: 'text_2',
text: ' ',
font: 'Arial',
units: undefined,
pos: [0.4, 0.4], height: 0.1, wrapWidth: undefined, ori: 0,
color: new util.Color('red'), opacity: 1,
depth: -7.0
});
// Initialize components for Routine "end"
endClock = new util.Clock();
text = new visual.TextStim({
......@@ -308,7 +320,8 @@ function trialRoutineBegin(snapshot) {
moving = 0;
scrollText.setPos([((- 0.45) * screenRatio), 0.45]);
maxScroll -=round(1.4/fontSize)+19;
maxScroll -=round(1.4/fontSize);
maxScroll +=19;
//.04 => 39 but needs to be 20
//.03 => 52
//.02 => 79 but needs to be 99
......@@ -321,6 +334,7 @@ function trialRoutineBegin(snapshot) {
trialComponents.push(scrollButton);
trialComponents.push(bottomCrop);
trialComponents.push(continueText);
trialComponents.push(text_2);
for (const thisComponent of trialComponents)
if ('status' in thisComponent)
......@@ -410,6 +424,7 @@ function trialRoutineEachFrame(snapshot) {
scrollButton.setPos([(screenRatio * 0.475), ((trackLength / 2) - ((trackLength * scroll) / maxScroll))]);
bottomCrop.setPos([((- 0.1) + (0.01 * (scroll % 2))), (- 0.475)]);
continueText.setOpacity((1 - (0.01 * (scroll % 2))));
text_2.text = ((scroll.toString() + " of ") + maxScroll.toString());
moving = 0;
}
......@@ -463,6 +478,16 @@ function trialRoutineEachFrame(snapshot) {
continueText.setAutoDraw(true);
}
// *text_2* updates
if (t >= 0.0 && text_2.status === PsychoJS.Status.NOT_STARTED) {
// keep track of start time/frame for later
text_2.tStart = t; // (not accounting for frame time here)
text_2.frameNStart = frameN; // exact frame index
text_2.setAutoDraw(true);
}
// check for quit (typically the Esc key)
if (psychoJS.experiment.experimentEnded || psychoJS.eventManager.getKeys({keyList:['escape']}).length > 0) {
return quitPsychoJS('The [Escape] key was pressed. Goodbye!', false);
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment