Sierpinski triangle/Graphical: Difference between revisions

(ActionScript)
Line 6:
 
=={{header|ActionScript}}==
SierpenskiTriangleSierpinskiTriangle class:
<lang ActionScript3>
package {
Line 14:
/**
* A SierpenskiSierpinski triangle.
*/
public class SierpinskiTriangle extends Sprite {
/**
* Creates a new SierpenskiTriangleSierpinskiTriangle object.
*
* @param n The order of the SierpenskiSierpinski triangle.
* @param c1 The background colour.
* @param c2 The foreground colour.
Line 34:
* Generates the triangle.
*
* @param n The order of the SierpenskiSierpinski triangle.
* @param c1 The background colour.
* @param c2 The foreground colour.
Line 65:
return;
// Recursively generate three SierpenskiSierpinski triangles of half the size and order n - 1 and position them appropriately.
var sub1:SierpinskiTriangle = new SierpinskiTriangle(n - 1, c1, c2, width / 2, height / 2);
Anonymous user