Properties
Properties are how the canvas context2d api lets you set how functions draw their paths and shapes. Think of them in terms of css for the upcoming function calls. One a property is set, it persists until you set a different value, or load a previous canvas state.
All properties are accessible using the following standard API:
import { c } from 'declarativas';
c('nameOfProperty', { value: appropriateValueHere });
The
appropriateValueHere
can be tricky, but refer to the MDN Documentation for information on valid values for different properties. Some are strings, others are numbers.The only consistent mechanism I have found for resetting properties and general canvas state has been to use
save
and restore
canvas functions, which are documented in the Functions section.
Last modified 2yr ago