Scale2DShape

Introduced

v3.0

Description

Resizes (scales) the 2D shape (mask shape). This is the scripting equivalent of selecting the shape, and clicking and dragging any of the handles on its bounding box.

Note: You may want to change where the center, or pin, of the shape appears before scaling it. For example, if you move the pin to the left of the shape and then rotate it, the shape grows faster on the right than on the left. To move the pin of the shape, use the Move2DShapePin command.

Scripting Syntax

Scale2DShape( [Shape], x, y );

Parameters

Parameter Type Description
Shape String Parameter path name for the shape you are scaling.

Default Value: Current selection.

Note: If the current selection is not a valid shape, an error occurs.

x Double Specifies the new position of the center in X.
y Double Specifies the new position of the center in Y.

Examples

VBScript Example

'

' This example demonstrates how to set a garbage matte mask for a 

' ColorCorrect operator in the FxTree, scale it, change the position

' of its center and then rotate it around the new center.

'

' Create a new FxTree 

set oTree = CreateFxTree()

' Get the projects path for the current system

sPath = InstallationPath( siProjectPath )

set oClip = CreateImageClip( sPath & "\Pictures\noIcon.pic", "NewClip" )

' Use the clip to create a new image clip operator

set oOperator = AddImageClipFxOp( oTree, oClip )

' Add a Color Correct operator to the same tree

set oCCOp = AddFxOp( oTree, "Color Correct" )

' Connect the two operators

ConnectFxOp oOperator, oCCOp, "1" 

' Since the ConnectFxOp command does not return the new operator,

' you need to get it from the OperatorCollection on the FxTree object

for each oMember in oTree.FxOperators

	if oMember.Name = "ColorCorrect" then

		set oGBMatteOp = oMember

		exit for

	end if

next

' Adjust the HSV Offset and Gain levels so you can see the 

' results of the color correction

SetValue oGBMatteOp.FullName & ".MasterHueShift," _

		& oGBMatteOp.FullName & ".MasterOffset," _

		& oGBMatteOp.FullName & ".MasterGain", _

		Array(0, 0.820731514055631, 0.852844886888196)

' Add the 2D shape (mask shape) to the GarbageMatte and reshape it so you can see

' the shape when you open the Fx Viewer with the ColorCorrect operator selected

set oRotospline = Add2DShape( oGBMatteOp & ".GarbageShapes", "Polygon" )

Move2DShapePin oRotospline, 114.75, 143

Add2DShapePoint oRotospline, 44, 194

Add2DShapePoint oRotospline, 65, 78

Add2DShapePoint oRotospline, 116, 138

Add2DShapePoint oRotospline, 169, 84

Add2DShapePoint oRotospline, 180, 207

Add2DShapePoint oRotospline, 153, 137

Add2DShapePoint oRotospline, 114, 172

Add2DShapePoint oRotospline, 77, 134

' Make the shape a little smaller

Scale2DShape oRotospline, 0.875486381322957, 0.784615384615384

' Pivot the shape on its bottom right corner

Move2DShapePin oRotospline, 154.75, 69

Set2DShapeRotation oRotospline, -50.6836714968651

See Also

Add2DShape Move2DShape Move2DShapePin Set2DShapeRotation