godot-start/doc/demo09_canvas/canvas.md

29 lines
738 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

# 1. CanvasItem之draw和update
- Canvas是画布的意思所以CanvasItem代表了就是可以被绘制节点可以设置可视化界面和材质的颜色
![Image text](image/canvas1.png)
- 所有的2D节点和GUI节点都继承于CanvasItem节点
![Image text](image/canvas2.png)
- CanvasItem是按树的树的深度优先遍历顺序绘制的
![Image text](image/canvas3.png)
- draw指定了要绘制的东西
![Image text](image/canvas4.png)
- 当要draw绘制的改变了需要调用update
![Image text](image/canvas5.png)
- hide和show隐藏和现实节点
![Image text](image/canvas6.png)
- CanvasItem可以绘制直线正方形长方形图片
![Image text](image/canvas7.png)