Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

8 years ago by stcredzero

I've been getting some transform creep in my game, which uses some Javascript canvas commands to draw "vector" graphics. However, I am slowly getting some transform creep, despite going on a mission to apply context.save() and context.restore() in my code. Is there a good place in ImpactJS in which to add a context.resetTransform() statement? Is there a spot in the ImpactJS loop where the system expects the transform to be the identity matrix, or at which the current transform can be easily restored from side data, like the camera position?

8 years ago by Joncom

I think you have the correct idea. Just make sure you save() before performing a transform, and then restore() after drawing the transformed graphic(s).

8 years ago by stcredzero

Thanks. My latest test shows no creep.
Page 1 of 1
« first « previous next › last »