Processing API Structure(2)

 Structure(2)

********************************************************************

名称:    import

功能描述: 关键字import用来将库文件导入到Processing设计中。库是类的集合,用以扩展Processing的功能。*号经常放在import的行尾,用来一次装入所有相关的类。

    你可以用IDE工具Sketch菜单下的“Import Library…”菜单来创建导入声明。

语法:    import libraryName

参数:    libraryName  要装入的库的名字(如“processing.pdf.*”)

用途:    web和应用程序

********************************************************************

名称:    this

功能描述: 引用当前的对象。In Processing, it's most common to use this to pass a reference from the current object into one of the libraries. The keyword this can also be used in another way, but it is often not necessay. For example, if you are calling the filter() method of a PImage object named tree from another object, you would write tree.filter(). To call this method inside PImage itself one could simply write filter() or could more explicity write this.filter(). It's not incorrect to say this.filter() but it is not necessary as this is always implied.

用途:    web和应用程序

********************************************************************

名称:    false

功能描述:保留字,用来表示逻辑值“false”。只有类型为boolean的变量可以赋值为false

用途:    web和应用程序

相关:    true boolean

********************************************************************

名称:    noLoop()

功能描述:停止draw()内连续执行的代码。如果loop()被调用,draw()内的代码开始重新连续运行。如果在setup()中使用noLoop(),必须被放置在最后一行。

当使用了noLoop(),类似mousePressed()、keyPressed()的屏幕内部事件将不能访问或者处理。作为替代,调用redraw()或者loop(),他们可以运行draw(),可以更新屏幕的属性。当noLoop()调用后,将没有任何绘图工作发生,类似于saveFrame()或者loadPixels()的函数也不能使用。

注意,当sketch调整大小的时候,即使在使用了noLoop()后,redraw()仍然会被调用以更新sketch。否则,sketch会进入到奇怪的状态知道调用了loop()函数。

语法:    noLoop()

返回值:  None

用途:    web和应用程序

相关:    loop() redraw() draw()

********************************************************************

名称:    true

功能描述:保留字,用来表示逻辑值“false”。只有类型为boolean的变量可以赋值为true

语法:   

参数:   

用途:    web和应用程序

相关:    false boolean

********************************************************************

名称:    new

例子:   

HLine h1 = new HLine();

float[] speeds = new float[3];

float ypos;

void setup() {

  size(200, 200);

  speeds[0] = 0.1;

  speeds[1] = 2.0;

  speeds[2] = 0.5;

}

void draw() {

  ypos += speeds[int(random(3))];

  if (ypos > width) {

    ypos = 0;

  }

  h1.update(ypos);

}

class HLine {

  void update(float y) {

    line(0, y, width, y);

  }

}

功能描述:创建一个“新”对象。关键字new的用法如上面的例子类似。在这个例子中,创建了一个数据类型为“Hline”的新对象“h1”。在下面的一行,创建了一个名为“speeds”的浮点型数组。

用途:    web和应用程序

********************************************************************

名称:    //(注释)

功能描述:

语法:    //comment

参数:    comment  任意字符

用途:    web和应用程序

相关:    /* */(多行注释)

          /** */doc comment

********************************************************************

名称:    ,(逗号)

功能描述: 函数调用时用来分隔参数用,赋值时用来分隔元素

语法:    value1valueN

参数:    value1 任意int, float, byte, boolean, color, char, String

          valueN

用途:    web和应用程序

********************************************************************

名称:    delay()

功能描述:强迫程序停止运行指定时间长度。延迟时间的最小单位为毫秒(ms)。delay3000)表示让程序停止运行3秒钟。

    屏幕只在draw()结束时更新,所以当使用的delay()后(执行delay()过程中,不能刷新屏幕),屏幕表现为“冻结”现象。

语法:    delaymilliseconds

参数:    milliseconds  整数:指定延迟的毫秒数

返回值: 

用途:    web和应用程序

********************************************************************

名称:    pushStyle()

功能描述:pushStyle()函数保存当前类型设置,popStyle()回复先前的类型设置。注意这两个函数通常一起使用。

语法:   

参数:   

用途:    web和应用程序

相关:    

********************************************************************

名称:    { }(花括号)

功能描述:

语法:   

参数:   

用途:    web和应用程序

相关:   

********************************************************************

名称:    /** */

功能描述:

语法:   

参数:   

用途:    web和应用程序

相关:   

********************************************************************

名称:    draw()

功能描述: setup()后直接调用,一直执行该函数内部的所有代码直到程序停止或者noLoop()函数被调用为止。draw()自动被调用,永远不会被显式调用。draw()永远受控于noLoop()、redraw()和loop()。

语法:   

参数:   

用途:    web和应用程序

相关:   

********************************************************************

名称:    loop()

功能描述:促使draw()内的程序继续连续运行。如果调用了noLoop()函数,那么draw()内的代码将停止执行。

语法:    loop()

          redraw()

          draw()

返回值: 

用途:    web和应用程序

相关:    noLoop()

********************************************************************

名称:    implements

功能描述:Implements an interface or group of interfaces. Interfaces are used to establish a protocol between classes, they establish the form for a class (method names, return types, etc.) but no implementation. After implementation, an interface can be used and extended like any other class. Because Java doesn't allow extending more than one class at a time, interfaces are created, which means specific methods and fields can be found in the class which implements it. A Thread is an example; it implements the "Runnable" interface, which means the class has a method called "public void run()" inside it.

用途:    web和应用程序

********************************************************************

名称:    redraw()

功能描述:将draw()内的代码执行一次。此功能允许用户仅在需要的时候更新一次显示窗口的内容,例如,当已注册的mousePressed()或者keyPressed()事件发生时。

在结构化的程序中,只有在类似mousePressed()的事件中调用redraw()才有意义。redraw()并不是立即运行draw(),只是设置一个标志位来标识需要更新显示窗口的内容。

draw()中调用redraw()对程序不会产生任何影响,因为draw()本身就在连续执行。

语法:    redraw()

返回值: 

用途:    web和应用程序

相关:    noLoop() loop()

********************************************************************

名称:    static

功能描述:Keyword used to define a variable as a "class variable" and a method as a "class method." When a variable is declared with the static keyword, all instances of that class share the same variable. When a class is defined with the static keyword, it's methods can be used without making an instance of the class. The above examples demonstrate each of these uses.

This keyword is an essential part of Java programming and is not usually used with Processing. Consult a Java language reference or tutorial for more information, such as this one.

用途:    web和应用程序

********************************************************************

名称:    ;(分号)

功能描述:A statement terminator which separates elements of the program. A statement is a complete instruction to the computer and the semicolon is used to separate instructions (this is similar to the period "." in written English). Semicolons are also used to separate the different elements of a for structure.

语法:    statement

参数:    statement  一条需要执行的语句

用途:    web和应用程序

相关:    for

********************************************************************

名称:    final

功能描述:声明不可以改变的值、类或者方法的关键字。如果用final定义了一个变量,那么这个变量将不能被改变。If the final keyword is used to define a variable, the variable can't be changed within the program. When used to define a class, a final class cannot be subclassed. When used to define a method, a final method can't be overridden by subclasses.

This keyword is an essential part of Java programming and is not usually used with Processing. Consult a Java language reference or tutorial for more information, such as this one.

用途:    web和应用程序

********************************************************************

名称:    [ ](访问数组)

功能描述:

语法:   

参数:   

用途:    web和应用程序

相关:   

 

********************************************************************

名称:    extends

功能描述:

语法:   

参数:   

用途:    web和应用程序

相关:   

 

********************************************************************

名称:    null

功能描述:null是个特殊的值,常用来表示目标是一个无效的数据元素。In Processing, you may run across the keyword null when trying to access data which is not there

用途:    web和应用程序

********************************************************************

名称:    private

功能描述: Keyword used to disallow other classes access the fields and methods within a class. The private keyword is used before a field or method that you want to be available only within the class. In Processing, all fields and methods are public unless otherwise specified by the private keyword.

This keyword is an essential part of Java programming and is not usually used with Processing. Consult a Java language reference or tutorial for more information.

用途:    web和应用程序

相关:    public

********************************************************************

名称:    ()(圆括号)

功能描述:

语法:   

参数:   

用途:    web和应用程序

相关:   

********************************************************************

名称:    public

功能描述:

用途:    web和应用程序

相关:   

********************************************************************

名称:    popStyle()

功能描述:

语法:   

参数:   

用途:    web和应用程序

相关:   

********************************************************************

名称:    return

功能描述:

语法:   

参数:   

用途:    web和应用程序

相关:   

********************************************************************

名称:    =(赋值)

功能描述:

语法:    var = value

参数:    var    任何有效的变量名称

          value   任何和变量类型一致的值。例如,如果变量类型为int,那么值也必须为int型。

用途:    web和应用程序

相关:    +=(加法赋值) -=(减法赋值)

********************************************************************

名称:    extends

功能描述:

语法:   

参数:   

用途:    web和应用程序

********************************************************************

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值