Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

怎么解决这个问题ctx.globalCompositeOperation='xor' #42

Closed
snowcrazy opened this issue Sep 15, 2018 · 4 comments
Closed

怎么解决这个问题ctx.globalCompositeOperation='xor' #42

snowcrazy opened this issue Sep 15, 2018 · 4 comments

Comments

@snowcrazy
Copy link

##怎么解决这个问题ctx.globalCompositeOperation='xor'啊##


<!DOCTYPE html>
<html>
<body>

<canvas id="myCanvas" width="300" height="400" style="border:1px solid #d3d3d3;">
Your browser does not support the HTML5 canvas tag.
</canvas>

<script>

var c=document.getElementById("myCanvas");
var ctx=c.getContext("2d");
ctx.globalCompositeOperation="xor";

ctx.fillStyle="red";
ctx.beginPath();
ctx.moveTo(100,60);
ctx.lineTo(160,120);
ctx.lineTo(100,180);
ctx.lineTo(40,120);
ctx.closePath();
ctx.fill();


ctx.fillStyle="bule";
ctx.beginPath();
ctx.lineTo(160,120);
ctx.lineTo(100,180);
ctx.lineTo(40,120);
ctx.closePath();
ctx.fill();


</script>

</body>
</html>

qq20180915-0

@snowcrazy
Copy link
Author

我的代码都写好了,测试得到这个图片,有bug吧

@cy0707
Copy link
Owner

cy0707 commented Sep 15, 2018

我问的是,你的问题是什么呢,你想得到什么呢。
你就是说了一句-----我的代码都写好了,测试得到这个图片,有bug吧
正常的流程不是,表达的你的代码是什么意思,你要得到的结果是什么的图呢,为什么结果跟你图不一样。

@cy0707 cy0707 closed this as completed Sep 15, 2018
@snowcrazy
Copy link
Author

qq20180915-2

上面就是我的代码,图片显示有斜线(应该是没有斜线),所以有bug

@snowcrazy
Copy link
Author

你测试我的代码又发现问题了,Thanks♪(・ω・)ノ

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants