Line Object
The Line object draws a straight line from a start point to an end point on a canvas frame, with an optional head at each end. It stays sharp at any size, needs no image file, and its stroke, heads and endpoints can differ per condition or change during the experiment through events.
The Arrow entry in the toolbar creates the same object with an arrow head at its end, see the Arrow Object. For closed outlines, see the Rectangle and Ellipse objects.
Table of Contents
Adding the Line Object
In the task editor toolbar, open the Images & Drawing group and select Line to add a Line object to the current frame.
A new line is 200 long with a head width of 20, a black stroke 2 wide, and no heads.
Shapes can be added to canvas frames. The Images & Drawing group is not offered on page frames or website frames.
How the Box Defines the Line
A line runs through the middle of its box, from the start point to the end point, and its anchor is fixed at the start point. For this reason the Anchor selector is hidden for lines. The box values in the Object Properties panel mean:
| Property | Meaning for a line |
|---|---|
X and Y | The start point |
Width | The length of the line |
Height | The head width, the space the heads can use across the line |
Rotation | The direction of the line, in degrees |
On the frame, a selected line shows one handle at each end instead of the usual eight resize handles. Drag either handle to move that end while the other end stays in place. The dragged end snaps to whole frame units. Hold Shift to snap the direction to 15 degree steps.
Changing Rotation turns the line around its start point, which is all you need for a clock hand or a rotating pointer.
Object Properties
All settings below are found in the properties panel when the Line is selected. They appear in the shape's own section, under a header with the shape's name.
Line settings
| Property | Default | Description |
|---|---|---|
Stroke width | 2 | Width of the line in frame units. 0 draws no line. |
Stroke color | Black | Color of the line and of the heads. |
Fill | Off | A checkbox plus a color picker. It colors the inside of the outlined heads (Triangle (outline) and Circle (outline)) only. |
Hit margin | 10 | An extra band around the hit area, in frame units. See Hit Area and Hit Margin. |
Start head | None | The head at the start point. See Line Heads. |
End head | None | The head at the end point. |
Swap heads | A button that exchanges the start head and the end head. | |
Head length | 1 | Length of the heads as a multiple of the line's Height (× Height). Each head takes at most half the line. |
Endpoints | Start X, Start Y, End X and End Y. See Endpoints. |
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 and Fill instead. The Anchor selector is hidden too, because a line is always anchored at its start point.
Custom CSS
The Change CSS Properties option works as for other objects. See Object Properties.
Line Heads
Start head and End head are icon pickers. The name of the selected style is shown below the icons.
| Style | What it draws |
|---|---|
None | No head. |
Open arrow | Two arms in the line color that form an open arrow. |
Filled arrow | A filled triangle in the line color. |
Triangle (outline) | A triangle drawn as an outline, painted with Fill when Fill is on. |
Circle | A filled circle in the line color. |
Circle (outline) | A circle drawn as an outline, painted with Fill when Fill is on. |
Square | A filled square in the line color. |
Bar | A bar across the end of the line. |
Diamond | A filled diamond in the line color. |
Head length sets how long the heads are, as a multiple of Height. Two heads never overlap: each head takes at most half of the line.
Endpoints
The Endpoints section shows Start X, Start Y, End X and End Y in frame coordinates. The endpoints are derived from the box values and are not stored separately. Values are rounded to two decimals.
- Typing a new end point keeps the start point and changes
WidthandRotation. - Typing a new start point keeps the end point and changes
X,Y,WidthandRotation.
Hit Area and Hit Margin
The hit area of a Line is the stroke band of the line and its heads. A line starts with a Hit margin of 10 because a thin line is hard to hit. The margin widens the hit area by the given number of frame units on every side and is invisible to participants. Set it to 0 for an exact line.
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 Line 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 line 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 line 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, Start head, End head, Head length, Start X, Start Y, End X and End Y. 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.
Start head and End head take the head style as a short id, for example openArrow, filledArrow, triangle, circle, circleOutline, square, bar, diamond or none. Use the id, not the name shown in the picker.
Example: turn a pointer when a button is clicked
Trigger:
Mouse→Set Target: your button →Click
Action:Set Object Property→Set Target: your Line →Rotation→ the new angle in degrees
Example: move the end of a line to a new position
Trigger:
On Frame Start
Action 1:Set Object Property→Set Target: your Line →End X→ a value or variable
Action 2:Set Object Property→Set Target: your Line →End Y→ a value or variable
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 the heads, endpoints, rotation or stroke of a line 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.