Moving Bar question

I am trying to implement a method for receptive field mapping in Mworks. Basically, I am presenting a bar that moves across the screen at different orientations. My question is: is there is a built-in method in mworks to present a moving stimulus (bar)? What I am doing right now is change the x position in the bar stimulus (the one built-in in mworks) parameters within a loop to produce the motion. However, it’s a bit jittery at the moment.
Thanks in advance,

Hi Beshoy,

I’ve attached an example experiment that shows how to do this. Here are the key points:

  1. The x position of the rectangle stimulus is an expression that depends on the output time of the frame currently being prepared (nextFrameTime()) and the deg_per_sec variable.

  2. The rectangle stimulus is “wrapped” in a frame list stimulus. The rectangle is the frame list’s only frame, and the frame list is configured to loop indefinitely. The net effect is that the rectangle is redrawn on every display refresh, instead of just being drawn when needed or requested.

  3. The frame list (and thereby the rectangle) is live queued, so the rectangle stimulus will re-evaluate the position expression each time it draws itself (i.e. every frame).

This is a very useful technique for animating stimuli that are normally static.

Chris Stawarz

Attachment: moving_bar.xml (2 KB)

Hello Chris,
Thank you for the quick reply. Indeed, this works great and it’s much smoother than my code. I will start fiddling with it.
Beshoy Agayby