Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
Scroll Text
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
VESPR
Scroll Text
Commits
a4bd8ea7
Commit
a4bd8ea7
authored
Apr 16, 2021
by
Wakefield Morys-Carter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
scroll+=(mouse.getPos()[1]-mouseY)/fontSize*1.08
parent
59afd76d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
4 deletions
+4
-4
scroll-text-legacy-browsers.js
scroll-text-legacy-browsers.js
+1
-1
scroll-text.js
scroll-text.js
+1
-1
scroll-text.psyexp
scroll-text.psyexp
+2
-2
No files found.
scroll-text-legacy-browsers.js
View file @
a4bd8ea7
...
...
@@ -367,7 +367,7 @@ function trialRoutineEachFrame(snapshot) {
dragging
=
1
;
mouseY
=
mouse
.
getPos
()[
1
];
}
else
{
scroll
+=
(((
mouse
.
getPos
()[
1
]
-
mouseY
)
*
fontSize
)
*
1.08
);
scroll
+=
(((
mouse
.
getPos
()[
1
]
-
mouseY
)
/
fontSize
)
*
1.08
);
moving
=
1
;
}
}
else
{
...
...
scroll-text.js
View file @
a4bd8ea7
...
...
@@ -376,7 +376,7 @@ function trialRoutineEachFrame(snapshot) {
dragging
=
1
;
mouseY
=
mouse
.
getPos
()[
1
];
}
else
{
scroll
+=
(((
mouse
.
getPos
()[
1
]
-
mouseY
)
*
fontSize
)
*
1.08
);
scroll
+=
(((
mouse
.
getPos
()[
1
]
-
mouseY
)
/
fontSize
)
*
1.08
);
moving
=
1
;
}
}
else
{
...
...
scroll-text.psyexp
View file @
a4bd8ea7
...
...
@@ -79,8 +79,8 @@
<Param
name=
"Begin JS Routine"
updates=
"constant"
val=
"scroll = 0;&#10;lines = scrollText.text.split("\n");&#10;maxScroll = 0;&#10;for (var line, _pj_c = 0, _pj_a = lines, _pj_b = _pj_a.length; (_pj_c < _pj_b); _pj_c += 1) {&#10; line = _pj_a[_pj_c];&#10; maxScroll += Math.ceil(((line.length * fontSize) / screenRatio));&#10;}&#10;maxScroll -= (round((1.6 / fontSize)) - 1);&#10;viewAll = 0;&#10;dragging = 0;&#10;moving = 0;&#10;"
valType=
"extendedCode"
/>
<Param
name=
"Begin Routine"
updates=
"constant"
val=
"scroll = 0&#10;lines = scrollText.text.split('\n')&#10;maxScroll = 0&#10;for line in lines:&#10; maxScroll += math.ceil(len(line)*fontSize/screenRatio)&#10;&#10;maxScroll-=round(1.6/fontSize)-1&#10;viewAll=0&#10;dragging=0&#10;moving=0"
valType=
"extendedCode"
/>
<Param
name=
"Code Type"
updates=
"None"
val=
"Auto->JS"
valType=
"str"
/>
<Param
name=
"Each Frame"
updates=
"constant"
val=
"keys=event.getKeys()&#10;if len(keys):&#10; if viewAll==1 and 'space' in keys:&#10; continueRoutine=False&#10; elif 'down' in keys:&#10; scroll+=1&#10; moving=1&#10; elif 'up' in keys:&#10; scroll-=1&#10; moving=1&#10;elif mouse.isPressedIn(scrollBar):&#10; mouseY=mouse.getPos()[1]&#10; scroll = (trackLength/2-mouseY)*maxScroll/trackLength&#10; moving=1&#10;elif
(mouse.getPressed()[0] == 1):&#10; if dragging==0:&#10; dragging=1&#10; mouseY=mouse.getPos()[1]&#10; else:&#10; scroll+=(mouse.getPos()[1]-mouseY)*
fontSize*1.08&#10; moving=1&#10;elif dragging==1:&#10; dragging=0&#10;if moving==1:&#10; if scroll>=maxScroll:&#10; scroll=maxScroll&#10; if viewAll == 0:&#10; viewAll=1&#10; continueText.text='Press space to continue' &#10; scrollText.setPos((-.45*screenRatio, .45+scroll*fontSize*1.08))&#10; scrollButton.setPos((screenRatio*.475, trackLength/2-trackLength*scroll/maxScroll))&#10; bottomCrop.setPos((-.1+.01*(scroll%2), -.475))&#10; continueText.setOpacity(1-.01*(scroll%2))&#10; moving=0"
valType=
"extendedCode"
/>
<Param
name=
"Each JS Frame"
updates=
"constant"
val=
"var _pj;&#10;function _pj_snippets(container) {&#10; function in_es6(left, right) {&#10; if (((right instanceof Array) || ((typeof right) === "string"))) {&#10; return (right.indexOf(left) > (- 1));&#10; } else {&#10; if (((right instanceof Map) || (right instanceof Set) || (right instanceof WeakMap) || (right instanceof WeakSet))) {&#10; return right.has(left);&#10; } else {&#10; return (left in right);&#10; }&#10; }&#10; }&#10; container["in_es6"] = in_es6;&#10; return container;&#10;}&#10;_pj = {};&#10;_pj_snippets(_pj);&#10;keys = event.getKeys();&#10;if (keys.length) {&#10; if (((viewAll === 1) && _pj.in_es6("space", keys))) {&#10; continueRoutine = false;&#10; } else {&#10; if (_pj.in_es6("down", keys)) {&#10; scroll += 1;&#10; moving = 1;&#10; } else {&#10; if (_pj.in_es6("up", keys)) {&#10; scroll -= 1;&#10; moving = 1;&#10; }&#10; }&#10; }&#10;} else {&#10; if (mouse.isPressedIn(scrollBar)) {&#10; mouseY = mouse.getPos()[1];&#10; scroll = ((((trackLength / 2) - mouseY) * maxScroll) / trackLength);&#10; moving = 1;&#10; } else {&#10; if ((mouse.getPressed()[0] === 1)) {&#10; if ((dragging === 0)) {&#10; dragging = 1;&#10; mouseY = mouse.getPos()[1];&#10; } else {&#10; scroll += (((mouse.getPos()[1] - mouseY)
*
fontSize) * 1.08);&#10; moving = 1;&#10; }&#10; } else {&#10; if ((dragging === 1)) {&#10; dragging = 0;&#10; }&#10; }&#10; }&#10;}&#10;if ((moving === 1)) {&#10; if ((scroll >= maxScroll)) {&#10; scroll = maxScroll;&#10; if ((viewAll === 0)) {&#10; viewAll = 1;&#10; continueText.text = "Press space to continue";&#10; }&#10; }&#10; scrollText.setPos([((- 0.45) * screenRatio), (0.45 + ((scroll * fontSize) * 1.08))]);&#10; scrollButton.setPos([(screenRatio * 0.475), ((trackLength / 2) - ((trackLength * scroll) / maxScroll))]);&#10; bottomCrop.setPos([((- 0.1) + (0.01 * (scroll % 2))), (- 0.475)]);&#10; continueText.setOpacity((1 - (0.01 * (scroll % 2))));&#10; moving = 0;&#10;}&#10;"
valType=
"extendedCode"
/>
<Param
name=
"Each Frame"
updates=
"constant"
val=
"keys=event.getKeys()&#10;if len(keys):&#10; if viewAll==1 and 'space' in keys:&#10; continueRoutine=False&#10; elif 'down' in keys:&#10; scroll+=1&#10; moving=1&#10; elif 'up' in keys:&#10; scroll-=1&#10; moving=1&#10;elif mouse.isPressedIn(scrollBar):&#10; mouseY=mouse.getPos()[1]&#10; scroll = (trackLength/2-mouseY)*maxScroll/trackLength&#10; moving=1&#10;elif
mouse.getPressed()[0] == 1:&#10; if dragging==0:&#10; dragging=1&#10; mouseY=mouse.getPos()[1]&#10; else:&#10; scroll+=(mouse.getPos()[1]-mouseY)/
fontSize*1.08&#10; moving=1&#10;elif dragging==1:&#10; dragging=0&#10;if moving==1:&#10; if scroll>=maxScroll:&#10; scroll=maxScroll&#10; if viewAll == 0:&#10; viewAll=1&#10; continueText.text='Press space to continue' &#10; scrollText.setPos((-.45*screenRatio, .45+scroll*fontSize*1.08))&#10; scrollButton.setPos((screenRatio*.475, trackLength/2-trackLength*scroll/maxScroll))&#10; bottomCrop.setPos((-.1+.01*(scroll%2), -.475))&#10; continueText.setOpacity(1-.01*(scroll%2))&#10; moving=0"
valType=
"extendedCode"
/>
<Param
name=
"Each JS Frame"
updates=
"constant"
val=
"var _pj;&#10;function _pj_snippets(container) {&#10; function in_es6(left, right) {&#10; if (((right instanceof Array) || ((typeof right) === "string"))) {&#10; return (right.indexOf(left) > (- 1));&#10; } else {&#10; if (((right instanceof Map) || (right instanceof Set) || (right instanceof WeakMap) || (right instanceof WeakSet))) {&#10; return right.has(left);&#10; } else {&#10; return (left in right);&#10; }&#10; }&#10; }&#10; container["in_es6"] = in_es6;&#10; return container;&#10;}&#10;_pj = {};&#10;_pj_snippets(_pj);&#10;keys = event.getKeys();&#10;if (keys.length) {&#10; if (((viewAll === 1) && _pj.in_es6("space", keys))) {&#10; continueRoutine = false;&#10; } else {&#10; if (_pj.in_es6("down", keys)) {&#10; scroll += 1;&#10; moving = 1;&#10; } else {&#10; if (_pj.in_es6("up", keys)) {&#10; scroll -= 1;&#10; moving = 1;&#10; }&#10; }&#10; }&#10;} else {&#10; if (mouse.isPressedIn(scrollBar)) {&#10; mouseY = mouse.getPos()[1];&#10; scroll = ((((trackLength / 2) - mouseY) * maxScroll) / trackLength);&#10; moving = 1;&#10; } else {&#10; if ((mouse.getPressed()[0] === 1)) {&#10; if ((dragging === 0)) {&#10; dragging = 1;&#10; mouseY = mouse.getPos()[1];&#10; } else {&#10; scroll += (((mouse.getPos()[1] - mouseY)
/
fontSize) * 1.08);&#10; moving = 1;&#10; }&#10; } else {&#10; if ((dragging === 1)) {&#10; dragging = 0;&#10; }&#10; }&#10; }&#10;}&#10;if ((moving === 1)) {&#10; if ((scroll >= maxScroll)) {&#10; scroll = maxScroll;&#10; if ((viewAll === 0)) {&#10; viewAll = 1;&#10; continueText.text = "Press space to continue";&#10; }&#10; }&#10; scrollText.setPos([((- 0.45) * screenRatio), (0.45 + ((scroll * fontSize) * 1.08))]);&#10; scrollButton.setPos([(screenRatio * 0.475), ((trackLength / 2) - ((trackLength * scroll) / maxScroll))]);&#10; bottomCrop.setPos([((- 0.1) + (0.01 * (scroll % 2))), (- 0.475)]);&#10; continueText.setOpacity((1 - (0.01 * (scroll % 2))));&#10; moving = 0;&#10;}&#10;"
valType=
"extendedCode"
/>
<Param
name=
"End Experiment"
updates=
"constant"
val=
""
valType=
"extendedCode"
/>
<Param
name=
"End JS Experiment"
updates=
"constant"
val=
""
valType=
"extendedCode"
/>
<Param
name=
"End JS Routine"
updates=
"constant"
val=
""
valType=
"extendedCode"
/>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment