restore()¶
Метод restore()
восстанавливает предварительно сохраненное состояние канваса из стека.
Синтаксис¶
void ctx.restore();
Спецификация¶
Пример¶
const canvas = document.getElementById('canvas') const ctx = canvas.getContext('2d') // Save the default state ctx.save() ctx.fillStyle = 'green' ctx.fillRect(10, 10, 100, 100) // Restore the default state ctx.restore() ctx.fillRect(150, 40, 100, 100)
Ссылки¶
- restore() на MDN