实现H5中区域判断 King.ShapeTouch

码农软件 · 软件分类 · HTML5开发相关 · 2019-03-07 08:57:58

软件介绍

ShapeTouch

ShapeTouch 该Javascript库用于实现H5中不规则图形按钮可点击区域的判断,特别用于H5游戏中的某些场景。

API 调用接口

king.shape.touch(src,x,y,callback)
king.shape.touchPoint(src,point,callback)

point对象示例:
The point object like this:

{x:9,y:25}

Return 返回值

Object {touch: true, alpha: 255} Or Object {touch: false, alpha: 0}

touch为true时,该点非透明,点击生效,alpha值大于0,touch为false时,该点透明,alpha为0.
(开发者也可以根据alpha的值自行判断点击是否生效)
The touch is true, the point is not transparent, the alpha value is greater than 0.

Use 使用

Html:添加引用后直接使用

<script type="text/javascript" src="ShapeTouch-min.js"></script>
<script type="text/javascript">
(function() {
  king.shape.touch('images/logo.png',20,40,function(result){
    console.log(result);
  });
});
</script>

Cocos creator:将文件放入assets即可,不需require

this.node.on('touchend', function (event) {
  var touchPoint = event.getLocation();
  var node = event.currentTarget;
  var nodePoint = node.convertToNodeSpace(touchPoint);
  var nodeSrc = node.getComponent(cc.Sprite).spriteFrame.getTexture().url;
  king.shape.touchPoint(nodeSrc,nodePoint,function(result){
    console.log(result);
  });
}, this);

本文地址:https://www.codercto.com/soft/d/805.html

来自圣经的证明

来自圣经的证明

M.Aigner、G.M.Ziegler / 世界图书出版公司 / 2006-7 / 39.00元

作为一门历史悠久的学问,数学有她自身的文化和美学,就像文学和艺术一样。一方面,数学家们在努力开拓新领域、解决老问题;另一方面他们也在不断地从不同的角度反复学习、理解和欣赏前辈们的工作。的确,数学中有许多不仅值得反复推敲理解,更值得细心品味和欣赏的杰作。有些定理的证明不仅想法奇特、构思精巧,作为一个整体更是天衣无缝。难怪,西方有些虔诚的数学家将这类杰作比喻为上帝的创造。 本书已被译成8种文字。......一起来看看 《来自圣经的证明》 这本书的介绍吧!

Markdown 在线编辑器
Markdown 在线编辑器

Markdown 在线编辑器

RGB HSV 转换
RGB HSV 转换

RGB HSV 互转工具

HEX HSV 转换工具
HEX HSV 转换工具

HEX HSV 互换工具