Skip to main content

StretchMode

Defines how an element should be stretched to fit a container.

TypeNameInterface Description
EnumFill = 4

Function: Scales the content to fill the container while maintaining its aspect ratio. The content may be cropped.

EnumFillAndCut = 5

Function: Alias for Fill. Scales the content to fill the container and crops if necessary.

EnumFit = 0

Function: Scales the content to fit the container while maintaining its aspect ratio. The content is not cropped.

EnumFitHeight = 2

Function: Scales the content to fit the container's height while maintaining its aspect ratio.

EnumFitWidth = 1

Function: Scales the content to fit the container's width while maintaining its aspect ratio.

EnumStretch = 3

Function: Stretches the content to fill the container, which may not preserve the aspect ratio.

EnumTextureSize = 6

Function: The content is not scaled and its original size is used.

Examples

Fill = 4

let value = APJS.StretchMode.Fill;

FillAndCut = 5

let value = APJS.StretchMode.FillAndCut;

Fit = 0

let value = APJS.StretchMode.Fit;

FitHeight = 2

let value = APJS.StretchMode.FitHeight;

FitWidth = 1

let value = APJS.StretchMode.FitWidth;

Stretch = 3

let value = APJS.StretchMode.Stretch;

TextureSize = 6

let value = APJS.StretchMode.TextureSize;

Use Case

@component()
export class NewBehaviourScript extends APJS.BasicScriptComponent {
onStart() {
// TODO: instantiate / use StretchMode here
}
onUpdate(deltaTime: number) {
}
}
Copyright © 2026 TikTok. All rights reserved.
About TikTokHelp CenterCareersContactLegalTerms of ServicePrivacy PolicyCookies