-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
FAQ
kangax edited this page Jun 1, 2011
·
32 revisions
How can I reference existing objects on canvas?
`canvas.getObjects()` returns an array of all objects on canvas; `canvas.item(n)` returns n-th object on canvas (where indexing is associated with z-order)
How can I change object's properties?
Using fabric.Object#set
method (e.g.: rect.set('width', 100).set('height', 50)
or rect.set({ width: 100, height: 50 })
)
How can I change background color of canvas area?
Using "backgroundColor" property of fabric.Element
instance. E.g.: canvas.backgroundColor = 'red'
or canvas.backgroundColor = rgba(0, 255, 0, 0.5)