smartShape.elem.elements[0].contours[0].nodes[2].y = 125;
smartShape.elem.elements[0].contours[0].nodes[2].succX = 200;
smartShape.elem.elements[0].contours[0].nodes[2].succY = 125;
smartShape.elem.elements[0].contours[0].nodes[3] = new ContourNode;
smartShape.elem.elements[0].contours[0].nodes[3].predX = 0;
smartShape.elem.elements[0].contours[0].nodes[3].predY = 125;
smartShape.elem.elements[0].contours[0].nodes[3].x = 0;
smartShape.elem.elements[0].contours[0].nodes[3].y = 125;
smartShape.elem.elements[0].contours[0].nodes[3].succX = 0;
smartShape.elem.elements[0].contours[0].nodes[3].succY = 125;
smartShape.elem.elements[0].contours[0].isClosed = true;
}
The Auto Shape is an array of ContourNode objects (see
You can write a "helper" function to simplify the code and assign ContourNode properties, as
shown in the following example:
function addPathPoint(contour, i, x, y)
{
var theNodes = contour.nodes;
// Increase the length to add a new point
if (i > 0)
theNodes.length++;
// get the new point
var node = theNodes[theNodes.length - 1];
// Set the new point's values
node.x = node.predX = node.succX = x;
node.y = node.predY = node.succY = y;
}
You can then simplify the
function InsertSmartShapeAt()
{
var elem = smartShape.elem;
var newPath = new Path;
elem.elements[0] = newPath;
newPath.contours[0] = new Contour;
var contour = newPath.contours[0];
var i = 0;
addPathPoint(contour, i++, 0, 0);
addPathPoint(contour, i++, 200, 0);
addPathPoint(contour, i++, 200, 125);
addPathPoint(contour, i++, 0, 125);
contour.isClosed = true;
}
InsertSmartShapeAt()
"ContourNode object" on page
function with the new helper function:
Creating an Auto Shape
37).
125
Need help?
Do you have a question about the FIREWORKS 8-EXTENDING FIREWORKS and is the answer not in the manual?