Circle shape was interpreted as shape with four edges(diamond) when rewritten in JS language in pavlovia

Hi,
I used builder + code compenent to build my experiment. I set a lot of circle stimulus through polygon component. However, when I run the online version, all the circles became diamonds. And after carefully checking the .js file, I found in .js file, the circle polygon was initiated as shape with 4 edges. It was differently defined when compared with star shape, which can be correctly showed on screen.

Snipaste_2021-10-11_17-18-57

code example: piece_2 was defined as cross, and piece_3 was defined as a circle.
In .js file:
piece_2 = new visual.ShapeStim ({
win: psychoJS.window, name: ‘piece_2’,
vertices: ‘cross’, size:circlesize,
ori: 0.0, pos: [(piecexpos + piecexlag), pieceypos],
lineWidth: 1.0, lineColor: new util.Color(‘gray’),
fillColor: new util.Color(‘black’),
opacity: undefined, depth: -10, interpolate: true,
});

piece_3 = new visual.Polygon ({
win: psychoJS.window, name: ‘piece_3’,
edges: 4, size:circlesize,
ori: 0.0, pos: [(piecexpos + (2 * piecexlag)), pieceypos],
lineWidth: 1.0, lineColor: new util.Color(‘gray’),
fillColor: new util.Color(‘black’),
opacity: undefined, depth: -11, interpolate: true,
});

In .py file
piece_2 = visual.ShapeStim(
win=win, name=‘piece_2’, vertices=‘cross’,
size=circlesize,
ori=0.0, pos=(piecexpos+piecexlag, pieceypos),
lineWidth=1.0, colorSpace=‘rgb’, lineColor=‘gray’, fillColor=‘black’,
opacity=None, depth=-10.0, interpolate=True)
piece_3 = visual.ShapeStim(
win=win, name=‘piece_3’,
size=circlesize, vertices=‘circle’,
ori=0.0, pos=(piecexpos+2*piecexlag, pieceypos),
lineWidth=1.0, colorSpace=‘rgb’, lineColor=‘gray’, fillColor=‘black’,
opacity=None, depth=-11.0, interpolate=True)

Apparently, there is something wrong with .js file. So, I was wondering it is a bug about PsychoPy itself or I changed any possible setting to make this mistake happen?

PsychoPy version: v2021.2.3

Thanks for any feedback
Tang


Update:

I tried manually to edit the .js file, replacing " edges: 4 " with " vertice:‘circle’ ". But it failed since the pavlovia returned a mistake.图片

Hi @Yancheng_892,
I’m having the same problem. I will try changin the edges: 4 to something like edges: 256 and see if this works.
However, I noticed now, when looking through PsychoJS docs to see if circles are supported that there is the following note there:

If using circles online use a “regular” polygon with 100 vertices - rather than using the dropdown “circle” option

so this should be the easiest solution to the problem. It would be good if PsychoPy caught that someone is using circle when uploading experiment to pavolovia and warned to use it as advised on the PsychoJS web page.

Changing from circle to regular polygon works well irrespective of the number of vertices (I use 256 in big circles and 32 in small ones).

Well, I also used “regular” polygon with 200 vertices to build this circle! It did work! :grin:

2 Likes