processing 学习

draw()

  1. draw() is called automatically and should never be called explicitly.
  2. All Processing programs update the screen at the end of draw(), never earlier.
  3. Empty draw() keeps the program running

显示频率

  1. 显示变化的频率只由draw()频率决定,即frameRate()
  2. 个人理解:所以绘画暂时保存在内存某一缓冲区,draw()结尾时才输出到显存中
  3. event频率不收显示频率影响,一帧过程中可有多次event

pmouseX

1.Inside draw(), pmouseX and pmouseY update only once per frame (once per trip through the draw() loop). But inside mouse events, they update each time the event is called.

Java

  1. 函数外只允许定义变量,不允许有执行语句

key

  1. The key variable stores a single alphanumeric character. Specifically, it holds the most recently pressed key.
  2. The variable keyCode is used to detect special keys such as the arrow keys (UP, DOWN, LEFT, and RIGHT) as well as ALT, CONTROL, and SHIFT.

event

  1. Key presses and mouse movements are stored until the end of draw(), where they can take action that won’t disturb drawing that’s currently in progress.
  2. mousePressed key mouseX等变量在event中被更新,一帧的间隔可被更新多次

noLoop()

draw()中调用noLoop()不影响此次draw()的结果,只是之后不调用draw()了

text()

  1. By default, the second parameter defines the distance from the left edge of the window; the third parameter defines the distance from the text’s baseline to the top of the window.
  2. The textSize() function defines the size the letters will draw in units of pixels. The number used to define the text size will not be the precise height of each letter, the difference depends on the design of each font. For instance, the statement textSize(30); won’t necessarily draw a capital H at 30 pixels high.
  3. In the simplest use, the first parameter can be a String, char, int, or float. The second and third parameters set the position of the text. By default, the second parameter defines the distance from the left edge of the window; the third parameter defines the distance from the text’s baseline to the top of the window. 简单用法,定位左下
  4. Another version of text() draws the characters inside a rectangle. In this use, the second and third parameters define the position of the upper-left corner of the box and fourth and fifth parameters define the width and height of the box. 定位左上
  5. If the length of the text exceeds the dimensions of the defined box, the text will not display.

media

  1. To make media files accessible from anywhere in a program, they are typically declared as globally available variables outside of setup() and draw()
  2. Files are usually loaded inside setup() because they need only be loaded once and because it takes time to load them.

leading

leading ---- the spacing between lines of text

textAlign()

  1. Left 左下
  2. right 右下
  3. cneter 中下

tint()

  1. Sets the fill value for displaying images. Images can be tinted to specified colors or made transparent by including an alpha value.
  2. 缓冲区初始值RGB为0
  3. 亮度和透明度不同

textAlign()

  1. textAlign()默认LEFT BASELINE
    在这里插入图片描述
  2. When using text() with width and height parameters, BASELINE is ignored, and treated as TOP. (Otherwise, text would by default draw outside the box, since BASELINE is the default setting. BASELINE is not a useful drawing mode for text drawn in a rectangle.)
  3. 两种text()作用完全不同
    1. 带长宽的text()是在块内的相对位置
    2. 不带长宽的text()是相对于点的
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值