Commit 68b6b767 authored by rockyl's avatar rockyl

init

parent 21a697ca
{
"id": "slider", "script": "\n//进度条背景\n//yun.duiba.com.cn/aurora/assets/21c385e9b5ad77889d790a71b35e8a6e1c189b0b.png\n\n//滑块按钮\n//yun.duiba.com.cn/aurora/assets/3af4e1925b2c030862dba3eef6424efa2a407bd8.png\n\n//进度条\n//yun.duiba.com.cn/aurora/assets/3e619a51b0b193cb627ed981c62a8eef0473bc9d.png\n\n\nconst slide = new engine.Image()\nslide.source = props.slideSource\n\nconst bg = new engine.Image()\nbg.source = props.bgSource\n\nconst bar = new engine.Image()\nbar.source = props.barSource\n\nconst mask = new engine.Rect()\n\n\nsetTimeout(() => {\n\n\t//遮罩\n\tmask.width = bar.width\n\tmask.height = bar.height\n\tmask.borderRadius = props.borderRadius\n\ttarget.addChild(mask)\n\n\t//进度条\n\tbar.mask = mask\n\ttarget.addChild(bg)\n\ttarget.addChild(bar)\n\tbar.x = -bar.width\n\n\t//滑块\n\tslide.x = -slide.width / 2\n\tslide.y = -(slide.height - bg.height) / 2\n\ttarget.addChild(slide)\n\ttarget.height = bar.height\n\ttarget.width = bg.width\n})\n\n\ntarget.addEventListener(engine.MouseEvent.MOUSE_MOVE, function (e) {\n\tif (e.localX < 0) {\n\t\tslide.x = -slide.width / 2\n\t\tbar.x = - bar.width\n\t} else if (e.localX > bg.width) {\n\t\tslide.x = bg.width - slide.width / 2\n\t\tbar.x = bg.width - bar.width\n\t} else {\n\t\tslide.x = e.localX + -slide.width / 2\n\t\tbar.x = e.localX - bar.width\n\t}\n\tconst per = (slide.x + slide.width / 2) / bg.width\n\t//抛出滑动比例\n\tengine.globalEvent.dispatchEvent(\"slidePer\", per)\n}, this)",
"props": {"slideSource": {"type": "string", "enum": [], "alias": "滑块图片"}, "bgSource": {"type": "string", "enum": [], "alias": "背景图片"}, "barSource": {"type": "string", "enum": [], "alias": "进度图片"}, "borderRadius": {"type": "number", "enum": [], "alias": "遮罩的圆角"}},
"isPrefab": true, "name": "滑杆节点", "output": [
"success",
"failed"
], "version": "0.1.1", "remark": "滑杆"
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment