本文介绍了HTML5翻译方法,如何重置为默认值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于HTML5的翻译方法将绘图的来源显然相对于其原来的来源移动。 (当我使用ctx.translate(20,20)连续两次我得到相同的结果,当我使用ctx.translate(40,40))
现在的问题是我想重置原始绘图到它的原始位置(在它之前使用的translate()它的位置),我该如何做?

Since HTML5's translate-method moves the origin of drawing relatively to its former origin apparently. (when I use ctx.translate(20,20) twice in a row I get the same result as when I use ctx.translate(40,40))Well now the problem is I'd like to reset the origin of drawing to its original position(the position it had before first useing of translate() on it), how do I do that?

推荐答案

ctx.setTransform(1, 0, 0, 1, 0, 0);

这篇关于HTML5翻译方法,如何重置为默认值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 06:16