moveShape

moveShape( shape, x, y )

Moves the given shape to the given x,y location on the screen.

The location of the shape is saved into the database and automatically associated with the current session, trial and phase (if applicable).

The benefit of using this function rather than setting the shape’s x and y location separately is that this moves the shape directly to the new x,y location without transitioning between the new x and old y location.

Note that using the moveShape function rather than just setting the x and y properties on the shape has a number of benefits:

      1. It is slightly more efficient to use the moveShape function (or any of the move shape functions).
      2. There will be an event saved into the database with an event name of “moved” that contains the old and new x,y locations.
        Setting the x and y properties individually will create two events in the database, one for the change to the x value, and one for the change to the y value – but no single event with both the old and new x and y locations.  Using the moveShape function still creates these individual events, but it also creates a more complete “moved” event that contains the old location and the new location.

Arguments

shape        - the shape to move

x                - the x location where the shape should be moved (either absolute or a percent)

y                - the y location where the shape should be moved (either absolute or a percent)

Returns

The shape that was moved (the shape argument).

Example

Moves a circle to the centre of the screen:

// Define a circle type that we’ll use to create two circles

define type of circle CircleType

       radius = 50

       IsVisible = true

       Colour = #0000FF

end circle


// Create the first circle and move it randomly on the screen

define shape = create CircleType

moveShape( shape, 50%, 50% )


// Let the user see  the circle on the screen

wait for 10sec