updateTranslations method

  1. @override
void updateTranslations()
override

Implementation

@override
void updateTranslations() {
  xDepth = lightSource.dx * depth;
  yDepth = lightSource.dy * depth;
  xPadding = 2 * (1 - lightSource.dx.abs()) * depth;
  yPadding = 2 * (1 - lightSource.dy.abs()) * depth;

  witheShadowLeftTranslation = xDepth - xPadding;
  witheShadowTopTranslation = yDepth - yPadding;

  blackShadowLeftTranslation = -(xDepth + xPadding);
  blackShadowTopTranslation = -(yDepth + yPadding);

  scaledWidth = width + 2 * xPadding;
  scaledHeight = height + 2 * yPadding;

  scaleX = scaledWidth / width;
  scaleY = scaledHeight / height;
}