Class AffineTransformBuilder
Stay organized with collections
Save and categorize content based on your preferences.
AffineTransformBuilder
A builder for AffineTransform
objects. Defaults to the identity transform.
Call AffineTransformBuilder#build()
to get the AffineTransform
object.
const transform =
SlidesApp.newAffineTransformBuilder().setScaleX(2.0).setShearY(1.1).build();
// The resulting transform matrix is
// [ 2.0 0.0 0.0 ]
// [ 1.1 1.0 0.0 ]
// [ 0 0 1 ]
}
Detailed documentation
setScaleX(scaleX)
Sets the X coordinate scaling element and returns the builder.
Parameters
Name | Type | Description |
scaleX | Number | |
Return
AffineTransformBuilder
setScaleY(scaleY)
Sets the Y coordinate scaling element and returns the builder.
Parameters
Name | Type | Description |
scaleY | Number | |
Return
AffineTransformBuilder
setShearX(shearX)
Sets the X coordinate shearing element and returns the builder.
Parameters
Name | Type | Description |
shearX | Number | |
Return
AffineTransformBuilder
setShearY(shearY)
Sets the Y coordinate shearing element and returns the builder.
Parameters
Name | Type | Description |
shearY | Number | |
Return
AffineTransformBuilder
Sets the X coordinate translation element in points, and returns the builder.
Parameters
Name | Type | Description |
translateX | Number | |
Return
AffineTransformBuilder
setTranslateY(translateY)
Sets the Y coordinate translation element in points, and returns the builder.
Parameters
Name | Type | Description |
translateY | Number | |
Return
AffineTransformBuilder
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-12-02 UTC.
[null,null,["Last updated 2024-12-02 UTC."],[[["\u003cp\u003e\u003ccode\u003eAffineTransformBuilder\u003c/code\u003e helps create custom transformations for objects in Google Slides, like scaling or shearing.\u003c/p\u003e\n"],["\u003cp\u003eIt provides methods to set scaling, shearing, and translation values for the X and Y coordinates.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003ebuild()\u003c/code\u003e method finalizes the transformation and returns an \u003ccode\u003eAffineTransform\u003c/code\u003e object, ready to be applied.\u003c/p\u003e\n"],["\u003cp\u003eThis builder uses a fluent interface, allowing you to chain methods together for concise transformation definitions.\u003c/p\u003e\n"]]],["`AffineTransformBuilder` constructs `AffineTransform` objects, defaulting to the identity transform. It uses methods like `setScaleX`, `setScaleY`, `setShearX`, `setShearY`, `setTranslateX`, and `setTranslateY` to modify the transformation elements. Each 'set' method takes a number parameter, and returns the builder. The `build()` method creates the `AffineTransform` object with the specified elements.\n"],null,["# Class AffineTransformBuilder\n\nAffineTransformBuilder\n\nA builder for [AffineTransform](/apps-script/reference/slides/affine-transform) objects. Defaults to the identity transform.\n\nCall `Affine``Transform``Builder#build()` to get the [AffineTransform](/apps-script/reference/slides/affine-transform) object.\n\n```text\nconst transform =\n SlidesApp.newAffineTransformBuilder().setScaleX(2.0).setShearY(1.1).build();\n\n// The resulting transform matrix is\n// [ 2.0 0.0 0.0 ]\n// [ 1.1 1.0 0.0 ]\n// [ 0 0 1 ]\n}\n``` \n\n### Methods\n\n| Method | Return type | Brief description |\n|-----------------------------------------------------|-------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------|\n| [build()](#build()) | [AffineTransform](/apps-script/reference/slides/affine-transform) | Creates an [AffineTransform](/apps-script/reference/slides/affine-transform) object initialized with the elements set in the builder. |\n| [setScaleX(scaleX)](#setScaleX(Number)) | [AffineTransformBuilder](#) | Sets the X coordinate scaling element and returns the builder. |\n| [setScaleY(scaleY)](#setScaleY(Number)) | [AffineTransformBuilder](#) | Sets the Y coordinate scaling element and returns the builder. |\n| [setShearX(shearX)](#setShearX(Number)) | [AffineTransformBuilder](#) | Sets the X coordinate shearing element and returns the builder. |\n| [setShearY(shearY)](#setShearY(Number)) | [AffineTransformBuilder](#) | Sets the Y coordinate shearing element and returns the builder. |\n| [setTranslateX(translateX)](#setTranslateX(Number)) | [AffineTransformBuilder](#) | Sets the X coordinate translation element in points, and returns the builder. |\n| [setTranslateY(translateY)](#setTranslateY(Number)) | [AffineTransformBuilder](#) | Sets the Y coordinate translation element in points, and returns the builder. |\n\nDetailed documentation\n----------------------\n\n### `build()`\n\nCreates an [AffineTransform](/apps-script/reference/slides/affine-transform) object initialized with the elements set in the builder.\n\n#### Return\n\n\n[AffineTransform](/apps-script/reference/slides/affine-transform)\n\n*** ** * ** ***\n\n### `set``Scale``X(scaleX)`\n\nSets the X coordinate scaling element and returns the builder.\n\n#### Parameters\n\n| Name | Type | Description |\n|----------|----------|-------------|\n| `scaleX` | `Number` | |\n\n#### Return\n\n\n[AffineTransformBuilder](#)\n\n*** ** * ** ***\n\n### `set``Scale``Y(scaleY)`\n\nSets the Y coordinate scaling element and returns the builder.\n\n#### Parameters\n\n| Name | Type | Description |\n|----------|----------|-------------|\n| `scaleY` | `Number` | |\n\n#### Return\n\n\n[AffineTransformBuilder](#)\n\n*** ** * ** ***\n\n### `set``Shear``X(shearX)`\n\nSets the X coordinate shearing element and returns the builder.\n\n#### Parameters\n\n| Name | Type | Description |\n|----------|----------|-------------|\n| `shearX` | `Number` | |\n\n#### Return\n\n\n[AffineTransformBuilder](#)\n\n*** ** * ** ***\n\n### `set``Shear``Y(shearY)`\n\nSets the Y coordinate shearing element and returns the builder.\n\n#### Parameters\n\n| Name | Type | Description |\n|----------|----------|-------------|\n| `shearY` | `Number` | |\n\n#### Return\n\n\n[AffineTransformBuilder](#)\n\n*** ** * ** ***\n\n### `set``Translate``X(translateX)`\n\nSets the X coordinate translation element in points, and returns the builder.\n\n#### Parameters\n\n| Name | Type | Description |\n|--------------|----------|-------------|\n| `translateX` | `Number` | |\n\n#### Return\n\n\n[AffineTransformBuilder](#)\n\n*** ** * ** ***\n\n### `set``Translate``Y(translateY)`\n\nSets the Y coordinate translation element in points, and returns the builder.\n\n#### Parameters\n\n| Name | Type | Description |\n|--------------|----------|-------------|\n| `translateY` | `Number` | |\n\n#### Return\n\n\n[AffineTransformBuilder](#)"]]