Basic pin rendering

This commit is contained in:
Matei Adriel 2019-07-17 14:17:15 +03:00
parent 259786ad98
commit 7427a02842
38 changed files with 510 additions and 115 deletions
src/common/canvas/helpers

View file

@ -0,0 +1,14 @@
import { Transform } from '../../math/classes/Transform'
import { multiply } from '../../../modules/vector2/helpers/basic'
export const useTransform = (
ctx: CanvasRenderingContext2D,
{ position, rotation, scale }: Transform
) => {
ctx.translate(...position)
ctx.translate(scale[0] / 2, scale[1] / 2)
ctx.rotate(rotation)
return new Transform(multiply(scale, -0.5), scale, 0)
}