Launching effect(Creating stable and moving polygons in same routine)

What am I trying to achieve?:
I want to create launching effect. There will be two polygons, I want to keep one of them at stable position(0,0) and make other polygon come from the left side of the screen and stop at alongside of constant polygon. Then make stable polygon move towards right side of the screen to demonstrate launching effect.

What did I try to make it work?:
I put both stable and moving polygon in same routine and created a loop.Made position of moving polygon conditioned.It starts from (-1,0) and ends at (0,0). Position changes by 0.01 at every repeat. Duration of moving polygon is 0.03 therefore it looks like moving when ı did not add stable polygon in the routine.

What specifically went wrong when I tried that?:
When ı add stable polygon in routine it changes the end time of the loop…Since constant and moving polygons are in the same routine, routine and loop does not end untill stop time(3seconds) of stable polygon ends. Problem is, moving polygons moves at every 3 seconds and it looks like jumping rather then moving. Do you have any idea how ı can demonstrate launching effect?


You need to remember that your screen refreshes at a fixed rate (e.g. 60 Hz, or every 16.666 ms), so you can’t expect to use arbitrary small durations like 30 ms in a loop and hope to keep any semblance of accurate timing. A better approach is to drop the loop technique and instead provide a formula based on time to calculate the position of the stimulus on any given screen refresh. e.g. Builder maintains a variable called t which is the time in seconds in the current routine. I think you want to move one target from the left side of the screen to the centre in 3 seconds, so you could give it a duration of three seconds and put this in the position field, set to update on every screen refresh:

[-1.0 + (t/3.0), 0]

Then you could duplicate that stimulus, and set it to have an onset of 3.0 seconds and a constant position of [0, 0], to give the effect of it moving and then stopping. Do a similar thing for the other stimulus (i.e. have one be static for the first three seconds of the routine, and then another begin moving right wards at 3 seconds, with a three second duration).