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

mouseenter,mouseleave 会闪个不停 #25

Open
codingories opened this issue Oct 16, 2018 · 1 comment
Open

mouseenter,mouseleave 会闪个不停 #25

codingories opened this issue Oct 16, 2018 · 1 comment

Comments

@codingories
Copy link

codingories commented Oct 16, 2018

需要在图片上移动上去加一层效果,类似http://3dcampus.lzjtu.edu.cn/

`

<title>Title</title>
您的浏览器不支持canvas,请升级浏览器,显示此行文本。
<script src="javascript/omg.js"></script> <script> const stage = omg({ element: document.getElementById('canvas'), width: 500, height: 500, enableGlobalTranslate: true, enableGlobalScale: true, position: 'absolute', // 改变canvas.style.position images: [], // 预加载的图片列表,通常不用指定,因为使用接口绘制图片的时候,会自动预加载。 prepareImage: true, // 是否开启预加载图片 }); // 在init之前,你可以通过`stage.extend(yourShape)`拓展自定义的图形。 stage.init(); const rect = stage.graphs.rectangle({ x: 0, y: 0, width: 200, height: 200, opacity:0.3, color: "rgba(0,0,0,0.4)" }); const image = stage.graphs.image({ x: 0, y: 0, width: 200, height: 200, src: './pics/2.png' }).on('mouseenter', function(cur) { stage.addChild(rect); stage.redraw(); }).on('mouseleave',function () { stage.removeChild(rect); stage.redraw(); }); stage.addChild(image); stage.show(); </script>

`

@codingories
Copy link
Author

好吧 我自己解决了 设置下 cur.config({zindex: 20});就好了 虽然具体原理还是不清楚

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

1 participant