-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathp5CommandFactory.js
39 lines (38 loc) · 1.31 KB
/
p5CommandFactory.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
function makeCommand(parent,c)
{
if ( $(c).hasClass("var-def") )
return new p5CommandVariableDef(parent,$(c));
else if ( $(c).hasClass("loop-for") )
return new p5LoopFor(parent,$(c));
return new p5CommandFunctionCall(parent,$(c))
}
function makeGraphic(command)
{
if (command.name == "background")
return new p5Background(command);
else if (command.name == "strokeWeight")
return new p5StrokeWeight(command);
else if (command.name == "stroke")
return new p5Stroke(command);
else if (command.name == "noStroke")
return new p5NoStroke(command);
else if (command.name == "fill")
return new p5Fill(command);
else if (command.name == "line")
return new p5Line(command);
else if (command.name == "circle")
return new p5Circle(command);
else if (command.name == "rect")
return new p5Rect(command);
else if (command.name == "triangle")
return new p5Triangle(command);
else if (command.name == "arc")
return new p5Arc(command);
else if (command.name == "beginShape")
return new p5BeginShape(command);
else if (command.name == "endShape")
return new p5EndShape(command);
else if (command.name == "vertex")
return new p5Vertex(command);
return null;
}