Skip to content

Instantly share code, notes, and snippets.

@pkolchanov
pkolchanov / .py
Last active June 28, 2023 15:09
Tim Ahrens scaling
from dataclasses import dataclass
@dataclass
class Factor:
x: int
y: int
def interpolatedPosition(foregroundPosition, backgroundPosition, foregroundFactor, backgroundFactor):
interpolatedX = foregroundPosition.x * foregroundFactor.x + backgroundPosition.x * backgroundFactor.x
interpolatedY = foregroundPosition.y * foregroundFactor.y + backgroundPosition.y * backgroundFactor.y