blockly > BlockSvg > translate
BlockSvg.translate() method
Transforms a block by setting the translation on the transform attribute of the block's SVG.
Signature:
translate(x: number, y: number): void;
Parameters
Parameter |
Type |
Description |
x |
number |
The x coordinate of the translation in workspace units. |
y |
number |
The y coordinate of the translation in workspace units. |
Returns:
void
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-09-18 UTC.
[null,null,["Last updated 2024-09-18 UTC."],[[["The `translate` method moves a block visually on the workspace by adjusting its x and y coordinates."],["This movement is achieved by directly manipulating the SVG transform attribute of the block."],["The method takes two arguments, `x` and `y`, representing the desired translation in workspace units."],["Calling `translate` does not return any value (void)."]]],[]]