Moving Bar question

beshoy.agayby's Avatar


24 Jul, 2017 02:24 PM

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,

  1. Support Staff 1 Posted by Christopher Sta... on 24 Jul, 2017 07:13 PM

    Christopher Stawarz's Avatar

    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

  2. 2 Posted by beshoy.agayby on 25 Jul, 2017 03:19 PM

    beshoy.agayby's Avatar

    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

  3. Christopher Stawarz closed this discussion on 25 Jul, 2017 07:38 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac