TransformPool

ceramic.TransformPool (Class)

An utility to reuse transform matrix object at application level.

TransformPool provides object pooling for Transform instances to reduce garbage collection pressure and improve performance when working with many temporary transform matrices.

Features:

  • Get pooled Transform instances instead of creating new ones
  • Recycle transforms when done to return them to the pool
  • Automatic cleanup of recycled transforms
  • Static pool shared across the application

Example usage:

// Get a transform from the pool
var transform = TransformPool.get();

// Use the transform
transform.translate(100, 200);
visual.transform = transform;

// When done, recycle it back to the pool
TransformPool.recycle(transform);

Static Members

get(): Transform

Get or create a transform. The transform object is ready to be used.

Returns
Transform

recycle(transform: Transform): Void

Recycle an existing transform. The transform will be cleaned up.

Name Type
transform Transform

clear(): Void

Clears the pool, removing all available transforms. Use this to free memory if the pool has grown too large.

Private Members

availableTransforms: Array<Transform>