coglabuzh / online-exps

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

Presenting pictures in a circle #14

Closed chenyu-psy closed 8 months ago

chenyu-psy commented 9 months ago

Hi Ajit,

I wonder is it possible to extend the circleOfSquare to another general function: circleOfImages

In circleOfImages, there should be the following arguments: images, center, radius, imageWidth, and background.

  1. images: An array that includes the paths of the images.
  2. center: An array, the center position of the circle. By default, it should be placed in the center of the screen.
  3. radius: the radius of the circle,
  4. imageWidth: the width of the image
  5. background: (optional) background color, It only works when displaying transparent images.

To make the function more flexible, I hope:

  1. I can present the images together with other elements (e.g., text or square).
  2. These images could be buttons. When I click on them, they will return my response and move to the next screen (It could be a separate function).
ajit283 commented 9 months ago

Dear Chenyu,

Thanks for your suggestion! I generally try to create the library functions so that they can be used as broadly as possible. The current implementation of the circle-of-squares function can take any html string, including tags. I will definitely create an example with this function that has the features described by you.

ajit283 commented 9 months ago

Dear Chenyu, I have just added an initial version of a circle with images example in the examples folder, let me know what you think!

chenyu-psy commented 9 months ago

Dear Ajit,

Thank you for your work. I tried running your example and using the package in my own experiment. However, I encountered a consistent issue:

Module not found: Error: Can't resolve '@coglabuzh/webpsy.js' in '/Users/chenyu/Downloads/online-exps-dev/examples/circle-of-squares-with-images/src'

Do you have any idea what could be causing this? (I have installed our package and it can be found in node_modules)

ajit283 commented 9 months ago

Dear Chenyu,

try running npm run build in the root directory of the project once, it is possible that the build output is not in your computer yet.

On 31 Oct 2023, at 13:56, Chenyu Li @.***> wrote:

Dear Ajit,

Thank you for your work. I tried running your example and using the package in my own experiment. However, I encountered a consistent issue:

Module not found: Error: Can't resolve @.***/webpsy.js' in '/Users/chenyu/Downloads/online-exps-dev/examples/circle-of-squares-with-images/src'

Do you have any idea what could be causing this? (I have installed our package and it can be found in node_modules)

— Reply to this email directly, view it on GitHub https://github.com/coglabuzh/online-exps/issues/14#issuecomment-1787167198, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANKNWNAFBSH2AZISZ5E56XDYCDYQLAVCNFSM6AAAAAA6NXNMESVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTOOBXGE3DOMJZHA. You are receiving this because you were assigned.

chenyu-psy commented 8 months ago

The problem has been solved in the new version of the package