Open a new scene in Toon Boom Harmony, delete all nodes in the node view and save the scene.
Value = refValue * 2
Making an ExpressionOpen the "Xsheet" window and create a new column by clicking on the "Add Columns" button.
Make sure its type is set to "Expression" and name it "myExpression".
Double click on the title of the "myExpression" column to edit it. You can modify the output of an expression column by creating the variable "Value" and giving it an assignment. Here we are setting "Value" to 3.
This has set every frame of the Xsheet for the "myExpression" column to 3. You can inspect the value of any cell in the Xsheet by clicking on it.
Connecting an Expression to an Attribute
You can connect "myExpression" to an attribute by clicking on the drop-down menu next to the value of a specific attribute, go to "Unconnected" and you should see "myExpression" as the only option.
When connected, the attributes value should show the name of the expression column it is connected to and its resulting value: "myExpressions" and "3 E" ( E & N are +ve and W & S are -ve of origin ).
Getting an Expression to read from an Attribute
To get a expression we first have to send that inforation to the Xsheet so that it is readable by expressions in the Xsheet.
First "Create Bezier" for value that you want to read.
Then set that attribute back to "Local".
Now connect that same attribute to its original Bezier.
We now have an attribute that updates as the peg is transformed, that can be renamed (very useful when your expressions get complex) and can be read by Xsheet expressions.
Now create a drawing to attach under "Peg_A" so that we can make a tween on it. Make sure that the Xsheet information for "Peg_A_Pos_y" changes over time like below.
We can now reference Peg_A's Y position information in our expression. We can access that reference with the simple function below which multiplies the referenced value by 2.
Simple FunctionrefValue = value("Peg_A_Pos_y")
Value = refValue * 2
Expressions do not calculate instantly. They will update after you release the mouse on a transformation.