psychopy.org | Reference | Downloads | Github

Center Align on Pavlovia using JS

Hi guys,
I’ve been designing my experiment in PsychoPy builder view and all of my texts were centre aligned on the screen. However, once uploading to Pavlovia and converting to JavaScript, all of my texts are left aligned. I’ve tried updating the property of the text component:

myText = new visual.TextStim( { name:‘myText’, font:‘Arial’, …, alignText: ‘center’ } )

But the text is still left-aligned! How can I fix this using JavaScript?

Thank you!

Add myText.setAlignHoriz(‘center’); to Begin Routine of a JavaScript code components in the first routine.

On the other hand, I haven’t found a way to left align locally.

Best wishes,

Wakefield

1 Like

Thank you so much!