Configuring Rotation and Movement

You can animate a visualization element so that is moves or rotates in runtime mode. To do this, you assign variables in its property Absolute movement and program the animation in the application code.

Configuring movement

You can configure the movement of an element by programming the variable in Absolute movement ‣ Movement.

  1. Open the visualization and added a Rectangle element.

    The Properties view shows the configuration of the element.

  2. In the application, declare variables with matching types in the PLC_PRG POU: diOffsetX : DINT; and diOffsetY : DINT;

  3. Configure the property Absolute movement ‣ Movement ‣ X with PLC_PRG.diOffsetX and Y with PLC_PRG.diOffsetY.

  4. Implement a movement of the element, for example by a modulo division of the value:

    diOffsetX := diOffsetX MOD 100;

    diOffsetY := diOffsetY MOD 100;

  5. Compile, download, and start the application.

    The application runs. The visualization opens. The rectangle moves.

Configuring a rotating element

When an element rotates, the midpoint of the element rotates precisely on its center. The center is defined in the property Center. The midpoint of an element is calculated internally. When the midpoint and the center come together, there is no rotation.

You can configure a clockwise rotation of the element by increasing the value of the variable Absolute movement ‣ Rotation.

  1. Open the visualization and added a Rectangle element.

    The Properties view shows the configuration of the element.

  2. In the application, declare a variable with matching type in the PLC_PRG POU: rValue : REAL;.

  3. Configure the property Absolute movement ‣ Rotation with PLC_PRG.rValue.

  4. Implement the clockwise rotation of the element by increasing the value of the variable:

    rValue := rValue + 0.1;

  5. Compile, download, and start the application.

    The application runs. The visualization opens. The rectangle rotates about the center. The alignment of the element is fixed according to the coordinate system.

    ../_images/f3db8f5b5c09a29ec0a8640e0029549a

Configuring a rotating element

When an element executes an internal rotation and rotates, the midpoint of the element rotates precisely on its center. That is the point defined in the Center property. Then the alignment of the element also rotates with respect to the coordinate system. If the midpoint of the element and center come together, then a rotation at that position results.

If the visualization is in runtime mode, then you can see that the element rotates (also in relation to the coordinate system of the visualization).

  1. Open the visualization and add a Polygon element that you shape into a pointer.

    The Properties view shows the configuration of the element.

  2. Specify a static angle of rotation also in the property Position ‣ Angle.

  3. Drag the center point of the element to the base of the pointer.

  4. In the application, declare a variable with matching type in the PLC_PRG POU.

    rValue : REAL;

  5. Configure the property Absolute movement ‣ Internal rotation with PLC_PRG.rValue.

  6. Implement the clockwise rotation of the element by increasing the value of the variable.

    rValue := rValue + 0.1;

  7. Compile, download, and start the application.

    The application runs. The visualization opens. The pointer rotates about its base. The angle of rotation increases continuously starting at the position that determines the static angle of rotation, because the static angle of rotation is added to the angle of rotation. The static angle of rotation acts as an offset.

    ../_images/472041a661516818c0a8640e00eb8e86

See also