Capítulo 136 de 411

Chapter 136: gsap.utils.getUnit()

Core Idea

getUnit() extracts the unit suffix from a string where a number comes first, then a unit.

Reference Tables

ParameterTypeDescription
valueStringvalue to extract the unit from

Returns: String.

Code Examples

gsap.utils.getUnit("50%"); // "%"
gsap.utils.getUnit("100vw"); // "vw"

Connects To

  • gsap.utils.unitize(): applies a unit-aware transform function to a value.