clearCanvas
Canonical ID: graphics.clear. Nederlands: wisScherm.
Starts a fresh immediate 2D scene frame with the chosen background and discards retained sprites. It hides a displayed 3D frame without deleting the canonical 3D world; draw3D can show that world again. A separately retained image background may remain on hosts implementing image media. Call this before the shapes of a new 2D animation frame.
Signature
clearCanvas(color)
Arguments
| Parameter | Type | Requirement |
|---|---|---|
color |
Text | Nonempty; use portable English/Dutch names or #RGB/#RRGGBB. |
Return value
None.
Example
# language: en
clearCanvas("wit")
circle(320, 180, 40, "blue")
A blue circle on white. Color data accepts both languages in either syntax locale.
Notes and common mistakes
Use the function name for your source language. Its canonical ID is a shared documentation label; you do not type that ID as a call. Giving your own variable or function the same name can hide the built-in. Supply the documented arguments and value types. Pliro reports mismatches when checking can detect them, or when the call runs.
A host is the app or environment running your program. To see a drawing, it needs a renderer, the part that draws on screen. The command-line command pliro run shows text but does not draw these graphics. The host support table explains which effects work in the IDE, browser, native app, and phone preview. A native build reports an unsupported capability instead of leaving it out.
2D uses a 640 × 360 scene with a top-left origin, +X right and +Y down. Both English and Dutch portable color names work in either syntax locale, as do #RGB and #RRGGBB. Other nonempty 2D color text is host-dependent.
Related entries
rectangle · circle · drawLine · drawText · Programming guides · Host support · Calls and arguments
