Line Widget
The line widget is used to draw a straight line on a slide. (Note that if you want to draw a curved line, you can use the Bezier Curve Widget.)
Here's an example:
#config_version=5
slide_player:
mc_ready:
line_example:
- type: line
points: 0, 300, 800, 300
- type: line
points: 0, 100, 800, 100
- type: line
points: 400, 95, 400, 0
color: red
thickness: 5
cap: square
- type: line
points: 100, 500, 150, 550, 200, 450
color: lime
thickness: 2
- type: line
points: 500, 150, 600, 350, 650, 200
color: blue
close: true
thickness: 3
And the results:
Settings
type: line
points:
thickness:
cap:
joint:
cap_precision:
joint_precision:
close:
Note
Line widgets also have "common" widget settings for position, opacity, animations, color, style, etc. Those are not listed here, but are instead covered in common widget settings page.
Also remember that all widget settings can be controlled via widget styles, rather than you having to set every setting on every widget.
The following line widget settings may be
animated:
color:
, thickness:
, opacity:
, points:
, rotation:
, and
scale:
.
type: line
Tells MPF that this is a line widget. This setting is required when using line curve widgets.
points:
A list of point pairs which make up the line, expressed in x/y pairs (so the number of items here has to be even).
For example:
points: 10, 10, 200, 50, 300, 200
This would draw a line starting at (10,10) and going to (200, 50), and then from there, going to (300,200). If you just want a single straight line, then you would enter 4 values here: the x/y of the start and the x/y of the end.
thickness:
The thickness of the line. You'll probably have to play with different
settings to get it right. The default is 1.0
, so 2.0
is twice as
thick as the default, 0.5
is half as thick, etc.
cap:
Determine the cap of the line, defaults to 'round'. Can be one of 'none', 'square' or 'round'.
joint:
Determine the join of the line, defaults to 'round'. Can be one of 'none', 'round', 'bevel', 'miter'.
cap_precision:
Integer, defaults to 10.
Number of segments for drawing the "round" joint, defaults to 10. The joint_precision must be at least 1.
joint_precision:
Integer, defaults to 10.
Number of segments for drawing the "round" joint, defaults to 10. The joint_precision must be at least 1.
close:
Boolean (True/False), default is False
.
If True
, the line will be closed.
Examples
The example config files section of the documentation contains examples of line widgets.
Something missing or wrong? You can fix it!
This website is edited by people like you! Is something wrong or missing? Is something out of date, or can you explain it better?
Please help us! You can fix it yourself and be an official "open source" contributor!
It's easy! See our Beginner's guide to editing the docs.
Page navigation via the keyboard: < >
You can navigate this site via the keyboard. There are two modes:
General navigation, when search is not focused:
- F , S , / : open search dialog
- P , , : go to previous page
- N , . : go to next page
While using the search function:
- Down , Up : select next / previous result
- Esc , Tab : close search
- Enter : go to highlighted page in the results