Enables or disables perspective for lines in 3D sketches.
In WebGL mode, lines can be drawn with a thinner stroke when they’re further from the camera. Doing so gives them a more realistic appearance.
By default, lines are drawn differently based on the type of perspective being used:
perspective()andfrustum()simulate a realistic perspective. In these modes, stroke weight is affected by the line’s distance from the camera. Doing so results in a more natural appearance.perspective()is the default mode for 3D sketches.ortho()doesn’t simulate a realistic perspective. In this mode, stroke weights are consistent regardless of the line’s distance from the camera. Doing so results in a more predictable and consistent appearance.
linePerspective() can override the default line drawing mode.
The parameter, enable, is optional. It’s a Boolean value that sets the way lines are drawn. If true is passed, as in linePerspective(true), then lines will appear thinner when they are further from the camera. If false is passed, as in linePerspective(false), then lines will have consistent stroke weights regardless of their distance from the camera. By default, linePerspective() is enabled.
Calling linePerspective() without passing an argument returns true if it's enabled and false if not.
Note: linePerspective() can only be used in WebGL mode.
Ejemplos
Sintaxis
linePerspective(enable)
linePerspective()
Parámetros
whether to enable line perspective.
Referencias Relacionadas
camera
camera() establece la posición y orientación de la cámara actual en un dibujo 3D.
createCamera
Crea un nuevo objeto p5.Camera y lo establece como la cámara actual (activa).
frustum
frustum() cambia la perspectiva por defecto de la cámara actual en un boceto 3D.
linePerspective
Habilita o deshabilita la perspectiva de las líneas en bocetos 3D.