Rectangle Object
The Rectangle object draws a vector rectangle on a canvas frame, with optional rounded corners. It stays sharp at any size and needs no image file. Stroke and fill can differ per condition and can change during the experiment through events.
The outline of the rectangle is also its hit area: a click inside the rectangle counts as a click on the object whether or not it is filled, and the same region is used when a gaze or fixation trigger is limited to the rectangle as a target. This makes the Rectangle a direct way to build response areas, cues, placeholders and frames around stimuli. For other outlines, see the Ellipse, Line, Arrow and Polygon objects.
Table of Contents
Adding the Rectangle Object
In the task editor toolbar, open the Images & Drawing group and select Rectangle to add a Rectangle object to the current frame.
A new rectangle is 200 wide and 100 high, with a black stroke 2 wide and no fill.
Shapes can be added to canvas frames. The Images & Drawing group is not offered on page frames or website frames.
Sizing, Moving and Rotating
The rectangle always fills its box. Set X, Y, Width, Height and Rotation in the Object Properties panel, or drag on the frame. A selected rectangle shows eight resize handles and a rotation handle above its top edge. Hold Shift while resizing to keep the aspect ratio, or while rotating to snap to 15 degree steps.
Object Properties
All settings below are found in the properties panel when the Rectangle is selected. They appear in the shape's own section, under a header with the shape's name.
Rectangle settings
| Property | Default | Description |
|---|---|---|
Stroke width | 2 | Width of the outline in frame units. 0 draws no outline. The stroke is drawn inside the box, so the box is the outer visible edge. |
Stroke color | Black | Color of the outline. |
Fill | Off | A checkbox plus a color picker. When checked, the inside of the rectangle is painted in the chosen color. When unchecked, the inside is transparent. |
Corner radius | 0 | Rounds the corners, in frame units. The radius is limited to half the shorter side, which turns a square into a circle. |
Hit margin | 0 | An extra band around the hit area, in frame units. See Hit Area and Hit Margin. |
Like other object properties, each setting can differ per trial type, and a value that differs from the default is shown with a dark gray background.
Style
Visibility works as for any other object. The generic Scaling, Border-Size, Border-Color, BG-Color, Transparent, Roundness, Overflow-X, Overflow-Y and Scroll Margin settings are hidden for shapes. Use Stroke color, Fill and Corner radius instead.
Custom CSS
The Change CSS Properties option works as for other objects. See Object Properties.
Hit Area and Hit Margin
The hit area of a Rectangle is the whole rectangle, including rounded corners as drawn, up to its outer edge, whether it is filled or not. Hit margin widens this region by the given number of frame units on every side, also beyond the box. The margin is invisible to participants.
Use a hit margin to make a small response area easier to click, or to give a gaze target some tolerance. The same region is used for mouse triggers in the player and for Eyetracking Gaze and Eyetracking Fixation triggers that are limited to target objects.
Events Integration
The Rectangle can be the target of the general object triggers. Common examples:
Mouse: react to aClick,PressDown,PressUp,Hover,LeaveorMoveon the object, measured against its hit area.Eyetracking GazeandEyetracking Fixation: limit the trigger to the rectangle as a target to react when gaze or a fixation lands in its hit area. See the Eyetracking Fixation Trigger and Eyetracking Gaze Trigger pages.
To change a rectangle while the experiment runs, use the Set Object Property Action. The properties are listed with their panel names: Stroke color, Stroke width, Fill, Fill color, Hit margin and Corner radius. The box values (X, Y, Width, Height, Rotation and Visibility) are available as for every object. The same properties can be read into a variable with Set / Record Variable, using Object Property as the value source.
Example: highlight a response area while the cursor is over it
Trigger 1:
Mouse→Set Target: your Rectangle →Hover
Action 1:Set Object Property→Set Target: your Rectangle →Stroke color→ a highlight color
Trigger 2:Mouse→Set Target: your Rectangle →Leave
Action 2:Set Object Property→Set Target: your Rectangle →Stroke color→ the original color
Example: use a rectangle as a response area
Trigger:
Mouse→Set Target: your Rectangle →Click
Action 1:Set / Record Variable→ your response variable
Action 2:Jump to Next Frame
Further Reading
Object Properties
The properties panel all objects share, including the shape settings for stroke, fill and hit margin.
Set Object Property Action
Change stroke, fill, corner radius or hit margin of a rectangle while the experiment runs.
All Objects
A full index of all objects available in the Labvanced experiment editor, including display, input, media, and recording elements.