Files
processing4/mobile/web/reference/API/Object.xml
2005-01-27 06:48:42 +00:00

85 lines
1.3 KiB
XML

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<root>
<name>Object</name>
<category>Data</category>
<subcategory>Composite</subcategory>
<usage>Web &amp; Application</usage>
<example>
<image></image>
<code>
// Declare and contruct two objects (h1, h2) from the class HLine
HLine h1 = new HLine(20, 2.0);
HLine h2 = new HLine(50, 2.5);
void setup()
{
size(200, 200);
framerate(30);
}
void loop() {
background(204);
h1.update();
h2.update();
}
class HLine {
float ypos, speed;
HLine (float y, float s) {
ypos = y;
speed = s;
}
void update() {
ypos += speed;
if (ypos > width) {
ypos = 0;
}
line(0, ypos, width, ypos);
}
}
</code>
</example>
<description>
Objects are instances of classes. A class is a grouping of related methods (functions) and fields (variables and constants).
</description>
<syntax>
<c>class</c> <c>instance</c>
</syntax>
<parameter>
<label>class</label>
<description>the class to created the object from</description>
</parameter>
<parameter>
<label>instance</label>
<description>any variable name</description>
</parameter>
<returns></returns>
<related>
class
</related>
<availability>1.0</availability>
<type>Object</type>
<partof>PDE</partof>
</root>