Class AffineTransformBuilder

  • AffineTransformBuilder is used to build AffineTransform objects and defaults to the identity transform.

  • Call thebuild() method to get the AffineTransform object.

  • Methods are available to set scaling, shearing, and translation elements for both X and Y coordinates.

AffineTransformBuilder

A builder forAffineTransform objects. Defaults to the identity transform.

CallAffineTransformBuilder#build() to get theAffineTransform 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  ]}

Methods

MethodReturn typeBrief description
build()AffineTransformCreates anAffineTransform object initialized with the elements set in the builder.
setScaleX(scaleX)AffineTransformBuilderSets the X coordinate scaling element and returns the builder.
setScaleY(scaleY)AffineTransformBuilderSets the Y coordinate scaling element and returns the builder.
setShearX(shearX)AffineTransformBuilderSets the X coordinate shearing element and returns the builder.
setShearY(shearY)AffineTransformBuilderSets the Y coordinate shearing element and returns the builder.
setTranslateX(translateX)AffineTransformBuilderSets the X coordinate translation element in points, and returns the builder.
setTranslateY(translateY)AffineTransformBuilderSets the Y coordinate translation element in points, and returns the builder.

Detailed documentation

build()

Creates anAffineTransform object initialized with the elements set in the builder.

Return

AffineTransform


setScaleX(scaleX)

Sets the X coordinate scaling element and returns the builder.

Parameters

NameTypeDescription
scaleXNumber

Return

AffineTransformBuilder


setScaleY(scaleY)

Sets the Y coordinate scaling element and returns the builder.

Parameters

NameTypeDescription
scaleYNumber

Return

AffineTransformBuilder


setShearX(shearX)

Sets the X coordinate shearing element and returns the builder.

Parameters

NameTypeDescription
shearXNumber

Return

AffineTransformBuilder


setShearY(shearY)

Sets the Y coordinate shearing element and returns the builder.

Parameters

NameTypeDescription
shearYNumber

Return

AffineTransformBuilder


setTranslateX(translateX)

Sets the X coordinate translation element in points, and returns the builder.

Parameters

NameTypeDescription
translateXNumber

Return

AffineTransformBuilder


setTranslateY(translateY)

Sets the Y coordinate translation element in points, and returns the builder.

Parameters

NameTypeDescription
translateYNumber

Return

AffineTransformBuilder

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-12-11 UTC.