如何更改html5画布的原点?
我找不到 html5 canvas 的答案。我可以更改原点坐标,以便我的图形将完全向右移动 15 像素(仅是一个示例)。给定以下 html 和 css?
<canvas id="g" width="auto" height="auto">Your browser doesnt support canvas tag</canvas>
CSS:
canvas, section {
display: block;
}
#g {
position: absolute;
width:100%;
height:100%;
overflow:hidden;
}
I couldn't find answers for html5 canvas. Can I change the coordinates of the origin, so that my grafics will move altogether to the right for 15px (just an example). Given the following html and css?
<canvas id="g" width="auto" height="auto">Your browser doesnt support canvas tag</canvas>
css:
canvas, section {
display: block;
}
#g {
position: absolute;
width:100%;
height:100%;
overflow:hidden;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
听起来你需要一个 翻译转换。根据您对上下文执行的其他操作,您可能还需要调用
save()
和restore()
。Sounds like you need a translate transform. Depending on what else you're doing with the context, you may also need to call
save()
andrestore()
.