Unleash the full potential of JavaScript and supercharge your web experiments with this library for experimental programming - based on jsPsych - work in progress! 🎯
2
stars
0
forks
source link
Functions used to randomly assign stimuli within a circular or rectangular area #25
This function serves the general functions displayStimuli and displayButtons #21 . It arranges all stimuli randomly in a location without overlapping.
Parameters
For the circle area
stimuli: an array of objects, including all necessary information for displaying, except for location.
centre: an array([x, y]), the centre position of the circle, the default value is the centre of the screen.
radius: a number, the radius of the area
miniDist: a number, the minimum distance between two objects
border: an object, an array of objects, or null. If it is an object, it draws a border for each object according to the properties we have set. If it is an array of objects, it draws a border for each object according to the properties we have set for each one.
For the rectangle area
stimuli: an array of objects, including all necessary information for displaying, except for location.
centre: an array([x, y]), the centre position of the circle, the default value is the centre of the screen.
width: a number, the width of the area
height: a number, the height of the area
miniDist: a number, the minimum distance between two objects
border: an object, an array of objects, or null. If it is an object, it draws a border for each object according to the properties we have set. If it is an array of objects, it draws a border for each object according to the properties we have set for each one.
PS: In this function, we only use the same type of stimuli, and 99% of them are rectangles. It is fine if this function only works for rectangular stimuli.
Hi Ajit,
This function serves the general functions
displayStimuli
anddisplayButtons
#21 . It arranges all stimuli randomly in a location without overlapping.Parameters
For the circle area
For the rectangle area
Details of the parameters and output can be found in the issue https://github.com/coglabuzh/online-exps/issues/22
PS: In this function, we only use the same type of stimuli, and 99% of them are rectangles. It is fine if this function only works for rectangular stimuli.