Open chenyu-psy opened 7 months ago
Hi Ajit,
I thought a cool add-on to this function might be that there is a 5th parameter (lets call it _startposition) with which you can indicate where exactly on the “imaginary” circle the first stimulus will be presented.
As far as I know these functions that present stimuli in a circle often present the first item at the right-most position of the circle (I believe because cos and sin of 0° is at that position). It would be nice if with this additional 5th parameter you can indicate that the first stimulus should not be presented at where cos and sin is 0° but maybe for example cos and sin of 30°. This could give you some flexibility to control where exactly these stimuli are positioned on the “imaginary” circle.
So in this case, the 5th parameter would be a number, in degrees or radians, that indicates the shift of the first stimulus item on the circle.
Feel free to just write if this explanation was not clear enough. Thank you! :)
Best, Isabel
Hi Chenyu, hi Isabel, I have added a first version of the circle and line functions in the dev branch. I haven't released them as a new version on npm yet, as I want to hear your thoughts about it first. To test, you can run the example experiment (arrangeInCircle-test) that is also on the dev branch. Be sure to run npm i
before running the experiment. Let me know if you have feedback or any problems running the experiment!
Hi Ajit, it looks very cool! That is what we want. Just want to know, how can I present additional stimuli on that screen? For example, a question or some instruction to tell participants what they should do on the screen.
One idea just came to my mind: maybe we can add a property "position" for stimuli. When we want to have a specific layout, we only need to have a simple function to calculate the position for each stimulus. Based on this idea, we can simplify the arrangeCircle function to arrange function (or other name, like displayStimuli) and use it to display any stimulus that we want to present. In the meantime, the border property can also be a property for stimuli.
What do you think, Ajit?
Hi Ajit,
Apologies for my belated response and thanks a lot for implementing so quickly already a first version as well from my side! It seems to work for me as well in general. Can I ask you something about the start_position argument, do I understand it correctly so far that you can type there an integer and this basically indicates what position is selected for the 1st item? Greetings
One idea just came to my mind: maybe we can add a property "position" for stimuli. When we want to have a specific layout, we only need to have a simple function to calculate the position for each stimulus. Based on this idea, we can simplify the arrangeCircle function to arrange function (or other name, like displayStimuli) and use it to display any stimulus that we want to present. In the meantime, the border property can also be a property for stimuli.
What do you think, Ajit?
I tried this approach just now, but I noticed a problem. Only the circle shape is defined using explicit position coordinates, all the other shapes use css flexbox and other layout methods where the position isn't explicitly calculated. That's why it's difficult to have one function that generates all the positions and another that generates the html. I will try to factor out as many similarities as possible, however I think it's best to keep the functions seperate at the moment. From a user perspective, the differences should not be that large.
Hi Ajit,
Apologies for my belated response and thanks a lot for implementing so quickly already a first version as well from my side! It seems to work for me as well in general. Can I ask you something about the start_position argument, do I understand it correctly so far that you can type there an integer and this basically indicates what position is selected for the 1st item? Greetings
Hi Isabel, that's exactly how it works! Let me know if this is intuitive enough.
Hi Ajit, it looks very cool! That is what we want. Just want to know, how can I present additional stimuli on that screen? For example, a question or some instruction to tell participants what they should do on the screen.
![]()
Hi Chenyu, the function generates html as a string, so you could just add any other html string before or after it:
stimulus: "<div>hello world</div>" + arrangeInCircle({ stimuli: [ ], centre: [0, 0], radius: 350, border: { lineWidth: 5, lineColor: "red", lineType: "dashed" }, start_position: 2, }),
I can also add a property like center_html
to display HTML in the center of the circle, let me know if that's a good solution
Hi Ajit, thank you for your responses. They look good. I don't think we need to add a property to display HTML. Instead, introducing a new function like arrangeElement
could be a good idea. This function will be used to display a single element at a specific position. Or could we use arrangeLine
to do this thing?
Hi Chenyu, you're right, arrangeLine
with a single element in the stimulus
array should be able to do this!
Hi Ajit,
First of all, Happy New Year! :) And thanks for the elaboration. Using an integer is perfect, I think it's intuitive enough.
Hi Ajit,
I'm not sure if you still have open hours with regards to your work contract, but I wondered whether you would be able and have time to add an argument for this function. I thought it would be a cool add-on that there is a parameter (rotation) with which you can indicate how much the position of the stimuli locations should be rotated on the imaginary circle. As I understand it the start_position argument only shifts stimulus 1 for example from location 1 to location2, but you can't change and rotate the locations 1 and 2 on the circle.
It would be nice if with this additional parameter you can indicate that all the locations should be rotated by for example 45° on the imaginary circle. I guess it would be the easiest if the argument would be presented as a number, in degrees or radians indicating the rotation. I attached an image to make a little bit clearer what I mean.
But what do you think of this Ajit? Is it possible to do this already in a different way and do you have time left to implement this?
Best, Isabel
Dear Isabel, sorry for the late response! I had to prepare for exams. I just added a optional parameter (rotateDegrees
) to the function to do this. A demo for this is in the arrangeInCircle-test
experiment in the dev branch. Let me know if this is what you thought of!
Best, Ajit
Dear Ajit,
No worries at all! As you can see I'm a little belated myself. But I had a look at the new implementation and played around with it. This was exactly what I had in mind and so far everything seems to work perfectly from what I can tell.
Thank you very much! (And I hope the exams went well or wish you good luck if you are not through with them yet)
Best, Isabel
Hi Ajit,
This function serves the general functions
displayStimuli
anddisplayButtons
#21 . It arranges all of the stimuli in a circle.Parameters
Details for stimuli
We expect four different types of stimuli: images, text, rectangles and circles. They can be saved in the save array such as
[image1, image2, circle1, text1, circle2, ...]
Image properties
Text properties
Rectangle properties
Circle properties
Details for border (the same properties as the rectangle)
Output
The output of this function should be the same array as
stimuli
, but each object involves the location information.