From eee15dd6f01a79c987abbfe473f4630117e0bbf4 Mon Sep 17 00:00:00 2001 From: caizhitao Date: Thu, 19 Dec 2019 10:52:32 +0800 Subject: [PATCH 01/24] =?UTF-8?q?=E5=88=9D=E6=AD=A5=E5=8A=A0=E5=85=A5?= =?UTF-8?q?=E5=A4=96=E5=8F=91=E5=85=89=E6=95=88=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/effects/outter-glow.effect | 133 ++ assets/effects/outter-glow.effect.meta | 17 + assets/materials/outter-glow.mtl | 25 + assets/materials/outter-glow.mtl.meta | 6 + assets/scenes/OutlineEffectScene.fire | 10 +- assets/scenes/OutterGlowEffectScene.fire | 1310 +++++++++++++++++ assets/scenes/OutterGlowEffectScene.fire.meta | 7 + assets/scripts/OutterGlowEffectScene.ts | 41 + ....ts.meta => OutterGlowEffectScene.ts.meta} | 2 +- assets/scripts/SpriteOutlineCrtl.ts | 21 - 10 files changed, 1545 insertions(+), 27 deletions(-) create mode 100644 assets/effects/outter-glow.effect create mode 100644 assets/effects/outter-glow.effect.meta create mode 100644 assets/materials/outter-glow.mtl create mode 100644 assets/materials/outter-glow.mtl.meta create mode 100755 assets/scenes/OutterGlowEffectScene.fire create mode 100644 assets/scenes/OutterGlowEffectScene.fire.meta create mode 100644 assets/scripts/OutterGlowEffectScene.ts rename assets/scripts/{SpriteOutlineCrtl.ts.meta => OutterGlowEffectScene.ts.meta} (74%) delete mode 100644 assets/scripts/SpriteOutlineCrtl.ts diff --git a/assets/effects/outter-glow.effect b/assets/effects/outter-glow.effect new file mode 100644 index 0000000..a4eeaad --- /dev/null +++ b/assets/effects/outter-glow.effect @@ -0,0 +1,133 @@ +// Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. +// 外发光特效 +CCEffect %{ + techniques: + - passes: + - vert: vs + frag: fs + blendState: + targets: + - blend: true + rasterizerState: + cullMode: none + properties: + texture: { value: white } + alphaThreshold: { value: 0.5 } + outlineColor: { value: [1.0, 1.0, 0.0, 1.0], editor: { type: color } } + outlineSize: { value: 0.01 } +}% + + +CCProgram vs %{ + precision highp float; + + #include + #include + + in vec3 a_position; + in vec4 a_color; + out vec4 v_color; + + #if USE_TEXTURE + in vec2 a_uv0; + out vec2 v_uv0; + #endif + + void main () { + vec4 pos = vec4(a_position, 1); + + #if CC_USE_MODEL + pos = cc_matViewProj * cc_matWorld * pos; + #else + pos = cc_matViewProj * pos; + #endif + + #if USE_TEXTURE + v_uv0 = a_uv0; + #endif + + v_color = a_color; + + gl_Position = pos; + } +}% + + +CCProgram fs %{ + precision highp float; + + #include + + in vec4 v_color; + + #if USE_TEXTURE + in vec2 v_uv0; + uniform sampler2D texture; + #endif + + #if SHOW_OUT_LINE + + uniform Outline { + // 描边颜色 + vec4 outlineColor; + // 描边偏移大小 + float outlineSize; + // 特别地,必须是 vec4 先于 float 声明 + }; + + // 将图像往8个方向偏移后,得到一个类放大效果,然后取放大后的图像的透明度,即可得到一个放大后的区域,可以很方便填充(描边)颜色 + // 取当前点上、下、左、右、上左、上右、下左、下右共计8个方向,距离为 outlineSize 的8个点,求他们的透明度之和 + // 由此可以得到当前点是否属于图像往八个方向做偏移后得到的放大图区域,并且能得到该点最终透明度值 + // 最终对应的为图像偏移/放大后的背景区域 + float getBgAlpha() { + vec4 color_up = texture(texture, v_uv0 + vec2(0, outlineSize)); + vec4 color_down = texture(texture, v_uv0 - vec2(0, outlineSize)); + vec4 color_left = texture(texture, v_uv0 - vec2(outlineSize, 0)); + vec4 color_right = texture(texture, v_uv0 + vec2(outlineSize, 0)); + vec4 color_up_left = texture(texture, v_uv0 + vec2(outlineSize, -outlineSize)); + vec4 color_up_right = texture(texture, v_uv0 + vec2(outlineSize, outlineSize)); + vec4 color_down_left = texture(texture, v_uv0 + vec2(-outlineSize, -outlineSize)); + vec4 color_down_right = texture(texture, v_uv0 + vec2(-outlineSize, outlineSize)); + float total = color_right.a + color_left.a + color_down.a + color_up.a + color_up_left.a + color_up_right.a + color_down_left.a + color_down_right.a; + total *= 0.125; + return clamp(total, 0.0, 1.0); + } + + #endif + + void main () { + vec4 o = vec4(1, 1, 1, 1); + + #if USE_TEXTURE + o *= texture(texture, v_uv0); + #if CC_USE_ALPHA_ATLAS_TEXTURE + o.a *= texture2D(texture, v_uv0 + vec2(0, 0.5)).r; + #endif + #endif + + o *= v_color; + + ALPHA_TEST(o); + + gl_FragColor = o; + + #if SHOW_OUT_LINE + // 先画背景色 + vec4 color_dest = outlineColor * getBgAlpha(); + + // 然后在背景色上方画图案颜色 + vec4 color_src = o; + + // 按照这个顺序,源颜色就是图案颜色,目标颜色就是背景色 + // 所以命名就是 color_src, color_dest + + // 按照混合颜色规则 http://docs.cocos.com/creator/manual/zh/advanced-topics/ui-auto-batch.html#blend-%E6%A8%A1%E5%BC%8F + // 要在底色上方,画一个图案,图案完全挡住底色,那么最终选择的混合模式如下: + // color_src: GL_SRC_ALPHA + // color_dest: GL_ONE_MINUS_SRC_ALPHA + // 即最终颜色如下: + // color_src * GL_SRC_ALPHA + color_dest * GL_ONE_MINUS_SRC_ALPHA + gl_FragColor = color_src * color_src.a + color_dest * (1.0 - color_src.a); + #endif + } +}% diff --git a/assets/effects/outter-glow.effect.meta b/assets/effects/outter-glow.effect.meta new file mode 100644 index 0000000..9107921 --- /dev/null +++ b/assets/effects/outter-glow.effect.meta @@ -0,0 +1,17 @@ +{ + "ver": "1.0.23", + "uuid": "9874f91b-8c4d-42a7-975a-a6281b46f3ed", + "compiledShaders": [ + { + "glsl1": { + "vert": "\nprecision highp float;\nuniform mat4 cc_matViewProj;\nuniform mat4 cc_matWorld;\n\nattribute vec3 a_position;\nattribute vec4 a_color;\nvarying vec4 v_color;\n\n#if USE_TEXTURE\nattribute vec2 a_uv0;\nvarying vec2 v_uv0;\n#endif\n\nvoid main () {\n vec4 pos = vec4(a_position, 1);\n\n #if CC_USE_MODEL\n pos = cc_matViewProj * cc_matWorld * pos;\n #else\n pos = cc_matViewProj * pos;\n #endif\n\n #if USE_TEXTURE\n v_uv0 = a_uv0;\n #endif\n\n v_color = a_color;\n\n gl_Position = pos;\n}\n", + "frag": "\nprecision highp float;\n\n#if USE_ALPHA_TEST\n \n uniform float alphaThreshold;\n#endif\n\nvoid ALPHA_TEST (in vec4 color) {\n #if USE_ALPHA_TEST\n if (color.a < alphaThreshold) discard;\n #endif\n}\n\nvoid ALPHA_TEST (in float alpha) {\n #if USE_ALPHA_TEST\n if (alpha < alphaThreshold) discard;\n #endif\n}\n\nvarying vec4 v_color;\n\n#if USE_TEXTURE\nvarying vec2 v_uv0;\nuniform sampler2D texture;\n#endif\n\n#if SHOW_OUT_LINE\n\nuniform vec4 outlineColor;\nuniform float outlineSize;\n\nfloat getBgAlpha() {\n vec4 color_up = texture2D(texture, v_uv0 + vec2(0, outlineSize)); \n vec4 color_down = texture2D(texture, v_uv0 - vec2(0, outlineSize)); \n vec4 color_left = texture2D(texture, v_uv0 - vec2(outlineSize, 0)); \n vec4 color_right = texture2D(texture, v_uv0 + vec2(outlineSize, 0)); \n vec4 color_up_left = texture2D(texture, v_uv0 + vec2(outlineSize, -outlineSize)); \n vec4 color_up_right = texture2D(texture, v_uv0 + vec2(outlineSize, outlineSize)); \n vec4 color_down_left = texture2D(texture, v_uv0 + vec2(-outlineSize, -outlineSize)); \n vec4 color_down_right = texture2D(texture, v_uv0 + vec2(-outlineSize, outlineSize)); \n float total = color_right.a + color_left.a + color_down.a + color_up.a + color_up_left.a + color_up_right.a + color_down_left.a + color_down_right.a; \n total *= 0.125;\n return clamp(total, 0.0, 1.0);\n}\n\n#endif\n\nvoid main () {\n vec4 o = vec4(1, 1, 1, 1);\n\n #if USE_TEXTURE\n o *= texture2D(texture, v_uv0);\n #if CC_USE_ALPHA_ATLAS_TEXTURE\n o.a *= texture2D(texture, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #endif\n\n o *= v_color;\n\n ALPHA_TEST(o);\n\n gl_FragColor = o;\n\n #if SHOW_OUT_LINE\n\n vec4 color_dest = outlineColor * getBgAlpha();\n\n vec4 color_src = o;\n\n gl_FragColor = color_src * color_src.a + color_dest * (1.0 - color_src.a);\n #endif\n}\n" + }, + "glsl3": { + "vert": "\nprecision highp float;\nuniform CCGlobal {\n vec4 cc_time;\n\n vec4 cc_screenSize;\n\n vec4 cc_screenScale;\n\n vec4 cc_nativeSize;\n\n mat4 cc_matView;\n mat4 cc_matViewInv;\n mat4 cc_matProj;\n mat4 cc_matProjInv;\n mat4 cc_matViewProj;\n mat4 cc_matViewProjInv;\n vec4 cc_cameraPos;\n\n vec4 cc_exposure;\n\n vec4 cc_mainLitDir;\n\n vec4 cc_mainLitColor;\n\n vec4 cc_ambientSky;\n vec4 cc_ambientGround;\n};\nuniform CCLocal {\n mat4 cc_matWorld;\n mat4 cc_matWorldIT;\n};\n\nin vec3 a_position;\nin vec4 a_color;\nout vec4 v_color;\n\n#if USE_TEXTURE\nin vec2 a_uv0;\nout vec2 v_uv0;\n#endif\n\nvoid main () {\n vec4 pos = vec4(a_position, 1);\n\n #if CC_USE_MODEL\n pos = cc_matViewProj * cc_matWorld * pos;\n #else\n pos = cc_matViewProj * pos;\n #endif\n\n #if USE_TEXTURE\n v_uv0 = a_uv0;\n #endif\n\n v_color = a_color;\n\n gl_Position = pos;\n}\n", + "frag": "\nprecision highp float;\n\n#if USE_ALPHA_TEST\n \n uniform ALPHA_TEST {\n float alphaThreshold;\n }\n#endif\n\nvoid ALPHA_TEST (in vec4 color) {\n #if USE_ALPHA_TEST\n if (color.a < alphaThreshold) discard;\n #endif\n}\n\nvoid ALPHA_TEST (in float alpha) {\n #if USE_ALPHA_TEST\n if (alpha < alphaThreshold) discard;\n #endif\n}\n\nin vec4 v_color;\n\n#if USE_TEXTURE\nin vec2 v_uv0;\nuniform sampler2D texture;\n#endif\n\n#if SHOW_OUT_LINE\n\nuniform Outline {\n\n vec4 outlineColor;\n\n float outlineSize;\n\n};\n\nfloat getBgAlpha() {\n vec4 color_up = texture(texture, v_uv0 + vec2(0, outlineSize)); \n vec4 color_down = texture(texture, v_uv0 - vec2(0, outlineSize)); \n vec4 color_left = texture(texture, v_uv0 - vec2(outlineSize, 0)); \n vec4 color_right = texture(texture, v_uv0 + vec2(outlineSize, 0)); \n vec4 color_up_left = texture(texture, v_uv0 + vec2(outlineSize, -outlineSize)); \n vec4 color_up_right = texture(texture, v_uv0 + vec2(outlineSize, outlineSize)); \n vec4 color_down_left = texture(texture, v_uv0 + vec2(-outlineSize, -outlineSize)); \n vec4 color_down_right = texture(texture, v_uv0 + vec2(-outlineSize, outlineSize)); \n float total = color_right.a + color_left.a + color_down.a + color_up.a + color_up_left.a + color_up_right.a + color_down_left.a + color_down_right.a; \n total *= 0.125;\n return clamp(total, 0.0, 1.0);\n}\n\n#endif\n\nvoid main () {\n vec4 o = vec4(1, 1, 1, 1);\n\n #if USE_TEXTURE\n o *= texture(texture, v_uv0);\n #if CC_USE_ALPHA_ATLAS_TEXTURE\n o.a *= texture2D(texture, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #endif\n\n o *= v_color;\n\n ALPHA_TEST(o);\n\n gl_FragColor = o;\n\n #if SHOW_OUT_LINE\n\n vec4 color_dest = outlineColor * getBgAlpha();\n\n vec4 color_src = o;\n\n gl_FragColor = color_src * color_src.a + color_dest * (1.0 - color_src.a);\n #endif\n}\n" + } + } + ], + "subMetas": {} +} \ No newline at end of file diff --git a/assets/materials/outter-glow.mtl b/assets/materials/outter-glow.mtl new file mode 100644 index 0000000..d224faa --- /dev/null +++ b/assets/materials/outter-glow.mtl @@ -0,0 +1,25 @@ +{ + "__type__": "cc.Material", + "_name": "", + "_objFlags": 0, + "_native": "", + "_effectAsset": { + "__uuid__": "9874f91b-8c4d-42a7-975a-a6281b46f3ed" + }, + "_defines": { + "USE_TEXTURE": true, + "USE_ALPHA_TEST": false, + "SHOW_OUT_LINE": true + }, + "_props": { + "texture": null, + "outlineColor": { + "__type__": "cc.Vec4", + "x": 1, + "y": 1, + "z": 0, + "w": 1 + }, + "outlineSize": 0.01 + } +} \ No newline at end of file diff --git a/assets/materials/outter-glow.mtl.meta b/assets/materials/outter-glow.mtl.meta new file mode 100644 index 0000000..84d7855 --- /dev/null +++ b/assets/materials/outter-glow.mtl.meta @@ -0,0 +1,6 @@ +{ + "ver": "1.0.2", + "uuid": "b878db1a-68e4-460d-95f8-83fdb34c11e6", + "dataAsSubAsset": null, + "subMetas": {} +} \ No newline at end of file diff --git a/assets/scenes/OutlineEffectScene.fire b/assets/scenes/OutlineEffectScene.fire index c83e743..8466dd8 100755 --- a/assets/scenes/OutlineEffectScene.fire +++ b/assets/scenes/OutlineEffectScene.fire @@ -177,7 +177,7 @@ "array": [ 0, 0, - 491.0364039457767, + 393.1755333181352, 0, 0, 0, @@ -992,7 +992,7 @@ "_contentSize": { "__type__": "cc.Size", "width": 585.3299999999999, - "height": 150 + "height": 0 }, "_anchorPoint": { "__type__": "cc.Vec2", @@ -1066,7 +1066,7 @@ "ctor": "Float64Array", "array": [ -195.16499999999996, - 26.272, + 0, 0, 0, 0, @@ -1160,7 +1160,7 @@ "ctor": "Float64Array", "array": [ 121.50000000000003, - 37.609, + 0, 0, 0, 0, @@ -1225,7 +1225,7 @@ "_layoutSize": { "__type__": "cc.Size", "width": 585.3299999999999, - "height": 150 + "height": 0 }, "_resize": 1, "_N$layoutType": 1, diff --git a/assets/scenes/OutterGlowEffectScene.fire b/assets/scenes/OutterGlowEffectScene.fire new file mode 100755 index 0000000..aea1189 --- /dev/null +++ b/assets/scenes/OutterGlowEffectScene.fire @@ -0,0 +1,1310 @@ +[ + { + "__type__": "cc.SceneAsset", + "_name": "", + "_objFlags": 0, + "_native": "", + "scene": { + "__id__": 1 + } + }, + { + "__type__": "cc.Scene", + "_objFlags": 0, + "_parent": null, + "_children": [ + { + "__id__": 2 + } + ], + "_active": true, + "_components": [], + "_prefab": null, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 0, + "height": 0 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1 + ] + }, + "_is3DNode": true, + "_groupIndex": 0, + "groupIndex": 0, + "autoReleaseAssets": false, + "_id": "05055d3f-a334-4b45-abf1-e379e4708284" + }, + { + "__type__": "cc.Node", + "_name": "Canvas", + "_objFlags": 0, + "_parent": { + "__id__": 1 + }, + "_children": [ + { + "__id__": 3 + }, + { + "__id__": 5 + }, + { + "__id__": 8 + }, + { + "__id__": 21 + } + ], + "_active": true, + "_components": [ + { + "__id__": 28 + }, + { + "__id__": 29 + } + ], + "_prefab": null, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 252, + "g": 252, + "b": 252, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 960, + "height": 640 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + 480, + 320, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1 + ] + }, + "_eulerAngles": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_skewX": 0, + "_skewY": 0, + "_is3DNode": false, + "_groupIndex": 0, + "groupIndex": 0, + "_id": "a286bbGknJLZpRpxROV6M94" + }, + { + "__type__": "cc.Node", + "_name": "Main Camera", + "_objFlags": 0, + "_parent": { + "__id__": 2 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 4 + } + ], + "_prefab": null, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 0, + "height": 0 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + 0, + 0, + 393.1755333181352, + 0, + 0, + 0, + 1, + 1, + 1, + 1 + ] + }, + "_eulerAngles": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_skewX": 0, + "_skewY": 0, + "_is3DNode": false, + "_groupIndex": 0, + "groupIndex": 0, + "_id": "fbL5wf1mhFa6PPZbeZvnZ9" + }, + { + "__type__": "cc.Camera", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 3 + }, + "_enabled": true, + "_cullingMask": 4294967295, + "_clearFlags": 7, + "_backgroundColor": { + "__type__": "cc.Color", + "r": 0, + "g": 0, + "b": 0, + "a": 255 + }, + "_depth": -1, + "_zoomRatio": 1, + "_targetTexture": null, + "_fov": 60, + "_orthoSize": 10, + "_nearClip": 1, + "_farClip": 4096, + "_ortho": true, + "_rect": { + "__type__": "cc.Rect", + "x": 0, + "y": 0, + "width": 1, + "height": 1 + }, + "_renderStages": 1, + "_alignWithScreen": true, + "_id": "adItdqNzZHbYUhDAmfCr9b" + }, + { + "__type__": "cc.Node", + "_name": "Bg", + "_objFlags": 0, + "_parent": { + "__id__": 2 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 6 + }, + { + "__id__": 7 + } + ], + "_prefab": null, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 27, + "g": 38, + "b": 46, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 960, + "height": 640 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1 + ] + }, + "_eulerAngles": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_skewX": 0, + "_skewY": 0, + "_is3DNode": false, + "_groupIndex": 0, + "groupIndex": 0, + "_id": "e2e0crkOLxGrpMxpbC4iQg1" + }, + { + "__type__": "cc.Widget", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 5 + }, + "_enabled": true, + "alignMode": 0, + "_target": null, + "_alignFlags": 45, + "_left": 0, + "_right": 0, + "_top": 0, + "_bottom": 0, + "_verticalCenter": 0, + "_horizontalCenter": 0, + "_isAbsLeft": true, + "_isAbsRight": true, + "_isAbsTop": true, + "_isAbsBottom": true, + "_isAbsHorizontalCenter": true, + "_isAbsVerticalCenter": true, + "_originalWidth": 200, + "_originalHeight": 150, + "_id": "89IA6P0/5JEZERosKJJo6k" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 5 + }, + "_enabled": true, + "_materials": [ + { + "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432" + } + ], + "_srcBlendFactor": 770, + "_dstBlendFactor": 771, + "_spriteFrame": { + "__uuid__": "410fb916-8721-4663-bab8-34397391ace7" + }, + "_type": 1, + "_sizeMode": 0, + "_fillType": 0, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": true, + "_atlas": null, + "_id": "2azjUbJNxALLAfDZrJ8TV0" + }, + { + "__type__": "cc.Node", + "_name": "Layout", + "_objFlags": 0, + "_parent": { + "__id__": 2 + }, + "_children": [ + { + "__id__": 9 + }, + { + "__id__": 11 + } + ], + "_active": true, + "_components": [ + { + "__id__": 19 + }, + { + "__id__": 20 + } + ], + "_prefab": null, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 548, + "height": 150 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + -62, + 168.26, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1 + ] + }, + "_eulerAngles": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_skewX": 0, + "_skewY": 0, + "_is3DNode": false, + "_groupIndex": 0, + "groupIndex": 0, + "_id": "11ZCsp/hhAnoxRSLqdlROB" + }, + { + "__type__": "cc.Node", + "_name": "Label", + "_objFlags": 0, + "_parent": { + "__id__": 8 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 10 + } + ], + "_prefab": null, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 200, + "height": 50.4 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + -174, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1 + ] + }, + "_eulerAngles": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_skewX": 0, + "_skewY": 0, + "_is3DNode": false, + "_groupIndex": 0, + "groupIndex": 0, + "_id": "a8mK6UowJOqLvmjfPIiuTZ" + }, + { + "__type__": "cc.Label", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 9 + }, + "_enabled": true, + "_materials": [ + { + "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432" + } + ], + "_useOriginalSize": false, + "_string": "发光宽度:", + "_N$string": "发光宽度:", + "_fontSize": 40, + "_lineHeight": 40, + "_enableWrapText": true, + "_N$file": null, + "_isSystemFontUsed": true, + "_spacingX": 0, + "_batchAsBitmap": false, + "_N$horizontalAlign": 1, + "_N$verticalAlign": 1, + "_N$fontFamily": "Arial", + "_N$overflow": 0, + "_N$cacheMode": 0, + "_id": "5aqqaNVJNJsqy4cwZGvqW5" + }, + { + "__type__": "cc.Node", + "_name": "Slider", + "_objFlags": 0, + "_parent": { + "__id__": 8 + }, + "_children": [ + { + "__id__": 12 + }, + { + "__id__": 14 + } + ], + "_active": true, + "_components": [ + { + "__id__": 17 + } + ], + "_prefab": null, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 300, + "height": 20 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + 124, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1 + ] + }, + "_eulerAngles": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_skewX": 0, + "_skewY": 0, + "_is3DNode": false, + "_groupIndex": 0, + "groupIndex": 0, + "_id": "e3WHmNWolODK/k/BUhp8n+" + }, + { + "__type__": "cc.Node", + "_name": "Background", + "_objFlags": 0, + "_parent": { + "__id__": 11 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 13 + } + ], + "_prefab": null, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 300, + "height": 20 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1 + ] + }, + "_eulerAngles": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_skewX": 0, + "_skewY": 0, + "_is3DNode": false, + "_groupIndex": 0, + "groupIndex": 0, + "_id": "4e4s7CtEpIPYADvmHwxDSt" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 12 + }, + "_enabled": true, + "_materials": [ + { + "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432" + } + ], + "_srcBlendFactor": 770, + "_dstBlendFactor": 771, + "_spriteFrame": { + "__uuid__": "31d8962d-babb-4ec7-be19-8e9f54a4ea99" + }, + "_type": 1, + "_sizeMode": 0, + "_fillType": 0, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": true, + "_atlas": null, + "_id": "fc/wnYCLxJKrZ8PoMA1CYw" + }, + { + "__type__": "cc.Node", + "_name": "Handle", + "_objFlags": 0, + "_parent": { + "__id__": 11 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 15 + }, + { + "__id__": 16 + } + ], + "_prefab": null, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 32, + "height": 32 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + -150, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1 + ] + }, + "_eulerAngles": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_skewX": 0, + "_skewY": 0, + "_is3DNode": false, + "_groupIndex": 0, + "groupIndex": 0, + "_id": "cboGZ4mmtC7Z7ZvWnGXRab" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 14 + }, + "_enabled": true, + "_materials": [ + { + "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432" + } + ], + "_srcBlendFactor": 770, + "_dstBlendFactor": 771, + "_spriteFrame": { + "__uuid__": "e7aba14b-f956-4480-b254-8d57832e273f" + }, + "_type": 1, + "_sizeMode": 2, + "_fillType": 0, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": true, + "_atlas": null, + "_id": "eeIzXLXopG3Ypab6LDsHxh" + }, + { + "__type__": "cc.Button", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 14 + }, + "_enabled": true, + "_normalMaterial": null, + "_grayMaterial": null, + "duration": 0.1, + "zoomScale": 1.1, + "clickEvents": [], + "_N$interactable": true, + "_N$enableAutoGrayEffect": true, + "_N$transition": 3, + "transition": 3, + "_N$normalColor": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_N$pressedColor": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "pressedColor": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_N$hoverColor": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "hoverColor": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_N$disabledColor": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_N$normalSprite": { + "__uuid__": "e7aba14b-f956-4480-b254-8d57832e273f" + }, + "_N$pressedSprite": { + "__uuid__": "e7aba14b-f956-4480-b254-8d57832e273f" + }, + "pressedSprite": { + "__uuid__": "e7aba14b-f956-4480-b254-8d57832e273f" + }, + "_N$hoverSprite": { + "__uuid__": "e7aba14b-f956-4480-b254-8d57832e273f" + }, + "hoverSprite": { + "__uuid__": "e7aba14b-f956-4480-b254-8d57832e273f" + }, + "_N$disabledSprite": { + "__uuid__": "29158224-f8dd-4661-a796-1ffab537140e" + }, + "_N$target": { + "__id__": 14 + }, + "_id": "f8CMhOw3JJrJn6+CKLopHY" + }, + { + "__type__": "cc.Slider", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 11 + }, + "_enabled": true, + "direction": 0, + "slideEvents": [ + { + "__id__": 18 + } + ], + "_N$handle": { + "__id__": 16 + }, + "_N$progress": 0, + "_id": "69kbIKMEFE4ISodttSO13M" + }, + { + "__type__": "cc.ClickEvent", + "target": { + "__id__": 2 + }, + "component": "", + "_componentId": "408f4mR69xEbpzjsYAGu3vL", + "handler": "onSideCallBack", + "customEventData": "" + }, + { + "__type__": "cc.Layout", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 8 + }, + "_enabled": true, + "_layoutSize": { + "__type__": "cc.Size", + "width": 548, + "height": 150 + }, + "_resize": 1, + "_N$layoutType": 1, + "_N$padding": 0, + "_N$cellSize": { + "__type__": "cc.Size", + "width": 40, + "height": 40 + }, + "_N$startAxis": 0, + "_N$paddingLeft": 0, + "_N$paddingRight": 0, + "_N$paddingTop": 0, + "_N$paddingBottom": 0, + "_N$spacingX": 48, + "_N$spacingY": 0, + "_N$verticalDirection": 1, + "_N$horizontalDirection": 0, + "_N$affectedByScale": false, + "_id": "35c+GGK1pBGY2lVxUQ4a+Y" + }, + { + "__type__": "cc.Widget", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 8 + }, + "_enabled": true, + "alignMode": 1, + "_target": null, + "_alignFlags": 8, + "_left": 0.15, + "_right": 0, + "_top": 0, + "_bottom": 0, + "_verticalCenter": 0, + "_horizontalCenter": 0, + "_isAbsLeft": false, + "_isAbsRight": true, + "_isAbsTop": true, + "_isAbsBottom": true, + "_isAbsHorizontalCenter": true, + "_isAbsVerticalCenter": true, + "_originalWidth": 0, + "_originalHeight": 0, + "_id": "47RYUMeTFP0bPLCO+5W3tH" + }, + { + "__type__": "cc.Node", + "_name": "Layout", + "_objFlags": 0, + "_parent": { + "__id__": 2 + }, + "_children": [ + { + "__id__": 22 + }, + { + "__id__": 24 + } + ], + "_active": true, + "_components": [ + { + "__id__": 26 + }, + { + "__id__": 27 + } + ], + "_prefab": null, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 585.3299999999999, + "height": 0 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + -43.335000000000036, + -63.427, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1 + ] + }, + "_eulerAngles": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_skewX": 0, + "_skewY": 0, + "_is3DNode": false, + "_groupIndex": 0, + "groupIndex": 0, + "_id": "feymBChPxA1pr6+/rlPqey" + }, + { + "__type__": "cc.Node", + "_name": "ExampleSprite", + "_objFlags": 0, + "_parent": { + "__id__": 21 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 23 + } + ], + "_prefab": null, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 195, + "height": 270 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + -195.16499999999996, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1 + ] + }, + "_eulerAngles": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_skewX": 0, + "_skewY": 0, + "_is3DNode": false, + "_groupIndex": 0, + "groupIndex": 0, + "_id": "c4f30YOS65G64U2TwufdJ+2" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 22 + }, + "_enabled": true, + "_materials": [ + { + "__uuid__": "b878db1a-68e4-460d-95f8-83fdb34c11e6" + } + ], + "_srcBlendFactor": 770, + "_dstBlendFactor": 771, + "_spriteFrame": { + "__uuid__": "31bc895a-c003-4566-a9f3-2e54ae1c17dc" + }, + "_type": 0, + "_sizeMode": 1, + "_fillType": 0, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": true, + "_atlas": null, + "_id": "c5wu68mipC4qBjTD+u0rFa" + }, + { + "__type__": "cc.Node", + "_name": "ExampleLabel", + "_objFlags": 0, + "_parent": { + "__id__": 21 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 25 + } + ], + "_prefab": null, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 342.33, + "height": 100.8 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + 121.50000000000003, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1 + ] + }, + "_eulerAngles": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_skewX": 0, + "_skewY": 0, + "_is3DNode": false, + "_groupIndex": 0, + "groupIndex": 0, + "_id": "31f1bH7V69Ajr1iXhluMpTB" + }, + { + "__type__": "cc.Label", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 24 + }, + "_enabled": true, + "_materials": [ + { + "__uuid__": "b878db1a-68e4-460d-95f8-83fdb34c11e6" + } + ], + "_useOriginalSize": false, + "_string": "Hello, World!", + "_N$string": "Hello, World!", + "_fontSize": 60, + "_lineHeight": 80, + "_enableWrapText": true, + "_N$file": null, + "_isSystemFontUsed": true, + "_spacingX": 0, + "_batchAsBitmap": false, + "_N$horizontalAlign": 1, + "_N$verticalAlign": 1, + "_N$fontFamily": "Arial", + "_N$overflow": 0, + "_N$cacheMode": 0, + "_id": "9fH5zrVThO/I9ly3o3xhIT" + }, + { + "__type__": "cc.Layout", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 21 + }, + "_enabled": true, + "_layoutSize": { + "__type__": "cc.Size", + "width": 585.3299999999999, + "height": 0 + }, + "_resize": 1, + "_N$layoutType": 1, + "_N$padding": 0, + "_N$cellSize": { + "__type__": "cc.Size", + "width": 40, + "height": 40 + }, + "_N$startAxis": 0, + "_N$paddingLeft": 0, + "_N$paddingRight": 0, + "_N$paddingTop": 0, + "_N$paddingBottom": 0, + "_N$spacingX": 48, + "_N$spacingY": 0, + "_N$verticalDirection": 1, + "_N$horizontalDirection": 0, + "_N$affectedByScale": false, + "_id": "ff9z0nF9BGm5zFMuGhj1jt" + }, + { + "__type__": "cc.Widget", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 21 + }, + "_enabled": true, + "alignMode": 1, + "_target": null, + "_alignFlags": 8, + "_left": 0.15, + "_right": 0, + "_top": 0, + "_bottom": 0, + "_verticalCenter": 0, + "_horizontalCenter": 0, + "_isAbsLeft": false, + "_isAbsRight": true, + "_isAbsTop": true, + "_isAbsBottom": true, + "_isAbsHorizontalCenter": true, + "_isAbsVerticalCenter": true, + "_originalWidth": 0, + "_originalHeight": 0, + "_id": "a4H/CsfipEB73tJmLtFf9/" + }, + { + "__type__": "cc.Canvas", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 2 + }, + "_enabled": true, + "_designResolution": { + "__type__": "cc.Size", + "width": 960, + "height": 640 + }, + "_fitWidth": false, + "_fitHeight": true, + "_id": "4bz2+ak99DBYVlSVIMFGN0" + }, + { + "__type__": "408f4mR69xEbpzjsYAGu3vL", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 2 + }, + "_enabled": true, + "exampleSprite": { + "__id__": 23 + }, + "exampleLabel": { + "__id__": 25 + }, + "_id": "5cIwQjksRDKJ/zWSTFHRWJ" + } +] \ No newline at end of file diff --git a/assets/scenes/OutterGlowEffectScene.fire.meta b/assets/scenes/OutterGlowEffectScene.fire.meta new file mode 100644 index 0000000..6216b2f --- /dev/null +++ b/assets/scenes/OutterGlowEffectScene.fire.meta @@ -0,0 +1,7 @@ +{ + "ver": "1.2.5", + "uuid": "05055d3f-a334-4b45-abf1-e379e4708284", + "asyncLoadAssets": false, + "autoReleaseAssets": false, + "subMetas": {} +} \ No newline at end of file diff --git a/assets/scripts/OutterGlowEffectScene.ts b/assets/scripts/OutterGlowEffectScene.ts new file mode 100644 index 0000000..68d0fda --- /dev/null +++ b/assets/scripts/OutterGlowEffectScene.ts @@ -0,0 +1,41 @@ +const { ccclass, property } = cc._decorator; + +@ccclass +export default class MainSceneCtrl extends cc.Component { + @property(cc.Sprite) + exampleSprite: cc.Sprite = null; + + @property(cc.Label) + exampleLabel: cc.Label = null; + + start() { + this._updateSpriteOutlineWidth(0); + this._updateLabelOutlineWidth(0); + } + + onSideCallBack(slider: cc.Slider, customEventData: string) { + this._updateSpriteOutlineWidth(slider.progress / 100); + this._updateLabelOutlineWidth(slider.progress / 100); + } + + /** + * 动态更新描边宽度 + * + * 1. 获取材质 + * 2. 给材质的自定义 unitform 变量赋值 + * 3. 重新将材质赋值回去 + * + * @property outlineSize 描边长度比例[0,1] 比如0.5,那么就是宽*0.5 高*0.5 + */ + private _updateSpriteOutlineWidth(outlineSize: number) { + let spriteMaterial: cc.Material = this.exampleSprite.getMaterial(0); + spriteMaterial.setProperty("outlineSize", outlineSize); + this.exampleSprite.setMaterial(0, spriteMaterial); + } + + private _updateLabelOutlineWidth(outlineSize: number) { + let labelMaterial: cc.Material = this.exampleLabel.getMaterial(0); + labelMaterial.setProperty("outlineSize", outlineSize); + this.exampleLabel.setMaterial(0, labelMaterial); + } +} diff --git a/assets/scripts/SpriteOutlineCrtl.ts.meta b/assets/scripts/OutterGlowEffectScene.ts.meta similarity index 74% rename from assets/scripts/SpriteOutlineCrtl.ts.meta rename to assets/scripts/OutterGlowEffectScene.ts.meta index d60927b..5e401e3 100644 --- a/assets/scripts/SpriteOutlineCrtl.ts.meta +++ b/assets/scripts/OutterGlowEffectScene.ts.meta @@ -1,6 +1,6 @@ { "ver": "1.0.5", - "uuid": "93154cca-114c-4db2-938b-f750f686fe9b", + "uuid": "408f4991-ebdc-446e-9ce3-b18006bb7bcb", "isPlugin": false, "loadPluginInWeb": true, "loadPluginInNative": true, diff --git a/assets/scripts/SpriteOutlineCrtl.ts b/assets/scripts/SpriteOutlineCrtl.ts deleted file mode 100644 index 420e1e8..0000000 --- a/assets/scripts/SpriteOutlineCrtl.ts +++ /dev/null @@ -1,21 +0,0 @@ -const { ccclass, property } = cc._decorator; - -@ccclass -export default class SpriteOutlineCtrl extends cc.Component { - private _sprite: cc.Sprite = null; - - onLoad() { - this._sprite = this.getComponent(cc.Sprite); - if (this._sprite == null) { - throw new Error(`${this.name} can only bind on Sprite`); - } - } - - start() { - // let material: cc.Material = this._sprite.getMaterial(0); - // material.setProperty("test", 0); - // this._sprite.setMaterial(0, material); - } - - // update (dt) {} -} From 7f02ee1eb00db542c231ed3ca0ebb2972d0114e3 Mon Sep 17 00:00:00 2001 From: caizhitao Date: Thu, 19 Dec 2019 15:45:29 +0800 Subject: [PATCH 02/24] =?UTF-8?q?=E5=88=9D=E6=AD=A5=E5=8F=91=E5=85=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/effects/outter-glow.effect | 39 +++++++++++++++++------- assets/effects/outter-glow.effect.meta | 4 +-- assets/materials/outter-glow.mtl | 2 +- assets/scenes/OutterGlowEffectScene.fire | 10 +++--- settings/project.json | 13 ++++---- 5 files changed, 42 insertions(+), 26 deletions(-) diff --git a/assets/effects/outter-glow.effect b/assets/effects/outter-glow.effect index a4eeaad..aaa0e69 100644 --- a/assets/effects/outter-glow.effect +++ b/assets/effects/outter-glow.effect @@ -75,24 +75,40 @@ CCProgram fs %{ // 特别地,必须是 vec4 先于 float 声明 }; + float getAlpha(float size) { + vec4 color_up = texture(texture, v_uv0 + vec2(0, size)); + vec4 color_down = texture(texture, v_uv0 - vec2(0, size)); + vec4 color_left = texture(texture, v_uv0 - vec2(size, 0)); + vec4 color_right = texture(texture, v_uv0 + vec2(size, 0)); + vec4 color_up_left = texture(texture, v_uv0 + vec2(size, -size)); + vec4 color_up_right = texture(texture, v_uv0 + vec2(size, size)); + vec4 color_down_left = texture(texture, v_uv0 + vec2(-size, -size)); + vec4 color_down_right = texture(texture, v_uv0 + vec2(-size, size)); + float total = color_right.a + color_left.a + color_down.a + color_up.a + color_up_left.a + color_up_right.a + color_down_left.a + color_down_right.a; + return step(0.000000001, total); + } + // 将图像往8个方向偏移后,得到一个类放大效果,然后取放大后的图像的透明度,即可得到一个放大后的区域,可以很方便填充(描边)颜色 // 取当前点上、下、左、右、上左、上右、下左、下右共计8个方向,距离为 outlineSize 的8个点,求他们的透明度之和 // 由此可以得到当前点是否属于图像往八个方向做偏移后得到的放大图区域,并且能得到该点最终透明度值 // 最终对应的为图像偏移/放大后的背景区域 float getBgAlpha() { - vec4 color_up = texture(texture, v_uv0 + vec2(0, outlineSize)); - vec4 color_down = texture(texture, v_uv0 - vec2(0, outlineSize)); - vec4 color_left = texture(texture, v_uv0 - vec2(outlineSize, 0)); - vec4 color_right = texture(texture, v_uv0 + vec2(outlineSize, 0)); - vec4 color_up_left = texture(texture, v_uv0 + vec2(outlineSize, -outlineSize)); - vec4 color_up_right = texture(texture, v_uv0 + vec2(outlineSize, outlineSize)); - vec4 color_down_left = texture(texture, v_uv0 + vec2(-outlineSize, -outlineSize)); - vec4 color_down_right = texture(texture, v_uv0 + vec2(-outlineSize, outlineSize)); - float total = color_right.a + color_left.a + color_down.a + color_up.a + color_up_left.a + color_up_right.a + color_down_left.a + color_down_right.a; - total *= 0.125; - return clamp(total, 0.0, 1.0); + vec4 color_cur = texture(texture, v_uv0); + float alpha = step(0.000000001, color_cur.a); + if (alpha > 0.000000001) { + return 1.0; + } else { + float total = 0.0; + for (float i = 0.0; i <= 1.0; i += 0.01) { + total += getAlpha(outlineSize * i); + } + total *= 0.01; + return clamp(total, 0.0, 1.0); + } } + + #endif void main () { @@ -128,6 +144,7 @@ CCProgram fs %{ // 即最终颜色如下: // color_src * GL_SRC_ALPHA + color_dest * GL_ONE_MINUS_SRC_ALPHA gl_FragColor = color_src * color_src.a + color_dest * (1.0 - color_src.a); + // gl_FragColor = color_dest; #endif } }% diff --git a/assets/effects/outter-glow.effect.meta b/assets/effects/outter-glow.effect.meta index 9107921..6201736 100644 --- a/assets/effects/outter-glow.effect.meta +++ b/assets/effects/outter-glow.effect.meta @@ -5,11 +5,11 @@ { "glsl1": { "vert": "\nprecision highp float;\nuniform mat4 cc_matViewProj;\nuniform mat4 cc_matWorld;\n\nattribute vec3 a_position;\nattribute vec4 a_color;\nvarying vec4 v_color;\n\n#if USE_TEXTURE\nattribute vec2 a_uv0;\nvarying vec2 v_uv0;\n#endif\n\nvoid main () {\n vec4 pos = vec4(a_position, 1);\n\n #if CC_USE_MODEL\n pos = cc_matViewProj * cc_matWorld * pos;\n #else\n pos = cc_matViewProj * pos;\n #endif\n\n #if USE_TEXTURE\n v_uv0 = a_uv0;\n #endif\n\n v_color = a_color;\n\n gl_Position = pos;\n}\n", - "frag": "\nprecision highp float;\n\n#if USE_ALPHA_TEST\n \n uniform float alphaThreshold;\n#endif\n\nvoid ALPHA_TEST (in vec4 color) {\n #if USE_ALPHA_TEST\n if (color.a < alphaThreshold) discard;\n #endif\n}\n\nvoid ALPHA_TEST (in float alpha) {\n #if USE_ALPHA_TEST\n if (alpha < alphaThreshold) discard;\n #endif\n}\n\nvarying vec4 v_color;\n\n#if USE_TEXTURE\nvarying vec2 v_uv0;\nuniform sampler2D texture;\n#endif\n\n#if SHOW_OUT_LINE\n\nuniform vec4 outlineColor;\nuniform float outlineSize;\n\nfloat getBgAlpha() {\n vec4 color_up = texture2D(texture, v_uv0 + vec2(0, outlineSize)); \n vec4 color_down = texture2D(texture, v_uv0 - vec2(0, outlineSize)); \n vec4 color_left = texture2D(texture, v_uv0 - vec2(outlineSize, 0)); \n vec4 color_right = texture2D(texture, v_uv0 + vec2(outlineSize, 0)); \n vec4 color_up_left = texture2D(texture, v_uv0 + vec2(outlineSize, -outlineSize)); \n vec4 color_up_right = texture2D(texture, v_uv0 + vec2(outlineSize, outlineSize)); \n vec4 color_down_left = texture2D(texture, v_uv0 + vec2(-outlineSize, -outlineSize)); \n vec4 color_down_right = texture2D(texture, v_uv0 + vec2(-outlineSize, outlineSize)); \n float total = color_right.a + color_left.a + color_down.a + color_up.a + color_up_left.a + color_up_right.a + color_down_left.a + color_down_right.a; \n total *= 0.125;\n return clamp(total, 0.0, 1.0);\n}\n\n#endif\n\nvoid main () {\n vec4 o = vec4(1, 1, 1, 1);\n\n #if USE_TEXTURE\n o *= texture2D(texture, v_uv0);\n #if CC_USE_ALPHA_ATLAS_TEXTURE\n o.a *= texture2D(texture, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #endif\n\n o *= v_color;\n\n ALPHA_TEST(o);\n\n gl_FragColor = o;\n\n #if SHOW_OUT_LINE\n\n vec4 color_dest = outlineColor * getBgAlpha();\n\n vec4 color_src = o;\n\n gl_FragColor = color_src * color_src.a + color_dest * (1.0 - color_src.a);\n #endif\n}\n" + "frag": "\nprecision highp float;\n\n#if USE_ALPHA_TEST\n \n uniform float alphaThreshold;\n#endif\n\nvoid ALPHA_TEST (in vec4 color) {\n #if USE_ALPHA_TEST\n if (color.a < alphaThreshold) discard;\n #endif\n}\n\nvoid ALPHA_TEST (in float alpha) {\n #if USE_ALPHA_TEST\n if (alpha < alphaThreshold) discard;\n #endif\n}\n\nvarying vec4 v_color;\n\n#if USE_TEXTURE\nvarying vec2 v_uv0;\nuniform sampler2D texture;\n#endif\n\n#if SHOW_OUT_LINE\n\nuniform vec4 outlineColor;\nuniform float outlineSize;\n\nfloat getAlpha(float size) {\n vec4 color_up = texture2D(texture, v_uv0 + vec2(0, size)); \n vec4 color_down = texture2D(texture, v_uv0 - vec2(0, size)); \n vec4 color_left = texture2D(texture, v_uv0 - vec2(size, 0)); \n vec4 color_right = texture2D(texture, v_uv0 + vec2(size, 0)); \n vec4 color_up_left = texture2D(texture, v_uv0 + vec2(size, -size)); \n vec4 color_up_right = texture2D(texture, v_uv0 + vec2(size, size)); \n vec4 color_down_left = texture2D(texture, v_uv0 + vec2(-size, -size)); \n vec4 color_down_right = texture2D(texture, v_uv0 + vec2(-size, size)); \n float total = color_right.a + color_left.a + color_down.a + color_up.a + color_up_left.a + color_up_right.a + color_down_left.a + color_down_right.a; \n return step(0.000000001, total);\n}\n\nfloat getBgAlpha() {\n vec4 color_cur = texture2D(texture, v_uv0);\n float alpha = step(0.000000001, color_cur.a);\n if (alpha > 0.000000001) {\n return 1.0;\n } else {\n float total = 0.0;\n for (float i = 0.0; i <= 1.0; i += 0.01) {\n total += getAlpha(outlineSize * i);\n }\n total *= 0.01;\n return clamp(total, 0.0, 1.0);\n }\n}\n\n#endif\n\nvoid main () {\n vec4 o = vec4(1, 1, 1, 1);\n\n #if USE_TEXTURE\n o *= texture2D(texture, v_uv0);\n #if CC_USE_ALPHA_ATLAS_TEXTURE\n o.a *= texture2D(texture, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #endif\n\n o *= v_color;\n\n ALPHA_TEST(o);\n\n gl_FragColor = o;\n\n #if SHOW_OUT_LINE\n\n vec4 color_dest = outlineColor * getBgAlpha();\n\n vec4 color_src = o;\n\n gl_FragColor = color_src * color_src.a + color_dest * (1.0 - color_src.a);\n\n #endif\n}\n" }, "glsl3": { "vert": "\nprecision highp float;\nuniform CCGlobal {\n vec4 cc_time;\n\n vec4 cc_screenSize;\n\n vec4 cc_screenScale;\n\n vec4 cc_nativeSize;\n\n mat4 cc_matView;\n mat4 cc_matViewInv;\n mat4 cc_matProj;\n mat4 cc_matProjInv;\n mat4 cc_matViewProj;\n mat4 cc_matViewProjInv;\n vec4 cc_cameraPos;\n\n vec4 cc_exposure;\n\n vec4 cc_mainLitDir;\n\n vec4 cc_mainLitColor;\n\n vec4 cc_ambientSky;\n vec4 cc_ambientGround;\n};\nuniform CCLocal {\n mat4 cc_matWorld;\n mat4 cc_matWorldIT;\n};\n\nin vec3 a_position;\nin vec4 a_color;\nout vec4 v_color;\n\n#if USE_TEXTURE\nin vec2 a_uv0;\nout vec2 v_uv0;\n#endif\n\nvoid main () {\n vec4 pos = vec4(a_position, 1);\n\n #if CC_USE_MODEL\n pos = cc_matViewProj * cc_matWorld * pos;\n #else\n pos = cc_matViewProj * pos;\n #endif\n\n #if USE_TEXTURE\n v_uv0 = a_uv0;\n #endif\n\n v_color = a_color;\n\n gl_Position = pos;\n}\n", - "frag": "\nprecision highp float;\n\n#if USE_ALPHA_TEST\n \n uniform ALPHA_TEST {\n float alphaThreshold;\n }\n#endif\n\nvoid ALPHA_TEST (in vec4 color) {\n #if USE_ALPHA_TEST\n if (color.a < alphaThreshold) discard;\n #endif\n}\n\nvoid ALPHA_TEST (in float alpha) {\n #if USE_ALPHA_TEST\n if (alpha < alphaThreshold) discard;\n #endif\n}\n\nin vec4 v_color;\n\n#if USE_TEXTURE\nin vec2 v_uv0;\nuniform sampler2D texture;\n#endif\n\n#if SHOW_OUT_LINE\n\nuniform Outline {\n\n vec4 outlineColor;\n\n float outlineSize;\n\n};\n\nfloat getBgAlpha() {\n vec4 color_up = texture(texture, v_uv0 + vec2(0, outlineSize)); \n vec4 color_down = texture(texture, v_uv0 - vec2(0, outlineSize)); \n vec4 color_left = texture(texture, v_uv0 - vec2(outlineSize, 0)); \n vec4 color_right = texture(texture, v_uv0 + vec2(outlineSize, 0)); \n vec4 color_up_left = texture(texture, v_uv0 + vec2(outlineSize, -outlineSize)); \n vec4 color_up_right = texture(texture, v_uv0 + vec2(outlineSize, outlineSize)); \n vec4 color_down_left = texture(texture, v_uv0 + vec2(-outlineSize, -outlineSize)); \n vec4 color_down_right = texture(texture, v_uv0 + vec2(-outlineSize, outlineSize)); \n float total = color_right.a + color_left.a + color_down.a + color_up.a + color_up_left.a + color_up_right.a + color_down_left.a + color_down_right.a; \n total *= 0.125;\n return clamp(total, 0.0, 1.0);\n}\n\n#endif\n\nvoid main () {\n vec4 o = vec4(1, 1, 1, 1);\n\n #if USE_TEXTURE\n o *= texture(texture, v_uv0);\n #if CC_USE_ALPHA_ATLAS_TEXTURE\n o.a *= texture2D(texture, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #endif\n\n o *= v_color;\n\n ALPHA_TEST(o);\n\n gl_FragColor = o;\n\n #if SHOW_OUT_LINE\n\n vec4 color_dest = outlineColor * getBgAlpha();\n\n vec4 color_src = o;\n\n gl_FragColor = color_src * color_src.a + color_dest * (1.0 - color_src.a);\n #endif\n}\n" + "frag": "\nprecision highp float;\n\n#if USE_ALPHA_TEST\n \n uniform ALPHA_TEST {\n float alphaThreshold;\n }\n#endif\n\nvoid ALPHA_TEST (in vec4 color) {\n #if USE_ALPHA_TEST\n if (color.a < alphaThreshold) discard;\n #endif\n}\n\nvoid ALPHA_TEST (in float alpha) {\n #if USE_ALPHA_TEST\n if (alpha < alphaThreshold) discard;\n #endif\n}\n\nin vec4 v_color;\n\n#if USE_TEXTURE\nin vec2 v_uv0;\nuniform sampler2D texture;\n#endif\n\n#if SHOW_OUT_LINE\n\nuniform Outline {\n\n vec4 outlineColor;\n\n float outlineSize;\n\n};\n\nfloat getAlpha(float size) {\n vec4 color_up = texture(texture, v_uv0 + vec2(0, size)); \n vec4 color_down = texture(texture, v_uv0 - vec2(0, size)); \n vec4 color_left = texture(texture, v_uv0 - vec2(size, 0)); \n vec4 color_right = texture(texture, v_uv0 + vec2(size, 0)); \n vec4 color_up_left = texture(texture, v_uv0 + vec2(size, -size)); \n vec4 color_up_right = texture(texture, v_uv0 + vec2(size, size)); \n vec4 color_down_left = texture(texture, v_uv0 + vec2(-size, -size)); \n vec4 color_down_right = texture(texture, v_uv0 + vec2(-size, size)); \n float total = color_right.a + color_left.a + color_down.a + color_up.a + color_up_left.a + color_up_right.a + color_down_left.a + color_down_right.a; \n return step(0.000000001, total);\n}\n\nfloat getBgAlpha() {\n vec4 color_cur = texture(texture, v_uv0);\n float alpha = step(0.000000001, color_cur.a);\n if (alpha > 0.000000001) {\n return 1.0;\n } else {\n float total = 0.0;\n for (float i = 0.0; i <= 1.0; i += 0.01) {\n total += getAlpha(outlineSize * i);\n }\n total *= 0.01;\n return clamp(total, 0.0, 1.0);\n }\n}\n\n#endif\n\nvoid main () {\n vec4 o = vec4(1, 1, 1, 1);\n\n #if USE_TEXTURE\n o *= texture(texture, v_uv0);\n #if CC_USE_ALPHA_ATLAS_TEXTURE\n o.a *= texture2D(texture, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #endif\n\n o *= v_color;\n\n ALPHA_TEST(o);\n\n gl_FragColor = o;\n\n #if SHOW_OUT_LINE\n\n vec4 color_dest = outlineColor * getBgAlpha();\n\n vec4 color_src = o;\n\n gl_FragColor = color_src * color_src.a + color_dest * (1.0 - color_src.a);\n\n #endif\n}\n" } } ], diff --git a/assets/materials/outter-glow.mtl b/assets/materials/outter-glow.mtl index d224faa..732106d 100644 --- a/assets/materials/outter-glow.mtl +++ b/assets/materials/outter-glow.mtl @@ -20,6 +20,6 @@ "z": 0, "w": 1 }, - "outlineSize": 0.01 + "outlineSize": 0.1 } } \ No newline at end of file diff --git a/assets/scenes/OutterGlowEffectScene.fire b/assets/scenes/OutterGlowEffectScene.fire index aea1189..eead55f 100755 --- a/assets/scenes/OutterGlowEffectScene.fire +++ b/assets/scenes/OutterGlowEffectScene.fire @@ -991,7 +991,7 @@ }, "_contentSize": { "__type__": "cc.Size", - "width": 585.3299999999999, + "width": 195, "height": 0 }, "_anchorPoint": { @@ -1065,7 +1065,7 @@ "__type__": "TypedArray", "ctor": "Float64Array", "array": [ - -195.16499999999996, + 0, 0, 0, 0, @@ -1130,7 +1130,7 @@ "__id__": 21 }, "_children": [], - "_active": true, + "_active": false, "_components": [ { "__id__": 25 @@ -1224,7 +1224,7 @@ "_enabled": true, "_layoutSize": { "__type__": "cc.Size", - "width": 585.3299999999999, + "width": 195, "height": 0 }, "_resize": 1, @@ -1258,7 +1258,7 @@ "alignMode": 1, "_target": null, "_alignFlags": 8, - "_left": 0.15, + "_left": 0.35329687499999995, "_right": 0, "_top": 0, "_bottom": 0, diff --git a/settings/project.json b/settings/project.json index 65a0f90..8641067 100755 --- a/settings/project.json +++ b/settings/project.json @@ -8,27 +8,26 @@ "group-list": [ "default" ], - "start-scene": "2d2f792f-a40c-49bb-a189-ed176a246e49", "design-resolution-width": 960, "design-resolution-height": 640, "fit-width": false, "fit-height": true, "use-project-simulator-setting": false, "simulator-orientation": false, - "use-customize-simulator": false, + "use-customize-simulator": true, "simulator-resolution": { - "width": 960, - "height": 640 + "height": 640, + "width": 960 }, "last-module-event-record-time": 1575989336079, "assets-sort-type": "name", "facebook": { - "enable": false, "appID": "", - "live": { + "audience": { "enable": false }, - "audience": { + "enable": false, + "live": { "enable": false } } From f383b8edec336ddf636d4f88c5f8298d10de1331 Mon Sep 17 00:00:00 2001 From: caizhitao Date: Thu, 19 Dec 2019 16:25:44 +0800 Subject: [PATCH 03/24] =?UTF-8?q?=E5=AE=8C=E5=96=84demo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/scenes/OutterGlowEffectScene.fire | 219 +++++++++++++++++++++-- assets/scripts/OutterGlowEffectScene.ts | 37 ++-- assets/textures/start_0.png | Bin 0 -> 2412 bytes assets/textures/start_0.png.meta | 34 ++++ settings/project.json | 3 +- 5 files changed, 256 insertions(+), 37 deletions(-) create mode 100644 assets/textures/start_0.png create mode 100644 assets/textures/start_0.png.meta diff --git a/assets/scenes/OutterGlowEffectScene.fire b/assets/scenes/OutterGlowEffectScene.fire index eead55f..c2d1ed8 100755 --- a/assets/scenes/OutterGlowEffectScene.fire +++ b/assets/scenes/OutterGlowEffectScene.fire @@ -84,10 +84,10 @@ "_active": true, "_components": [ { - "__id__": 28 + "__id__": 32 }, { - "__id__": 29 + "__id__": 33 } ], "_prefab": null, @@ -969,15 +969,21 @@ }, { "__id__": 24 + }, + { + "__id__": 26 + }, + { + "__id__": 28 } ], "_active": true, "_components": [ { - "__id__": 26 + "__id__": 30 }, { - "__id__": 27 + "__id__": 31 } ], "_prefab": null, @@ -991,7 +997,7 @@ }, "_contentSize": { "__type__": "cc.Size", - "width": 195, + "width": 401, "height": 0 }, "_anchorPoint": { @@ -1065,7 +1071,7 @@ "__type__": "TypedArray", "ctor": "Float64Array", "array": [ - 0, + -103, 0, 0, 0, @@ -1159,7 +1165,7 @@ "__type__": "TypedArray", "ctor": "Float64Array", "array": [ - 121.50000000000003, + 18.50000000000003, 0, 0, 0, @@ -1214,6 +1220,194 @@ "_N$cacheMode": 0, "_id": "9fH5zrVThO/I9ly3o3xhIT" }, + { + "__type__": "cc.Node", + "_name": "start_0", + "_objFlags": 0, + "_parent": { + "__id__": 21 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 27 + } + ], + "_prefab": null, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 50, + "height": 50 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + 67.5, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1 + ] + }, + "_eulerAngles": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_skewX": 0, + "_skewY": 0, + "_is3DNode": false, + "_groupIndex": 0, + "groupIndex": 0, + "_id": "4bo6rvkTlF5rMMdsguMMH3" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 26 + }, + "_enabled": true, + "_materials": [ + { + "__uuid__": "b878db1a-68e4-460d-95f8-83fdb34c11e6" + } + ], + "_srcBlendFactor": 770, + "_dstBlendFactor": 771, + "_spriteFrame": { + "__uuid__": "54142b08-a163-426e-a75e-4c7b21046413" + }, + "_type": 0, + "_sizeMode": 1, + "_fillType": 0, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": true, + "_atlas": null, + "_id": "59FQF0oT5EwKmj0nBbaZdm" + }, + { + "__type__": "cc.Node", + "_name": "ball_00", + "_objFlags": 0, + "_parent": { + "__id__": 21 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 29 + } + ], + "_prefab": null, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 60, + "height": 60 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + 170.5, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1 + ] + }, + "_eulerAngles": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_skewX": 0, + "_skewY": 0, + "_is3DNode": false, + "_groupIndex": 0, + "groupIndex": 0, + "_id": "7e02DWsH9JIajxCtAZc1ug" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 28 + }, + "_enabled": true, + "_materials": [ + { + "__uuid__": "b878db1a-68e4-460d-95f8-83fdb34c11e6" + } + ], + "_srcBlendFactor": 770, + "_dstBlendFactor": 771, + "_spriteFrame": { + "__uuid__": "d0b78623-4e79-4de1-b1d2-ea211bf4652c" + }, + "_type": 0, + "_sizeMode": 1, + "_fillType": 0, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": true, + "_atlas": null, + "_id": "24JG5wcHpMbKwEVWPmOT/7" + }, { "__type__": "cc.Layout", "_name": "", @@ -1224,7 +1418,7 @@ "_enabled": true, "_layoutSize": { "__type__": "cc.Size", - "width": 195, + "width": 401, "height": 0 }, "_resize": 1, @@ -1258,7 +1452,7 @@ "alignMode": 1, "_target": null, "_alignFlags": 8, - "_left": 0.35329687499999995, + "_left": 0.2460052083333333, "_right": 0, "_top": 0, "_bottom": 0, @@ -1299,11 +1493,8 @@ "__id__": 2 }, "_enabled": true, - "exampleSprite": { - "__id__": 23 - }, - "exampleLabel": { - "__id__": 25 + "examplesParentNode": { + "__id__": 21 }, "_id": "5cIwQjksRDKJ/zWSTFHRWJ" } diff --git a/assets/scripts/OutterGlowEffectScene.ts b/assets/scripts/OutterGlowEffectScene.ts index 68d0fda..610f9a0 100644 --- a/assets/scripts/OutterGlowEffectScene.ts +++ b/assets/scripts/OutterGlowEffectScene.ts @@ -1,41 +1,34 @@ const { ccclass, property } = cc._decorator; @ccclass -export default class MainSceneCtrl extends cc.Component { - @property(cc.Sprite) - exampleSprite: cc.Sprite = null; - - @property(cc.Label) - exampleLabel: cc.Label = null; +export default class OutterGlowEffectScene extends cc.Component { + @property(cc.Node) + examplesParentNode: cc.Node = null; start() { - this._updateSpriteOutlineWidth(0); - this._updateLabelOutlineWidth(0); + this._updateRenderComponentOutterGlowMaterial(0); } onSideCallBack(slider: cc.Slider, customEventData: string) { - this._updateSpriteOutlineWidth(slider.progress / 100); - this._updateLabelOutlineWidth(slider.progress / 100); + this._updateRenderComponentOutterGlowMaterial(slider.progress / 100); } /** - * 动态更新描边宽度 + * 更新渲染组件的材质 * * 1. 获取材质 * 2. 给材质的自定义 unitform 变量赋值 * 3. 重新将材质赋值回去 * - * @property outlineSize 描边长度比例[0,1] 比如0.5,那么就是宽*0.5 高*0.5 + * @param size 描边长度比例[0,1] 比如0.5,那么就是宽*0.5 高*0.5 */ - private _updateSpriteOutlineWidth(outlineSize: number) { - let spriteMaterial: cc.Material = this.exampleSprite.getMaterial(0); - spriteMaterial.setProperty("outlineSize", outlineSize); - this.exampleSprite.setMaterial(0, spriteMaterial); - } - - private _updateLabelOutlineWidth(outlineSize: number) { - let labelMaterial: cc.Material = this.exampleLabel.getMaterial(0); - labelMaterial.setProperty("outlineSize", outlineSize); - this.exampleLabel.setMaterial(0, labelMaterial); + private _updateRenderComponentOutterGlowMaterial(size: number) { + this.examplesParentNode.children.forEach(childNode => { + childNode.getComponents(cc.RenderComponent).forEach(renderComponent => { + let material: cc.Material = renderComponent.getMaterial(0); + material.setProperty("outlineSize", size); + renderComponent.setMaterial(0, material); + }); + }); } } diff --git a/assets/textures/start_0.png b/assets/textures/start_0.png new file mode 100644 index 0000000000000000000000000000000000000000..766f18100d5c9304f62d3b47161480b5ae8c8cd8 GIT binary patch literal 2412 zcmbVOdss~S8lIF~N+~J|jhPz4%&fW38jYE$NsSs^DM^~ks-~J|teI{kQ%WV5go>S{ z%iap@O30?I!X{4iXj4Q*DP1UpP{&z=ob!ig|8dsyto6IS@B4kf@A5n=-D9outeKWG zQ7F_bfeYUY8SS<2bbaK@8h;2Q!+f=qpW0gytd0@E5Q-;Nh#|BRwj2ij2qLueX-j+c?qRADC-_>f8h z%am%FA`-1t6p0m4YBmP(^xGBWN}=$FaHQ&cppcLeV?|0Li2xAga_zmoqE%`y=)Z3K z6s_`!Q$j>9NTrB^B}hJkv6EyZcK>Wh3q-tOxx+FfDWV9zLJ}p1BGm#u8-tt>q%tW> zN@a-YQYwI_0(3H-PNs_ROb`&`8B8Vs01N;Wi^-EZKjZU3kU?QO@Ex5T$Rv^zlSv`* zKoXzIqwpA12PS`#D~MF7MUfI{(zXn-{hjOhk6e}`42jeV*his=n5+ViP=#8d3RNi4 zj*i-_GtoH~&=jyn}+4L|cs9vq)HM z>SRKh{jxZe`kL~VlAh+(E`BRpSY47Z?XUDK3m4slics@BH#;w`xt$_^sQkUv>xP3pz{| znHBjR(^xDTT>E0JfqoYd`f`c zzqhZOk%PKl#|kQT;*2IOo9~{8*DD|wFDq)R&L0bhl zWpl-msQW$1fLO^Ua3E&EQmNtKX~y1qo63SC<~QkYk%@{nm)BXT#(|qWBz-NZVqi|+-LJ$yU{C5Y6I}ASFBYzfe&>f|-u!beH zp%r{MtCxCcmC;pi-WR_Be=~2H*(hV*@JKjqn(6&i=5*_VPQpUu+MJAN;MO%#WK(_;fI$wctb(+%T`Sae=`^Pr)ump#Eju zq28WugVbU{%)zeLtn*J|lW*%8=)gvo)D3}ub$V+yCsOJRoiE3PNFyE^?5jd2`%Zsl zUFovSTqj3UTi2dl6uO^^BM4iQ8B{W^Xyw=&f*dO@Q)C{B%*TBv9b#MIzM=w?~23%${3v`bQfM%v)mC z`ccIwJ*pmnGfnadHJx*KUX?jl+b~U?#fo$ggstMoTq?@kiz8{nQa-C{UqULzT6 zpNYT(`_`DHBpi2k3SdOr6`wjp!DFi;To2qWO6U!mo6QHq&R`2;YJKW!uVJ7ww8~9R zVJl`cU^4eXLHu?AOx_?J3482k*1+v3ceSu<+qf?jrw$#qaWW z(4sVQ26hj~T{)aOb^lwMz5s}b$NpzK9{cgdQn1UOgDSR~3auiyS=1b-Qe zHZAk-==(h}T5pGn^!miX)#rq!kpIr&?0!#N2+SSH9cX9*3b-SA^qSD};n!Y$^Z*wf zYI^R;SFhSiS}*mvRQfj2VkN3^Bfk~;UdwUi>_4{+e`OFtif9s~e=>Te$Tk&8|zur3S|Bt|FEx+6$DCs|~ Cli(Ww literal 0 HcmV?d00001 diff --git a/assets/textures/start_0.png.meta b/assets/textures/start_0.png.meta new file mode 100644 index 0000000..10d5898 --- /dev/null +++ b/assets/textures/start_0.png.meta @@ -0,0 +1,34 @@ +{ + "ver": "2.3.3", + "uuid": "2453b01d-4364-4d87-ab53-391d1a42d07d", + "type": "sprite", + "wrapMode": "clamp", + "filterMode": "bilinear", + "premultiplyAlpha": false, + "genMipmaps": false, + "packable": true, + "platformSettings": {}, + "subMetas": { + "start_0": { + "ver": "1.0.4", + "uuid": "54142b08-a163-426e-a75e-4c7b21046413", + "rawTextureUuid": "2453b01d-4364-4d87-ab53-391d1a42d07d", + "trimType": "auto", + "trimThreshold": 1, + "rotated": false, + "offsetX": 1, + "offsetY": 1, + "trimX": 6, + "trimY": 4, + "width": 50, + "height": 50, + "rawWidth": 60, + "rawHeight": 60, + "borderTop": 0, + "borderBottom": 0, + "borderLeft": 0, + "borderRight": 0, + "subMetas": {} + } + } +} \ No newline at end of file diff --git a/settings/project.json b/settings/project.json index 8641067..215ff90 100755 --- a/settings/project.json +++ b/settings/project.json @@ -30,5 +30,6 @@ "live": { "enable": false } - } + }, + "start-scene": "current" } From 540992a7193976831c69ddcca36cea83ffdd7d51 Mon Sep 17 00:00:00 2001 From: caizhitao Date: Fri, 20 Dec 2019 10:58:26 +0800 Subject: [PATCH 04/24] =?UTF-8?q?=E5=88=9D=E6=AD=A5=E5=8A=A0=E5=85=A5?= =?UTF-8?q?=E5=86=85=E5=8F=91=E5=85=89=EF=BC=8C=E6=95=B4=E7=90=86=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../{outter-glow.effect => glow-inner.effect} | 0 assets/effects/glow-inner.effect.meta | 17 + assets/effects/glow-outter.effect | 150 ++ ...ow.effect.meta => glow-outter.effect.meta} | 0 assets/materials/glow-inner.mtl | 25 + assets/materials/glow-inner.mtl.meta | 6 + .../{outter-glow.mtl => glow-outter.mtl} | 0 ...ter-glow.mtl.meta => glow-outter.mtl.meta} | 0 assets/scenes/GlowInnerEffectScene.fire | 1660 +++++++++++++++++ assets/scenes/GlowInnerEffectScene.fire.meta | 7 + ...tScene.fire => GlowOutterEffectScene.fire} | 119 +- ...e.meta => GlowOutterEffectScene.fire.meta} | 0 assets/scripts/GlowInnerEffectScene.ts | 34 + assets/scripts/GlowInnerEffectScene.ts.meta | 9 + ...ffectScene.ts => GlowOutterEffectScene.ts} | 2 +- ....ts.meta => GlowOutterEffectScene.ts.meta} | 0 assets/textures/prestige_04_big.png | Bin 0 -> 9806 bytes assets/textures/prestige_04_big.png.meta | 34 + 18 files changed, 2051 insertions(+), 12 deletions(-) rename assets/effects/{outter-glow.effect => glow-inner.effect} (100%) create mode 100644 assets/effects/glow-inner.effect.meta create mode 100644 assets/effects/glow-outter.effect rename assets/effects/{outter-glow.effect.meta => glow-outter.effect.meta} (100%) create mode 100644 assets/materials/glow-inner.mtl create mode 100644 assets/materials/glow-inner.mtl.meta rename assets/materials/{outter-glow.mtl => glow-outter.mtl} (100%) rename assets/materials/{outter-glow.mtl.meta => glow-outter.mtl.meta} (100%) create mode 100755 assets/scenes/GlowInnerEffectScene.fire create mode 100644 assets/scenes/GlowInnerEffectScene.fire.meta rename assets/scenes/{OutterGlowEffectScene.fire => GlowOutterEffectScene.fire} (93%) rename assets/scenes/{OutterGlowEffectScene.fire.meta => GlowOutterEffectScene.fire.meta} (100%) create mode 100644 assets/scripts/GlowInnerEffectScene.ts create mode 100644 assets/scripts/GlowInnerEffectScene.ts.meta rename assets/scripts/{OutterGlowEffectScene.ts => GlowOutterEffectScene.ts} (94%) rename assets/scripts/{OutterGlowEffectScene.ts.meta => GlowOutterEffectScene.ts.meta} (100%) create mode 100644 assets/textures/prestige_04_big.png create mode 100644 assets/textures/prestige_04_big.png.meta diff --git a/assets/effects/outter-glow.effect b/assets/effects/glow-inner.effect similarity index 100% rename from assets/effects/outter-glow.effect rename to assets/effects/glow-inner.effect diff --git a/assets/effects/glow-inner.effect.meta b/assets/effects/glow-inner.effect.meta new file mode 100644 index 0000000..cef30ab --- /dev/null +++ b/assets/effects/glow-inner.effect.meta @@ -0,0 +1,17 @@ +{ + "ver": "1.0.23", + "uuid": "90211f16-c00e-4c37-a192-43ec50c9ea35", + "compiledShaders": [ + { + "glsl1": { + "vert": "\nprecision highp float;\nuniform mat4 cc_matViewProj;\nuniform mat4 cc_matWorld;\n\nattribute vec3 a_position;\nattribute vec4 a_color;\nvarying vec4 v_color;\n\n#if USE_TEXTURE\nattribute vec2 a_uv0;\nvarying vec2 v_uv0;\n#endif\n\nvoid main () {\n vec4 pos = vec4(a_position, 1);\n\n #if CC_USE_MODEL\n pos = cc_matViewProj * cc_matWorld * pos;\n #else\n pos = cc_matViewProj * pos;\n #endif\n\n #if USE_TEXTURE\n v_uv0 = a_uv0;\n #endif\n\n v_color = a_color;\n\n gl_Position = pos;\n}\n", + "frag": "\nprecision highp float;\n\n#if USE_ALPHA_TEST\n \n uniform float alphaThreshold;\n#endif\n\nvoid ALPHA_TEST (in vec4 color) {\n #if USE_ALPHA_TEST\n if (color.a < alphaThreshold) discard;\n #endif\n}\n\nvoid ALPHA_TEST (in float alpha) {\n #if USE_ALPHA_TEST\n if (alpha < alphaThreshold) discard;\n #endif\n}\n\nvarying vec4 v_color;\n\n#if USE_TEXTURE\nvarying vec2 v_uv0;\nuniform sampler2D texture;\n#endif\n\n#if SHOW_OUT_LINE\n\nuniform vec4 outlineColor;\nuniform float outlineSize;\n\nfloat getAlpha(float size) {\n vec4 color_up = texture2D(texture, v_uv0 + vec2(0, size)); \n vec4 color_down = texture2D(texture, v_uv0 - vec2(0, size)); \n vec4 color_left = texture2D(texture, v_uv0 - vec2(size, 0)); \n vec4 color_right = texture2D(texture, v_uv0 + vec2(size, 0)); \n vec4 color_up_left = texture2D(texture, v_uv0 + vec2(size, -size)); \n vec4 color_up_right = texture2D(texture, v_uv0 + vec2(size, size)); \n vec4 color_down_left = texture2D(texture, v_uv0 + vec2(-size, -size)); \n vec4 color_down_right = texture2D(texture, v_uv0 + vec2(-size, size)); \n float total = color_right.a + color_left.a + color_down.a + color_up.a + color_up_left.a + color_up_right.a + color_down_left.a + color_down_right.a; \n return step(0.000000001, total);\n}\n\nfloat getBgAlpha() {\n vec4 color_cur = texture2D(texture, v_uv0);\n float alpha = step(0.000000001, color_cur.a);\n if (alpha > 0.000000001) {\n return 1.0;\n } else {\n float total = 0.0;\n for (float i = 0.0; i <= 1.0; i += 0.01) {\n total += getAlpha(outlineSize * i);\n }\n total *= 0.01;\n return clamp(total, 0.0, 1.0);\n }\n}\n\n#endif\n\nvoid main () {\n vec4 o = vec4(1, 1, 1, 1);\n\n #if USE_TEXTURE\n o *= texture2D(texture, v_uv0);\n #if CC_USE_ALPHA_ATLAS_TEXTURE\n o.a *= texture2D(texture, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #endif\n\n o *= v_color;\n\n ALPHA_TEST(o);\n\n gl_FragColor = o;\n\n #if SHOW_OUT_LINE\n\n vec4 color_dest = outlineColor * getBgAlpha();\n\n vec4 color_src = o;\n\n gl_FragColor = color_src * color_src.a + color_dest * (1.0 - color_src.a);\n\n #endif\n}\n" + }, + "glsl3": { + "vert": "\nprecision highp float;\nuniform CCGlobal {\n vec4 cc_time;\n\n vec4 cc_screenSize;\n\n vec4 cc_screenScale;\n\n vec4 cc_nativeSize;\n\n mat4 cc_matView;\n mat4 cc_matViewInv;\n mat4 cc_matProj;\n mat4 cc_matProjInv;\n mat4 cc_matViewProj;\n mat4 cc_matViewProjInv;\n vec4 cc_cameraPos;\n\n vec4 cc_exposure;\n\n vec4 cc_mainLitDir;\n\n vec4 cc_mainLitColor;\n\n vec4 cc_ambientSky;\n vec4 cc_ambientGround;\n};\nuniform CCLocal {\n mat4 cc_matWorld;\n mat4 cc_matWorldIT;\n};\n\nin vec3 a_position;\nin vec4 a_color;\nout vec4 v_color;\n\n#if USE_TEXTURE\nin vec2 a_uv0;\nout vec2 v_uv0;\n#endif\n\nvoid main () {\n vec4 pos = vec4(a_position, 1);\n\n #if CC_USE_MODEL\n pos = cc_matViewProj * cc_matWorld * pos;\n #else\n pos = cc_matViewProj * pos;\n #endif\n\n #if USE_TEXTURE\n v_uv0 = a_uv0;\n #endif\n\n v_color = a_color;\n\n gl_Position = pos;\n}\n", + "frag": "\nprecision highp float;\n\n#if USE_ALPHA_TEST\n \n uniform ALPHA_TEST {\n float alphaThreshold;\n }\n#endif\n\nvoid ALPHA_TEST (in vec4 color) {\n #if USE_ALPHA_TEST\n if (color.a < alphaThreshold) discard;\n #endif\n}\n\nvoid ALPHA_TEST (in float alpha) {\n #if USE_ALPHA_TEST\n if (alpha < alphaThreshold) discard;\n #endif\n}\n\nin vec4 v_color;\n\n#if USE_TEXTURE\nin vec2 v_uv0;\nuniform sampler2D texture;\n#endif\n\n#if SHOW_OUT_LINE\n\nuniform Outline {\n\n vec4 outlineColor;\n\n float outlineSize;\n\n};\n\nfloat getAlpha(float size) {\n vec4 color_up = texture(texture, v_uv0 + vec2(0, size)); \n vec4 color_down = texture(texture, v_uv0 - vec2(0, size)); \n vec4 color_left = texture(texture, v_uv0 - vec2(size, 0)); \n vec4 color_right = texture(texture, v_uv0 + vec2(size, 0)); \n vec4 color_up_left = texture(texture, v_uv0 + vec2(size, -size)); \n vec4 color_up_right = texture(texture, v_uv0 + vec2(size, size)); \n vec4 color_down_left = texture(texture, v_uv0 + vec2(-size, -size)); \n vec4 color_down_right = texture(texture, v_uv0 + vec2(-size, size)); \n float total = color_right.a + color_left.a + color_down.a + color_up.a + color_up_left.a + color_up_right.a + color_down_left.a + color_down_right.a; \n return step(0.000000001, total);\n}\n\nfloat getBgAlpha() {\n vec4 color_cur = texture(texture, v_uv0);\n float alpha = step(0.000000001, color_cur.a);\n if (alpha > 0.000000001) {\n return 1.0;\n } else {\n float total = 0.0;\n for (float i = 0.0; i <= 1.0; i += 0.01) {\n total += getAlpha(outlineSize * i);\n }\n total *= 0.01;\n return clamp(total, 0.0, 1.0);\n }\n}\n\n#endif\n\nvoid main () {\n vec4 o = vec4(1, 1, 1, 1);\n\n #if USE_TEXTURE\n o *= texture(texture, v_uv0);\n #if CC_USE_ALPHA_ATLAS_TEXTURE\n o.a *= texture2D(texture, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #endif\n\n o *= v_color;\n\n ALPHA_TEST(o);\n\n gl_FragColor = o;\n\n #if SHOW_OUT_LINE\n\n vec4 color_dest = outlineColor * getBgAlpha();\n\n vec4 color_src = o;\n\n gl_FragColor = color_src * color_src.a + color_dest * (1.0 - color_src.a);\n\n #endif\n}\n" + } + } + ], + "subMetas": {} +} \ No newline at end of file diff --git a/assets/effects/glow-outter.effect b/assets/effects/glow-outter.effect new file mode 100644 index 0000000..aaa0e69 --- /dev/null +++ b/assets/effects/glow-outter.effect @@ -0,0 +1,150 @@ +// Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. +// 外发光特效 +CCEffect %{ + techniques: + - passes: + - vert: vs + frag: fs + blendState: + targets: + - blend: true + rasterizerState: + cullMode: none + properties: + texture: { value: white } + alphaThreshold: { value: 0.5 } + outlineColor: { value: [1.0, 1.0, 0.0, 1.0], editor: { type: color } } + outlineSize: { value: 0.01 } +}% + + +CCProgram vs %{ + precision highp float; + + #include + #include + + in vec3 a_position; + in vec4 a_color; + out vec4 v_color; + + #if USE_TEXTURE + in vec2 a_uv0; + out vec2 v_uv0; + #endif + + void main () { + vec4 pos = vec4(a_position, 1); + + #if CC_USE_MODEL + pos = cc_matViewProj * cc_matWorld * pos; + #else + pos = cc_matViewProj * pos; + #endif + + #if USE_TEXTURE + v_uv0 = a_uv0; + #endif + + v_color = a_color; + + gl_Position = pos; + } +}% + + +CCProgram fs %{ + precision highp float; + + #include + + in vec4 v_color; + + #if USE_TEXTURE + in vec2 v_uv0; + uniform sampler2D texture; + #endif + + #if SHOW_OUT_LINE + + uniform Outline { + // 描边颜色 + vec4 outlineColor; + // 描边偏移大小 + float outlineSize; + // 特别地,必须是 vec4 先于 float 声明 + }; + + float getAlpha(float size) { + vec4 color_up = texture(texture, v_uv0 + vec2(0, size)); + vec4 color_down = texture(texture, v_uv0 - vec2(0, size)); + vec4 color_left = texture(texture, v_uv0 - vec2(size, 0)); + vec4 color_right = texture(texture, v_uv0 + vec2(size, 0)); + vec4 color_up_left = texture(texture, v_uv0 + vec2(size, -size)); + vec4 color_up_right = texture(texture, v_uv0 + vec2(size, size)); + vec4 color_down_left = texture(texture, v_uv0 + vec2(-size, -size)); + vec4 color_down_right = texture(texture, v_uv0 + vec2(-size, size)); + float total = color_right.a + color_left.a + color_down.a + color_up.a + color_up_left.a + color_up_right.a + color_down_left.a + color_down_right.a; + return step(0.000000001, total); + } + + // 将图像往8个方向偏移后,得到一个类放大效果,然后取放大后的图像的透明度,即可得到一个放大后的区域,可以很方便填充(描边)颜色 + // 取当前点上、下、左、右、上左、上右、下左、下右共计8个方向,距离为 outlineSize 的8个点,求他们的透明度之和 + // 由此可以得到当前点是否属于图像往八个方向做偏移后得到的放大图区域,并且能得到该点最终透明度值 + // 最终对应的为图像偏移/放大后的背景区域 + float getBgAlpha() { + vec4 color_cur = texture(texture, v_uv0); + float alpha = step(0.000000001, color_cur.a); + if (alpha > 0.000000001) { + return 1.0; + } else { + float total = 0.0; + for (float i = 0.0; i <= 1.0; i += 0.01) { + total += getAlpha(outlineSize * i); + } + total *= 0.01; + return clamp(total, 0.0, 1.0); + } + } + + + + #endif + + void main () { + vec4 o = vec4(1, 1, 1, 1); + + #if USE_TEXTURE + o *= texture(texture, v_uv0); + #if CC_USE_ALPHA_ATLAS_TEXTURE + o.a *= texture2D(texture, v_uv0 + vec2(0, 0.5)).r; + #endif + #endif + + o *= v_color; + + ALPHA_TEST(o); + + gl_FragColor = o; + + #if SHOW_OUT_LINE + // 先画背景色 + vec4 color_dest = outlineColor * getBgAlpha(); + + // 然后在背景色上方画图案颜色 + vec4 color_src = o; + + // 按照这个顺序,源颜色就是图案颜色,目标颜色就是背景色 + // 所以命名就是 color_src, color_dest + + // 按照混合颜色规则 http://docs.cocos.com/creator/manual/zh/advanced-topics/ui-auto-batch.html#blend-%E6%A8%A1%E5%BC%8F + // 要在底色上方,画一个图案,图案完全挡住底色,那么最终选择的混合模式如下: + // color_src: GL_SRC_ALPHA + // color_dest: GL_ONE_MINUS_SRC_ALPHA + // 即最终颜色如下: + // color_src * GL_SRC_ALPHA + color_dest * GL_ONE_MINUS_SRC_ALPHA + gl_FragColor = color_src * color_src.a + color_dest * (1.0 - color_src.a); + // gl_FragColor = color_dest; + #endif + } +}% diff --git a/assets/effects/outter-glow.effect.meta b/assets/effects/glow-outter.effect.meta similarity index 100% rename from assets/effects/outter-glow.effect.meta rename to assets/effects/glow-outter.effect.meta diff --git a/assets/materials/glow-inner.mtl b/assets/materials/glow-inner.mtl new file mode 100644 index 0000000..0dfb81c --- /dev/null +++ b/assets/materials/glow-inner.mtl @@ -0,0 +1,25 @@ +{ + "__type__": "cc.Material", + "_name": "", + "_objFlags": 0, + "_native": "", + "_effectAsset": { + "__uuid__": "90211f16-c00e-4c37-a192-43ec50c9ea35" + }, + "_defines": { + "USE_TEXTURE": true, + "USE_ALPHA_TEST": false, + "SHOW_OUT_LINE": true + }, + "_props": { + "texture": null, + "outlineColor": { + "__type__": "cc.Vec4", + "x": 1, + "y": 1, + "z": 0, + "w": 1 + }, + "outlineSize": 0.1 + } +} \ No newline at end of file diff --git a/assets/materials/glow-inner.mtl.meta b/assets/materials/glow-inner.mtl.meta new file mode 100644 index 0000000..cfcae2f --- /dev/null +++ b/assets/materials/glow-inner.mtl.meta @@ -0,0 +1,6 @@ +{ + "ver": "1.0.2", + "uuid": "2c760728-404d-4553-a1d0-7ab18263845c", + "dataAsSubAsset": null, + "subMetas": {} +} \ No newline at end of file diff --git a/assets/materials/outter-glow.mtl b/assets/materials/glow-outter.mtl similarity index 100% rename from assets/materials/outter-glow.mtl rename to assets/materials/glow-outter.mtl diff --git a/assets/materials/outter-glow.mtl.meta b/assets/materials/glow-outter.mtl.meta similarity index 100% rename from assets/materials/outter-glow.mtl.meta rename to assets/materials/glow-outter.mtl.meta diff --git a/assets/scenes/GlowInnerEffectScene.fire b/assets/scenes/GlowInnerEffectScene.fire new file mode 100755 index 0000000..8e42e28 --- /dev/null +++ b/assets/scenes/GlowInnerEffectScene.fire @@ -0,0 +1,1660 @@ +[ + { + "__type__": "cc.SceneAsset", + "_name": "", + "_objFlags": 0, + "_native": "", + "scene": { + "__id__": 1 + } + }, + { + "__type__": "cc.Scene", + "_objFlags": 0, + "_parent": null, + "_children": [ + { + "__id__": 2 + }, + { + "__id__": 35 + } + ], + "_active": true, + "_components": [], + "_prefab": null, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 0, + "height": 0 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1 + ] + }, + "_is3DNode": true, + "_groupIndex": 0, + "groupIndex": 0, + "autoReleaseAssets": false, + "_id": "69a920f1-0509-4d54-b033-5fb5b1283b72" + }, + { + "__type__": "cc.Node", + "_name": "Canvas", + "_objFlags": 0, + "_parent": { + "__id__": 1 + }, + "_children": [ + { + "__id__": 3 + }, + { + "__id__": 5 + }, + { + "__id__": 8 + }, + { + "__id__": 21 + } + ], + "_active": true, + "_components": [ + { + "__id__": 34 + } + ], + "_prefab": null, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 252, + "g": 252, + "b": 252, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 960, + "height": 640 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + 480, + 320, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1 + ] + }, + "_eulerAngles": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_skewX": 0, + "_skewY": 0, + "_is3DNode": false, + "_groupIndex": 0, + "groupIndex": 0, + "_id": "a286bbGknJLZpRpxROV6M94" + }, + { + "__type__": "cc.Node", + "_name": "Main Camera", + "_objFlags": 0, + "_parent": { + "__id__": 2 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 4 + } + ], + "_prefab": null, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 0, + "height": 0 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + 0, + 0, + 393.1755333181352, + 0, + 0, + 0, + 1, + 1, + 1, + 1 + ] + }, + "_eulerAngles": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_skewX": 0, + "_skewY": 0, + "_is3DNode": false, + "_groupIndex": 0, + "groupIndex": 0, + "_id": "fbL5wf1mhFa6PPZbeZvnZ9" + }, + { + "__type__": "cc.Camera", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 3 + }, + "_enabled": true, + "_cullingMask": 4294967295, + "_clearFlags": 7, + "_backgroundColor": { + "__type__": "cc.Color", + "r": 0, + "g": 0, + "b": 0, + "a": 255 + }, + "_depth": -1, + "_zoomRatio": 1, + "_targetTexture": null, + "_fov": 60, + "_orthoSize": 10, + "_nearClip": 1, + "_farClip": 4096, + "_ortho": true, + "_rect": { + "__type__": "cc.Rect", + "x": 0, + "y": 0, + "width": 1, + "height": 1 + }, + "_renderStages": 1, + "_alignWithScreen": true, + "_id": "adItdqNzZHbYUhDAmfCr9b" + }, + { + "__type__": "cc.Node", + "_name": "Bg", + "_objFlags": 0, + "_parent": { + "__id__": 2 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 6 + }, + { + "__id__": 7 + } + ], + "_prefab": null, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 27, + "g": 38, + "b": 46, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 960, + "height": 640 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1 + ] + }, + "_eulerAngles": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_skewX": 0, + "_skewY": 0, + "_is3DNode": false, + "_groupIndex": 0, + "groupIndex": 0, + "_id": "e2e0crkOLxGrpMxpbC4iQg1" + }, + { + "__type__": "cc.Widget", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 5 + }, + "_enabled": true, + "alignMode": 0, + "_target": null, + "_alignFlags": 45, + "_left": 0, + "_right": 0, + "_top": 0, + "_bottom": 0, + "_verticalCenter": 0, + "_horizontalCenter": 0, + "_isAbsLeft": true, + "_isAbsRight": true, + "_isAbsTop": true, + "_isAbsBottom": true, + "_isAbsHorizontalCenter": true, + "_isAbsVerticalCenter": true, + "_originalWidth": 200, + "_originalHeight": 150, + "_id": "89IA6P0/5JEZERosKJJo6k" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 5 + }, + "_enabled": true, + "_materials": [ + { + "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432" + } + ], + "_srcBlendFactor": 770, + "_dstBlendFactor": 771, + "_spriteFrame": { + "__uuid__": "410fb916-8721-4663-bab8-34397391ace7" + }, + "_type": 1, + "_sizeMode": 0, + "_fillType": 0, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": true, + "_atlas": null, + "_id": "2azjUbJNxALLAfDZrJ8TV0" + }, + { + "__type__": "cc.Node", + "_name": "Layout", + "_objFlags": 0, + "_parent": { + "__id__": 2 + }, + "_children": [ + { + "__id__": 9 + }, + { + "__id__": 11 + } + ], + "_active": true, + "_components": [ + { + "__id__": 19 + }, + { + "__id__": 20 + } + ], + "_prefab": null, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 548, + "height": 150 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + -62, + 168.26, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1 + ] + }, + "_eulerAngles": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_skewX": 0, + "_skewY": 0, + "_is3DNode": false, + "_groupIndex": 0, + "groupIndex": 0, + "_id": "11ZCsp/hhAnoxRSLqdlROB" + }, + { + "__type__": "cc.Node", + "_name": "Label", + "_objFlags": 0, + "_parent": { + "__id__": 8 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 10 + } + ], + "_prefab": null, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 200, + "height": 50.4 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + -174, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1 + ] + }, + "_eulerAngles": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_skewX": 0, + "_skewY": 0, + "_is3DNode": false, + "_groupIndex": 0, + "groupIndex": 0, + "_id": "a8mK6UowJOqLvmjfPIiuTZ" + }, + { + "__type__": "cc.Label", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 9 + }, + "_enabled": true, + "_materials": [ + { + "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432" + } + ], + "_useOriginalSize": false, + "_string": "发光宽度:", + "_N$string": "发光宽度:", + "_fontSize": 40, + "_lineHeight": 40, + "_enableWrapText": true, + "_N$file": null, + "_isSystemFontUsed": true, + "_spacingX": 0, + "_batchAsBitmap": false, + "_N$horizontalAlign": 1, + "_N$verticalAlign": 1, + "_N$fontFamily": "Arial", + "_N$overflow": 0, + "_N$cacheMode": 0, + "_id": "5aqqaNVJNJsqy4cwZGvqW5" + }, + { + "__type__": "cc.Node", + "_name": "Slider", + "_objFlags": 0, + "_parent": { + "__id__": 8 + }, + "_children": [ + { + "__id__": 12 + }, + { + "__id__": 14 + } + ], + "_active": true, + "_components": [ + { + "__id__": 17 + } + ], + "_prefab": null, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 300, + "height": 20 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + 124, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1 + ] + }, + "_eulerAngles": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_skewX": 0, + "_skewY": 0, + "_is3DNode": false, + "_groupIndex": 0, + "groupIndex": 0, + "_id": "e3WHmNWolODK/k/BUhp8n+" + }, + { + "__type__": "cc.Node", + "_name": "Background", + "_objFlags": 0, + "_parent": { + "__id__": 11 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 13 + } + ], + "_prefab": null, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 300, + "height": 20 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1 + ] + }, + "_eulerAngles": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_skewX": 0, + "_skewY": 0, + "_is3DNode": false, + "_groupIndex": 0, + "groupIndex": 0, + "_id": "4e4s7CtEpIPYADvmHwxDSt" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 12 + }, + "_enabled": true, + "_materials": [ + { + "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432" + } + ], + "_srcBlendFactor": 770, + "_dstBlendFactor": 771, + "_spriteFrame": { + "__uuid__": "31d8962d-babb-4ec7-be19-8e9f54a4ea99" + }, + "_type": 1, + "_sizeMode": 0, + "_fillType": 0, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": true, + "_atlas": null, + "_id": "fc/wnYCLxJKrZ8PoMA1CYw" + }, + { + "__type__": "cc.Node", + "_name": "Handle", + "_objFlags": 0, + "_parent": { + "__id__": 11 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 15 + }, + { + "__id__": 16 + } + ], + "_prefab": null, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 32, + "height": 32 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + -150, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1 + ] + }, + "_eulerAngles": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_skewX": 0, + "_skewY": 0, + "_is3DNode": false, + "_groupIndex": 0, + "groupIndex": 0, + "_id": "cboGZ4mmtC7Z7ZvWnGXRab" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 14 + }, + "_enabled": true, + "_materials": [ + { + "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432" + } + ], + "_srcBlendFactor": 770, + "_dstBlendFactor": 771, + "_spriteFrame": { + "__uuid__": "e7aba14b-f956-4480-b254-8d57832e273f" + }, + "_type": 1, + "_sizeMode": 2, + "_fillType": 0, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": true, + "_atlas": null, + "_id": "eeIzXLXopG3Ypab6LDsHxh" + }, + { + "__type__": "cc.Button", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 14 + }, + "_enabled": true, + "_normalMaterial": null, + "_grayMaterial": null, + "duration": 0.1, + "zoomScale": 1.1, + "clickEvents": [], + "_N$interactable": true, + "_N$enableAutoGrayEffect": true, + "_N$transition": 3, + "transition": 3, + "_N$normalColor": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_N$pressedColor": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "pressedColor": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_N$hoverColor": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "hoverColor": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_N$disabledColor": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_N$normalSprite": { + "__uuid__": "e7aba14b-f956-4480-b254-8d57832e273f" + }, + "_N$pressedSprite": { + "__uuid__": "e7aba14b-f956-4480-b254-8d57832e273f" + }, + "pressedSprite": { + "__uuid__": "e7aba14b-f956-4480-b254-8d57832e273f" + }, + "_N$hoverSprite": { + "__uuid__": "e7aba14b-f956-4480-b254-8d57832e273f" + }, + "hoverSprite": { + "__uuid__": "e7aba14b-f956-4480-b254-8d57832e273f" + }, + "_N$disabledSprite": { + "__uuid__": "29158224-f8dd-4661-a796-1ffab537140e" + }, + "_N$target": { + "__id__": 14 + }, + "_id": "f8CMhOw3JJrJn6+CKLopHY" + }, + { + "__type__": "cc.Slider", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 11 + }, + "_enabled": true, + "direction": 0, + "slideEvents": [ + { + "__id__": 18 + } + ], + "_N$handle": { + "__id__": 16 + }, + "_N$progress": 0, + "_id": "69kbIKMEFE4ISodttSO13M" + }, + { + "__type__": "cc.ClickEvent", + "target": { + "__id__": 2 + }, + "component": "", + "_componentId": "408f4mR69xEbpzjsYAGu3vL", + "handler": "onSideCallBack", + "customEventData": "" + }, + { + "__type__": "cc.Layout", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 8 + }, + "_enabled": true, + "_layoutSize": { + "__type__": "cc.Size", + "width": 548, + "height": 150 + }, + "_resize": 1, + "_N$layoutType": 1, + "_N$padding": 0, + "_N$cellSize": { + "__type__": "cc.Size", + "width": 40, + "height": 40 + }, + "_N$startAxis": 0, + "_N$paddingLeft": 0, + "_N$paddingRight": 0, + "_N$paddingTop": 0, + "_N$paddingBottom": 0, + "_N$spacingX": 48, + "_N$spacingY": 0, + "_N$verticalDirection": 1, + "_N$horizontalDirection": 0, + "_N$affectedByScale": false, + "_id": "35c+GGK1pBGY2lVxUQ4a+Y" + }, + { + "__type__": "cc.Widget", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 8 + }, + "_enabled": true, + "alignMode": 1, + "_target": null, + "_alignFlags": 8, + "_left": 0.15, + "_right": 0, + "_top": 0, + "_bottom": 0, + "_verticalCenter": 0, + "_horizontalCenter": 0, + "_isAbsLeft": false, + "_isAbsRight": true, + "_isAbsTop": true, + "_isAbsBottom": true, + "_isAbsHorizontalCenter": true, + "_isAbsVerticalCenter": true, + "_originalWidth": 0, + "_originalHeight": 0, + "_id": "47RYUMeTFP0bPLCO+5W3tH" + }, + { + "__type__": "cc.Node", + "_name": "Layout", + "_objFlags": 0, + "_parent": { + "__id__": 2 + }, + "_children": [ + { + "__id__": 22 + }, + { + "__id__": 24 + }, + { + "__id__": 26 + }, + { + "__id__": 28 + }, + { + "__id__": 30 + } + ], + "_active": true, + "_components": [ + { + "__id__": 32 + }, + { + "__id__": 33 + } + ], + "_prefab": null, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 509, + "height": 0 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + -43.335000000000036, + -63.427, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1 + ] + }, + "_eulerAngles": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_skewX": 0, + "_skewY": 0, + "_is3DNode": false, + "_groupIndex": 0, + "groupIndex": 0, + "_id": "feymBChPxA1pr6+/rlPqey" + }, + { + "__type__": "cc.Node", + "_name": "ExampleSprite", + "_objFlags": 0, + "_parent": { + "__id__": 21 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 23 + } + ], + "_prefab": null, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 195, + "height": 270 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + -157, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1 + ] + }, + "_eulerAngles": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_skewX": 0, + "_skewY": 0, + "_is3DNode": false, + "_groupIndex": 0, + "groupIndex": 0, + "_id": "c4f30YOS65G64U2TwufdJ+2" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 22 + }, + "_enabled": true, + "_materials": [ + { + "__uuid__": "b878db1a-68e4-460d-95f8-83fdb34c11e6" + } + ], + "_srcBlendFactor": 770, + "_dstBlendFactor": 771, + "_spriteFrame": { + "__uuid__": "31bc895a-c003-4566-a9f3-2e54ae1c17dc" + }, + "_type": 0, + "_sizeMode": 1, + "_fillType": 0, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": true, + "_atlas": null, + "_id": "c5wu68mipC4qBjTD+u0rFa" + }, + { + "__type__": "cc.Node", + "_name": "ExampleLabel", + "_objFlags": 0, + "_parent": { + "__id__": 21 + }, + "_children": [], + "_active": false, + "_components": [ + { + "__id__": 25 + } + ], + "_prefab": null, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 342.33, + "height": 100.8 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + 18.50000000000003, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1 + ] + }, + "_eulerAngles": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_skewX": 0, + "_skewY": 0, + "_is3DNode": false, + "_groupIndex": 0, + "groupIndex": 0, + "_id": "31f1bH7V69Ajr1iXhluMpTB" + }, + { + "__type__": "cc.Label", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 24 + }, + "_enabled": true, + "_materials": [ + { + "__uuid__": "b878db1a-68e4-460d-95f8-83fdb34c11e6" + } + ], + "_useOriginalSize": false, + "_string": "Hello, World!", + "_N$string": "Hello, World!", + "_fontSize": 60, + "_lineHeight": 80, + "_enableWrapText": true, + "_N$file": null, + "_isSystemFontUsed": true, + "_spacingX": 0, + "_batchAsBitmap": false, + "_N$horizontalAlign": 1, + "_N$verticalAlign": 1, + "_N$fontFamily": "Arial", + "_N$overflow": 0, + "_N$cacheMode": 0, + "_id": "9fH5zrVThO/I9ly3o3xhIT" + }, + { + "__type__": "cc.Node", + "_name": "start_0", + "_objFlags": 0, + "_parent": { + "__id__": 21 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 27 + } + ], + "_prefab": null, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 50, + "height": 50 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + 13.5, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1 + ] + }, + "_eulerAngles": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_skewX": 0, + "_skewY": 0, + "_is3DNode": false, + "_groupIndex": 0, + "groupIndex": 0, + "_id": "4bo6rvkTlF5rMMdsguMMH3" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 26 + }, + "_enabled": true, + "_materials": [ + { + "__uuid__": "b878db1a-68e4-460d-95f8-83fdb34c11e6" + } + ], + "_srcBlendFactor": 770, + "_dstBlendFactor": 771, + "_spriteFrame": { + "__uuid__": "54142b08-a163-426e-a75e-4c7b21046413" + }, + "_type": 0, + "_sizeMode": 1, + "_fillType": 0, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": true, + "_atlas": null, + "_id": "59FQF0oT5EwKmj0nBbaZdm" + }, + { + "__type__": "cc.Node", + "_name": "ball_00", + "_objFlags": 0, + "_parent": { + "__id__": 21 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 29 + } + ], + "_prefab": null, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 60, + "height": 60 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + 116.5, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1 + ] + }, + "_eulerAngles": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_skewX": 0, + "_skewY": 0, + "_is3DNode": false, + "_groupIndex": 0, + "groupIndex": 0, + "_id": "7e02DWsH9JIajxCtAZc1ug" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 28 + }, + "_enabled": true, + "_materials": [ + { + "__uuid__": "b878db1a-68e4-460d-95f8-83fdb34c11e6" + } + ], + "_srcBlendFactor": 770, + "_dstBlendFactor": 771, + "_spriteFrame": { + "__uuid__": "d0b78623-4e79-4de1-b1d2-ea211bf4652c" + }, + "_type": 0, + "_sizeMode": 1, + "_fillType": 0, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": true, + "_atlas": null, + "_id": "24JG5wcHpMbKwEVWPmOT/7" + }, + { + "__type__": "cc.Node", + "_name": "prestige_04_big", + "_objFlags": 0, + "_parent": { + "__id__": 21 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 31 + } + ], + "_prefab": null, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 60, + "height": 60 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + 224.5, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1 + ] + }, + "_eulerAngles": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_skewX": 0, + "_skewY": 0, + "_is3DNode": false, + "_groupIndex": 0, + "groupIndex": 0, + "_id": "b1QYdYwQ1GIbxm/N2yRRUD" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 30 + }, + "_enabled": true, + "_materials": [ + { + "__uuid__": "b878db1a-68e4-460d-95f8-83fdb34c11e6" + } + ], + "_srcBlendFactor": 770, + "_dstBlendFactor": 771, + "_spriteFrame": { + "__uuid__": "969fa66a-ae10-4157-b16e-4c1a4665920c" + }, + "_type": 0, + "_sizeMode": 1, + "_fillType": 0, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": true, + "_atlas": null, + "_id": "75+LzaMdNGFbA4yyUIIz9s" + }, + { + "__type__": "cc.Layout", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 21 + }, + "_enabled": true, + "_layoutSize": { + "__type__": "cc.Size", + "width": 509, + "height": 0 + }, + "_resize": 1, + "_N$layoutType": 1, + "_N$padding": 0, + "_N$cellSize": { + "__type__": "cc.Size", + "width": 40, + "height": 40 + }, + "_N$startAxis": 0, + "_N$paddingLeft": 0, + "_N$paddingRight": 0, + "_N$paddingTop": 0, + "_N$paddingBottom": 0, + "_N$spacingX": 48, + "_N$spacingY": 0, + "_N$verticalDirection": 1, + "_N$horizontalDirection": 0, + "_N$affectedByScale": false, + "_id": "ff9z0nF9BGm5zFMuGhj1jt" + }, + { + "__type__": "cc.Widget", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 21 + }, + "_enabled": true, + "alignMode": 1, + "_target": null, + "_alignFlags": 8, + "_left": 0.18975520833333331, + "_right": 0, + "_top": 0, + "_bottom": 0, + "_verticalCenter": 0, + "_horizontalCenter": 0, + "_isAbsLeft": false, + "_isAbsRight": true, + "_isAbsTop": true, + "_isAbsBottom": true, + "_isAbsHorizontalCenter": true, + "_isAbsVerticalCenter": true, + "_originalWidth": 0, + "_originalHeight": 0, + "_id": "a4H/CsfipEB73tJmLtFf9/" + }, + { + "__type__": "cc.Canvas", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 2 + }, + "_enabled": true, + "_designResolution": { + "__type__": "cc.Size", + "width": 960, + "height": 640 + }, + "_fitWidth": false, + "_fitHeight": true, + "_id": "4bz2+ak99DBYVlSVIMFGN0" + }, + { + "__type__": "cc.Node", + "_name": "GlowInnerEffectScene", + "_objFlags": 0, + "_parent": { + "__id__": 1 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 36 + } + ], + "_prefab": null, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 0, + "height": 0 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1 + ] + }, + "_eulerAngles": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_skewX": 0, + "_skewY": 0, + "_is3DNode": false, + "_groupIndex": 0, + "groupIndex": 0, + "_id": "72kx+DcCxEba4H6yf1snJe" + }, + { + "__type__": "eebe5Fr5bhMO7IsowoLW/Yp", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 35 + }, + "_enabled": true, + "examplesParentNode": { + "__id__": 21 + }, + "_id": "2buo5DYrlF7akjHTPl2qgk" + } +] \ No newline at end of file diff --git a/assets/scenes/GlowInnerEffectScene.fire.meta b/assets/scenes/GlowInnerEffectScene.fire.meta new file mode 100644 index 0000000..2fcdda5 --- /dev/null +++ b/assets/scenes/GlowInnerEffectScene.fire.meta @@ -0,0 +1,7 @@ +{ + "ver": "1.2.5", + "uuid": "69a920f1-0509-4d54-b033-5fb5b1283b72", + "asyncLoadAssets": false, + "autoReleaseAssets": false, + "subMetas": {} +} \ No newline at end of file diff --git a/assets/scenes/OutterGlowEffectScene.fire b/assets/scenes/GlowOutterEffectScene.fire similarity index 93% rename from assets/scenes/OutterGlowEffectScene.fire rename to assets/scenes/GlowOutterEffectScene.fire index c2d1ed8..46b393e 100755 --- a/assets/scenes/OutterGlowEffectScene.fire +++ b/assets/scenes/GlowOutterEffectScene.fire @@ -84,10 +84,10 @@ "_active": true, "_components": [ { - "__id__": 32 + "__id__": 34 }, { - "__id__": 33 + "__id__": 35 } ], "_prefab": null, @@ -177,7 +177,7 @@ "array": [ 0, 0, - 393.1755333181352, + 554.2562584220408, 0, 0, 0, @@ -975,15 +975,18 @@ }, { "__id__": 28 + }, + { + "__id__": 30 } ], "_active": true, "_components": [ { - "__id__": 30 + "__id__": 32 }, { - "__id__": 31 + "__id__": 33 } ], "_prefab": null, @@ -997,7 +1000,7 @@ }, "_contentSize": { "__type__": "cc.Size", - "width": 401, + "width": 509, "height": 0 }, "_anchorPoint": { @@ -1071,7 +1074,7 @@ "__type__": "TypedArray", "ctor": "Float64Array", "array": [ - -103, + -157, 0, 0, 0, @@ -1257,7 +1260,7 @@ "__type__": "TypedArray", "ctor": "Float64Array", "array": [ - 67.5, + 13.5, 0, 0, 0, @@ -1351,7 +1354,7 @@ "__type__": "TypedArray", "ctor": "Float64Array", "array": [ - 170.5, + 116.5, 0, 0, 0, @@ -1408,6 +1411,100 @@ "_atlas": null, "_id": "24JG5wcHpMbKwEVWPmOT/7" }, + { + "__type__": "cc.Node", + "_name": "prestige_04_big", + "_objFlags": 0, + "_parent": { + "__id__": 21 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 31 + } + ], + "_prefab": null, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 60, + "height": 60 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + 224.5, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1 + ] + }, + "_eulerAngles": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_skewX": 0, + "_skewY": 0, + "_is3DNode": false, + "_groupIndex": 0, + "groupIndex": 0, + "_id": "b1QYdYwQ1GIbxm/N2yRRUD" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 30 + }, + "_enabled": true, + "_materials": [ + { + "__uuid__": "b878db1a-68e4-460d-95f8-83fdb34c11e6" + } + ], + "_srcBlendFactor": 770, + "_dstBlendFactor": 771, + "_spriteFrame": { + "__uuid__": "969fa66a-ae10-4157-b16e-4c1a4665920c" + }, + "_type": 0, + "_sizeMode": 1, + "_fillType": 0, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": true, + "_atlas": null, + "_id": "75+LzaMdNGFbA4yyUIIz9s" + }, { "__type__": "cc.Layout", "_name": "", @@ -1418,7 +1515,7 @@ "_enabled": true, "_layoutSize": { "__type__": "cc.Size", - "width": 401, + "width": 509, "height": 0 }, "_resize": 1, @@ -1452,7 +1549,7 @@ "alignMode": 1, "_target": null, "_alignFlags": 8, - "_left": 0.2460052083333333, + "_left": 0.18975520833333331, "_right": 0, "_top": 0, "_bottom": 0, diff --git a/assets/scenes/OutterGlowEffectScene.fire.meta b/assets/scenes/GlowOutterEffectScene.fire.meta similarity index 100% rename from assets/scenes/OutterGlowEffectScene.fire.meta rename to assets/scenes/GlowOutterEffectScene.fire.meta diff --git a/assets/scripts/GlowInnerEffectScene.ts b/assets/scripts/GlowInnerEffectScene.ts new file mode 100644 index 0000000..007410b --- /dev/null +++ b/assets/scripts/GlowInnerEffectScene.ts @@ -0,0 +1,34 @@ +const { ccclass, property } = cc._decorator; + +@ccclass +export default class GlowInnerEffectScene extends cc.Component { + @property(cc.Node) + examplesParentNode: cc.Node = null; + + start() { + this._updateRenderComponentOutterGlowMaterial(0); + } + + onSideCallBack(slider: cc.Slider, customEventData: string) { + this._updateRenderComponentOutterGlowMaterial(slider.progress / 100); + } + + /** + * 更新渲染组件的材质 + * + * 1. 获取材质 + * 2. 给材质的自定义 unitform 变量赋值 + * 3. 重新将材质赋值回去 + * + * @param size 描边长度比例[0,1] 比如0.5,那么就是宽*0.5 高*0.5 + */ + private _updateRenderComponentOutterGlowMaterial(size: number) { + this.examplesParentNode.children.forEach(childNode => { + childNode.getComponents(cc.RenderComponent).forEach(renderComponent => { + let material: cc.Material = renderComponent.getMaterial(0); + material.setProperty("outlineSize", size); + renderComponent.setMaterial(0, material); + }); + }); + } +} diff --git a/assets/scripts/GlowInnerEffectScene.ts.meta b/assets/scripts/GlowInnerEffectScene.ts.meta new file mode 100644 index 0000000..6446d93 --- /dev/null +++ b/assets/scripts/GlowInnerEffectScene.ts.meta @@ -0,0 +1,9 @@ +{ + "ver": "1.0.5", + "uuid": "eebe516b-e5b8-4c3b-b22c-a30a0b5bf629", + "isPlugin": false, + "loadPluginInWeb": true, + "loadPluginInNative": true, + "loadPluginInEditor": false, + "subMetas": {} +} \ No newline at end of file diff --git a/assets/scripts/OutterGlowEffectScene.ts b/assets/scripts/GlowOutterEffectScene.ts similarity index 94% rename from assets/scripts/OutterGlowEffectScene.ts rename to assets/scripts/GlowOutterEffectScene.ts index 610f9a0..5cf26a7 100644 --- a/assets/scripts/OutterGlowEffectScene.ts +++ b/assets/scripts/GlowOutterEffectScene.ts @@ -1,7 +1,7 @@ const { ccclass, property } = cc._decorator; @ccclass -export default class OutterGlowEffectScene extends cc.Component { +export default class GlowOutterEffectScene extends cc.Component { @property(cc.Node) examplesParentNode: cc.Node = null; diff --git a/assets/scripts/OutterGlowEffectScene.ts.meta b/assets/scripts/GlowOutterEffectScene.ts.meta similarity index 100% rename from assets/scripts/OutterGlowEffectScene.ts.meta rename to assets/scripts/GlowOutterEffectScene.ts.meta diff --git a/assets/textures/prestige_04_big.png b/assets/textures/prestige_04_big.png new file mode 100644 index 0000000000000000000000000000000000000000..c9898fde5490bc92853905e0fc6382eb90bd79fc GIT binary patch literal 9806 zcmaKSWl&t*((d3+Ah;9U8Qf)X8z8s`nE?hHoWWg#yCe`GcnB^*g1bv_CqV)sXpkT` zIp2BDcYoY-ch%l&^{RfJ?q1zhYwfCz)z(zT!=}Ur004NZDhfJ(M(w{ZCi4J?X8Xb}$zyhM(LF6oa7<7zlQihuXtb{M@0sewunV zevUR`5C$1(dP#)%9|C8nrxiWI*~!I293jQ*M3Y<0HTWcemr^6B85T1@iOq^K<{v;P&u!@w7s4yLd4E z!=M25uyKdEdcxo?^nV$xtl?gsQVf4Q{htt=UH?Pt;_>fo`mDjh_QD zpUQ{2{3&<$KXt8>sb~lQF!ZP@fb-bbfDmW@5M*tdP z2$Ax_>tdZH`@NCt1SpPgMEiEmdI?y6A##XV^S}0wgd+J*E+w9!ldpadw&lZo5g{C* zP*vjMRb|>~xOi9jo%`b9x-+w%I*tBapya;ip_#tdm#XWNhm-54r|YNd&$DKW1HHQw zGM8wWqyRI3D^fQafQ%LgzyoLnY$1o>B+Uh*ZXATJ^oaOIil2s;bYrB}_@l}Um^5cR zdWfttG{67BVBlfZKr+TtdG9Y?v3u|#K}r$h_o8xb^bp>?zj>>hg0H zcdIMcn~X!WpxO~X>9q+^2ftP)RuL$zQC1>VntX}7>6 zp8?6$*G^h>>to)h*O{SD=&sbHVL^Ek1$_(J6H1+5--tfGbqXH+mFa4*k$q_FOWthHlGFU7pst9Wy|pwkeVuIUp1Mkp9Ee>Dkj0^1Bc+ z=EbF8$b17@nzqBeU8I3GJSa8XV$MGgf^SzQ082OL;8T@jpb)6 zx*G$)yuLCu#9+|v5X^4o=8L;ugKxFm$$anB7GIq4q$}0aNcgMt}tU%_?{7FIl z_(Y>aGeC_s*oAfxdlFC^ctfHGkA|hHj96O|hLn6)Q}nw8d;vDCGn@>D-lpfss9I?T zyZxr5Ifl{d04j*3u3!vv9k~S!FGJs{qdn!2+UdjHxg@Jw?{HvX_FLL2cTeBkmlzm};v7P0lsEQAPMIm*=vRK%^3LLh+nxd;*O8 zy>5WeQS=?q<=%yJ!Kuo6Xa$q!&YtoJZwf2w7S0&kog+z8c=0RSHFMXw*w{0$okXOW zs#W|ay+NYimQ-*&(hg8h0n@;CxP#&V*`f)#)1_Ak_8E1W86i$JESa_0AQ%QYFq(fe zILxK`viOG>q%gas)#5B1=?)Zj5Fs}$Cuk!qqL%dhbzdBG#&RyV*S@4DUs?F04Z;Yd zzN9cNBc1q`gzT(QTN%TZZ2LFi%-Swa*k&x2qgvY%+sBw@a_}UUisq_iZDXG3UV~BHM-=-A4FngNK8YNXdCo?8$3Gidv_&JQ%1LcCP zZ+)D2!W&zO?^!~SmJk*tc6Tl|C1oHTCOvted2DxXHrhm*O%8j8n>U;+|4=4MrztL7 z359j5O}=|X?xsh9OqZpYM%Z_OBH4^zLIJG5NKKpseOb7=)&tOep^(>S5C66}(u;mo z>ff07!s6qZEkt7r>@l?`gO>nr+=fpkSjuP81jLG;Nau1#nQ`SaAI0qgv3(CpD8dZG zc#es-h9#?Cu#B--4hxvavb6P<@cM8^kW(jWX1L-r{>0$5NN6uu3I`^=hGm}Txl0n8 z%6|`V0lp7OyO8k2;9*W_Wz8DWnBm*h$XTKPeEqzYRO#@e_{!pW)e}c*Rs4RrEoVnS z;A0%tB>Tjdrv!`sE6)}!SO+j;{29ipP2Fxt!sTZz1Ir|G8rD4i% z_iWFaPzm|9SVbv&=CR(P5^rz0-E}GB)Ao@ZWp3wQOe!SoIS^_myaf(hn3Hprt1ywx zRnNXU_iF>bMN;S7KlHzFJ&?|qvgl>WG4(zID!+|E7*9qh-WKT&imLU_?f&ZNZ0Pc$TG0QbX`Na`6?EUjJo1kBq@yL-(D zij%@aSalSO7$=%~x-Rf=rV{tgCKEVotAdGdd-&ztL$KK(+*d_abNFINJg>$eG3wKY zy4CMO#RI=({vvi)LfJ%=#8XHmx*@lQNuR;IzwNN`SmerG$cAd*R*XY}$g^d3)4f?v zpK;&N*=Vf)B3QDsZ(FUn@I&U|(Gb7sk0Te}V`~weg>ZyPe{V&oW53Q`%u!=&uk_vW z1tW*soQp#VoodU9!FT;{GaF^NQiK7H!4oVjX z%Pv|A1tN^^W*)bZS<024)lEgidSA;8OLt(l%tR=HCg@P+Y9jBI)D+^Yja`OkB0;&GV7xEw#BDpw)Y*sNGeMOiOlVU zlV}Ux+9R%y^H zJxZcOYErMp?a@hGmN6kcM#A?LUP599OW#*U*&R_Q^zAMwxR+A9g~~#)mzSu%ob7ar z78R1q^^hm7A`w$^tIU1lvRRnzgRf@~+QIV%A9Ux+3`GJ20FOxRh>fw-%~_p6d;A$W zq@EqYdZ(hRW0Rb{UN@#)ghN|cN^XLr5H$lX-c`MI5*0S*v{`Ot_DAFt%Q#?j8Z14} zL-r$yX;!n97}58U%EV^ZY;TqnLwvdQ%Bus&ikFnF$r5GCXK_|@#D9Lc=4XAj1oixUhanOk<*7Hh(Dz7GJg>^ zhLz5Vt|<((7vadPB#BYgL! zoO9U3=iJuLI$v$y_Sqb$v53|s4$af|u;!tp5VIte)JEF|SZJ#WB9deVKi?vsqQtwk zy?MZd85MXDl0GmKCQW2uvbl$$RJ_!T2{6u&-@*xhs9c%dddG>%t~G&pK(k}eTv+QY zrgI!Fiu%^eQdL?HZY=YbtgS=4JVS()-3wmu6q<%nM3Y#FzBu&?@{yhGY!;MmhM@`j z2JwC?F+ve{|QgV`q;FFBdSNbv%HRA!cY zILLI51^Ipk1T02$odS7yD_M|t=Ef_t<` z@fxl5RU`#6!R$eNl4FvUy}O4a4w;ol;3h%F#q~JuM+Q9*Tk+gJAF>Gf3>EPlT0>$H zba#bh!l?7TYA8auX`}0eW-yCxGxGH8rC^S}{GJQaUsl-c{;jM(s@{#h^>b~$<=c!F>u%dDkSjk|qk6wd4(n#1E#O~IHCa4{0ts9r8f;0s4&pAqlOKM_1TXE-jZqj#-?YMi( z5aeq~Y}%IVx<2Ugp23QmXQ8&!e!F)8ReFI?F)HW`g#@LTP`pqB_jNs?8KDgGVM?-A zy90CU+%g;K%eJ){m+7IErF(L76vluk_k&m7cnpf2WMy>tv;4R@8e_jWW8xQrp87Ln z9goO}c7EQ27q({fD8mh?e)h z$5qJbfmtP}6zYZ4dMsQv8h)T#JGe+l6?7uAQt{l&yO&cDYq!JBbfWcZ5t6rPZ-?jU zDP~mO&dv5Dl3up0(&28~4i@o2()ne|v-dWlEn;CZ@WoSZ9q(v}6}3$$_cuqrLB>YH zX%_jMEWZGAY|_-(mm(Ikw8~b^F`dN%2N?rwW72i=rKPeL9FlE}T#b4?y%{UJYwv## ztf{fbs0LM(vjYsLqMse7LOChkw330DkMV@6W>vsBbb&O`)SX#uIGDg)WEIHgjK{q81r;?~iqUCH1g z5u*NLURuT8tL}vgUUO9}MQz9CqIxD#i_)Ej=_`k%Ev70Cg1mUuL4#kTSmqaXBDN_X zn$vyPDb4dgid%ASmT}N0zA`=oD*^DQpFx)nG3}PhiCl;DtDJZkD?UJv?V@TkS?=fq zr<39~#DVuDx0U|xQE402n2^v%QKYVX;zMkTn}%;<8W|1y@!Fs0Q??KW?_@764?2%JT7@^$`FyL-uYm2!~7^GBN}*3}76q zwak4nIyWr#pDS?j%LMF?CJWh#dMKYCX5unROx?zC)qC*t-kVHsaxqL{)fbsYeB2J4 zYz?i_rCbo$e0r}LYbI)38+=o|hIz15`-1O|1>9VAa)hg}8t>~Sqp^ni z|6Cag`hFYRcTa7aHxVf0$b#+ow3h^@fOGun3tZM%f<-Umhf>S?*|be^PrqeQyrCjW zLuo#}Eh@*b*0>P=me1e!SPSZ?4W&CN`t(2udK!&Mlvdl+RPsqnBgP{9mRp+_q!~cR zI-TNI_~D>}84zr6ue#WQS!|)+m{oTx^l%dZD4*mGoc_Yp#@bA*s>zW-q8^75ARsqG z9nW`USr*L>^CN4q47;sNZ(b;v34NNLi$BVqeoaZ-@McwIj!4q@ej#{_r{q(2eWL9X zvhxqvnFkmP7p$COqYbmgi5>LNb5Zg5YMk>;#Z4bMFZUF zpJPosi>8cS7$Co7n3+NGxIVuY0TB)rnt-h>Ek|iHMUbPYKEv==QgXLM;ni++p+BmZ zX48F>Z@Z3zYOUt>&}1{GiKOd!Cx&{)s$n5xpl(@Rhq?NLGD=PHZj3(CETlD-4%70X z9{;^OlH}PvXUzH6HjW(FWB=5bE-x=lH!|t|Z?}NjqGrq65((ox0vXmxlLc2!K@uxN z-au0h5>|VV#*DG50fW=Sp|p}(sm-eDrvQe?3f$$Tl>X}U2(kQ&`t1GRObA@l{HZ*u zWN&Po{gCvjW_RRA!>rJ1yJqXn?_4JV!cjCB=-SjYcJm^x>w6aIqbzsmL&=)VmImLY zLxRo>G}d^(swFVIF95t3r329Jzpqh6*DIm%vU+=>C=pGA9VMqS=VUH^US=U3XEW~n zj09}ff9c$6Y5h)5IX(zTQ0$^U6RYoh{DSBSnQu+A<>q56#^g*C#!dx`+0Lc_#NMv^ zx6>Pdx{wp!jQQlXbZ0PSO`^tbJ=evz0WnEaw&Ig{w@n-jeddRZ@IKe?=>|wOCv4-o zUh=_Mpg1CpxfDUbD^mP6JkoQF788ZQ0E4@1VR_~h$rnF z49E-Qe4E28zRRXlar|&BOyY0{77Jj#S)}cAHs*y2l-$Y9Jz^r^z1_)2|Nc2WMGpPd ztI>!K*}9uaKQs*GQddaG?aWuEU+B)LIji|&9sc$ZWL{cwg$~?o>0E>hta|mtJS~1W8?f zsA8k>Ax`_iu<5>1{xO|wDHq|hnRM11Md|y#_@VlUM-z{PLkkuLk52q@Xd769sh0QN_oyeze!-gg$kpiCRd-AgTcT)H+6O#(Bv`g=nVHGuo4`K1`cwPEA*ShOVT(;>mzuS|5@d62KkDRcS?VBzIf~PSy#g?86Vzo+a9*O7glQ|=G zjg7LtjkAnqy^?Ati&P__iOt5Q)z;xW;DyXU9`t6RPt~rt8i~^bd`b24a1&`FXGLOimvvRq4pD( zIBm4;&=%dddu>cv1Gx=`TQi%-iW=R|_f!>4grUzxn`ja%TH7L{mDc_4S0(C~5T;l8RRbfl#aZ2}m3{(aYfS={ zyHOV7)aZdqw#`X{T0xzG}Pz$~7kS#F~E{eS!5(p$r32 z=P2^LSjsboaZVL=g4mP&=UANCuqo9`(*;z~u`w|yu=(VWH?~w~;C8&Ugq%AE;ciH` zQffEjH1bHH4igIJv4VbxM}aJ5S>W$Z;)tJp-UEcroHkW3432DknE%DaE9#q}3;vWe zGlGl{PEVeMkgwyxX^a7{S+`kcYtz`50zNW7KQQW@2Og|%Gur&#a=Xk}x+>uH%|p7k zno-yB@4eagU~DxY#W$FSX(XmbLXpY2K{c5fTJG{fHT}G3;{Z^jSBBc_2us{S!HGuh zJSAcKt+dTx%7N`&`|Y}37I`&@q*67RVc)@vc6@5=tr}0N%|Kr9C1MLbOT23(cmo{+8lgvbRqCdBoR=wO)OxB~ti?=S>Xz!}Cg`|8u?&Y}0!vIdx z=1&NTc4*&JujE3}vNYcy7ZY|p|8rb-nKRxoAGDCJV}DyODGm9KHxm9*BimUH(Z+e#I8 z#c!4%L~WTmTJH5NZ5A66J3EUl`>v`=Lv&q7J=hPt~EBpBH+!J!=osHWP<27icQp2z(aRtXU_ zFXdvzp(TCHtPNdxE!0T`o5E;uU9Gdc5cG)wN3~Lgo|!~-O5tcAbsE;3AX@BPlrzg5 z&4sct0NHH!om5}?Y`f$C%<#-;p}XL?YJ01Xg+;XH?6wkPl+pSVW&s_jjIHVi3l}@! z`29r*h5a>AR%bswlf-rvA$8tP-T*_rBF-mV3hnuaZ;H#K!ahkV^3`*r*f}N+#CwM) zv1;+elFlr@z2dfvbFF#uihj-mM;hydb!Gcv=%3@3gR>HYhf+iKbuO0AxUMXSD06Hf z!yVjJY?i9w>WGa#Jg48|OrI4z4nL$uzC|~wiKoAfsdl+@-$#)(c1??vHRi3n5&~Xq z5aOO&yT6|A&%k;U?19alCb(}mcgc;)rw?XS`_&%-s;`LlNG-xXe%c3*f3CqA`^jM)msO2$e0PCF&uwc;5?vEl zbV-}KO-3><$rl-9;d#x79^|b~8hramU{K8>MQ7J`P8IbgC20A(eD^T%TZ&M1J{&KR zmuSsxy1L{>hCwba6TcLQF7P6Oa%pRgA2D79>>FnnX0Ew)gm4YGH)(pO)m!CBklL@m3FqvC-110<_L^Ui8!qXcfQXmx=UQMoXe_RbCUaGtxaAdc5K(ukZDg}CJiAej{P(HzC zqaGS#$xgVfHVgSJ&ia&h@isj?DMhHh2lWUK&G~SFt;aU^T_^mBmbeOnTVhyc0&q8z z(VByu`l=0w+$Q*fZ0O4DP5V~krKS7x!EN7Nz~Nki-=Vp6ElFC=I`y4Y_)_S8oQ=W{ zc{yrZY!vqsoPN`}n7a>Ce48BE2M*e#t;Fl`t=^&_01>9}kv;3~f`C?6{Nm@WuhIz; zHFN_*T{4<)iHF*rG6zWK2JY00j4n=I-lu)IO=gG|g*DW3?Em`AN1%1>0?wf`7Phw$ zSt0DXn<}gGk|!`H8=CQ&6QynaN&Z>h!tkSWUsJ)zRxu&Ur@Car!hpkhs*e}$eO?*# z2J9()LDI`@L#!sj1WKXbwRp69R; zR*lw5tAc_w)d^a-adu>lhsdG?o4V|=8tM}>7dyW_NjUk8i;B*APG?!SxtpHrqABEq zi!w?BEG9PB4GgIa_YS=c7q6c&Uwx<&&D=9~PmJCFIm+m3if^ba1WB5I7mRqmxo$C- z1fSggP}8!-%Y)97-ZLWAUc;Xu-a7nyCYJB2mwJF5cjXcr79>OM+?p?Utu3lw1wo>OYZ;D1n-(_Jpa?X;GO=%x-lW!#axQJ?-S!V^ zzwj#AuGe&LMM;K}3s}oCV8ffa-yKHaB#)fyvUFZ{RV(`R>v_Mo-!`BT&1F47-`sE0 z{7x@j%ZTyx7Gaa=B}(?c`U1Z?4!Q1=*c>{#Kb`z35#m8lDb1+0p0NFdJw9HNNZJYVWHxV2ALg1nf;)%L)~ Date: Fri, 20 Dec 2019 12:32:27 +0800 Subject: [PATCH 05/24] =?UTF-8?q?=E5=88=9D=E6=AD=A5=E5=86=85=E5=8F=91?= =?UTF-8?q?=E5=85=89=E5=AE=9E=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/effects/glow-inner.effect | 119 +++++++++------ assets/effects/glow-inner.effect.meta | 4 +- assets/materials/glow-inner.mtl | 12 +- assets/scenes/GlowInnerEffectScene.fire | 195 +++--------------------- assets/scripts/GlowInnerEffectScene.ts | 2 +- 5 files changed, 97 insertions(+), 235 deletions(-) diff --git a/assets/effects/glow-inner.effect b/assets/effects/glow-inner.effect index aaa0e69..f3eccd8 100644 --- a/assets/effects/glow-inner.effect +++ b/assets/effects/glow-inner.effect @@ -1,5 +1,6 @@ // Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. -// 外发光特效 +// 内发光特效 +// 原理: 采样周边像素alpha取平均值,叠加发光效果 CCEffect %{ techniques: - passes: @@ -13,8 +14,8 @@ CCEffect %{ properties: texture: { value: white } alphaThreshold: { value: 0.5 } - outlineColor: { value: [1.0, 1.0, 0.0, 1.0], editor: { type: color } } - outlineSize: { value: 0.01 } + glowColor: { value: [1.0, 1.0, 0.0, 1.0], editor: { type: color } } + glowColorSize: { value: 0.01 } }% @@ -65,49 +66,72 @@ CCProgram fs %{ uniform sampler2D texture; #endif - #if SHOW_OUT_LINE + #if SHOW_INNER_GLOW - uniform Outline { - // 描边颜色 - vec4 outlineColor; - // 描边偏移大小 - float outlineSize; + uniform glow { + // 发光颜色 + vec4 glowColor; + // 发光范围 + float glowColorSize; // 特别地,必须是 vec4 先于 float 声明 }; - float getAlpha(float size) { - vec4 color_up = texture(texture, v_uv0 + vec2(0, size)); - vec4 color_down = texture(texture, v_uv0 - vec2(0, size)); - vec4 color_left = texture(texture, v_uv0 - vec2(size, 0)); - vec4 color_right = texture(texture, v_uv0 + vec2(size, 0)); - vec4 color_up_left = texture(texture, v_uv0 + vec2(size, -size)); - vec4 color_up_right = texture(texture, v_uv0 + vec2(size, size)); - vec4 color_down_left = texture(texture, v_uv0 + vec2(-size, -size)); - vec4 color_down_right = texture(texture, v_uv0 + vec2(-size, size)); - float total = color_right.a + color_left.a + color_down.a + color_up.a + color_up_left.a + color_up_right.a + color_down_left.a + color_down_right.a; - return step(0.000000001, total); + /** + * 获取指定角度方向,距离为xxx的像素的透明度 + * + * @param angle 角度 [0.0, 360.0] + * @param distance 距离 [0.0, 1.0] + * + * @return alpha [0.0, 1.0] + */ + float getColorAlpha(float angle, float distance) { + // 角度转弧度,公式为:弧度 = 角度 * (pi / 180) + float radian = angle * 0.01745329252; // 这个浮点数是 pi / 180 + vec4 color = texture(texture, v_uv0 + vec2(distance * cos(radian), distance * sin(radian))); + return 1.0 - color.a; } - // 将图像往8个方向偏移后,得到一个类放大效果,然后取放大后的图像的透明度,即可得到一个放大后的区域,可以很方便填充(描边)颜色 - // 取当前点上、下、左、右、上左、上右、下左、下右共计8个方向,距离为 outlineSize 的8个点,求他们的透明度之和 - // 由此可以得到当前点是否属于图像往八个方向做偏移后得到的放大图区域,并且能得到该点最终透明度值 - // 最终对应的为图像偏移/放大后的背景区域 - float getBgAlpha() { - vec4 color_cur = texture(texture, v_uv0); - float alpha = step(0.000000001, color_cur.a); - if (alpha > 0.000000001) { - return 1.0; - } else { - float total = 0.0; - for (float i = 0.0; i <= 1.0; i += 0.01) { - total += getAlpha(outlineSize * i); - } - total *= 0.01; - return clamp(total, 0.0, 1.0); - } + /** + * 获取指定距离的周边像素的透明度平均值 + * + * @param distance 距离 [0.0, 1.0] + * + * @return average alpha [0.0, 1.0] + */ + float getDistanceAverageAlpha(float distance) { + float totalAlpha = 0.0; + totalAlpha += getColorAlpha(0.0, distance); + totalAlpha += getColorAlpha(30.0, distance); + totalAlpha += getColorAlpha(60.0, distance); + totalAlpha += getColorAlpha(90.0, distance); + totalAlpha += getColorAlpha(120.0, distance); + totalAlpha += getColorAlpha(150.0, distance); + totalAlpha += getColorAlpha(180.0, distance); + totalAlpha += getColorAlpha(210.0, distance); + totalAlpha += getColorAlpha(240.0, distance); + totalAlpha += getColorAlpha(270.0, distance); + totalAlpha += getColorAlpha(300.0, distance); + totalAlpha += getColorAlpha(330.0, distance); + return totalAlpha * (1.0 / 12.0); } - + /** + * 获取发光的透明度 + */ + float getGlowAlpha() { + float totalAlpha = 0.0; + totalAlpha += getDistanceAverageAlpha(glowColorSize * 0.1); + totalAlpha += getDistanceAverageAlpha(glowColorSize * 0.2); + totalAlpha += getDistanceAverageAlpha(glowColorSize * 0.3); + totalAlpha += getDistanceAverageAlpha(glowColorSize * 0.4); + totalAlpha += getDistanceAverageAlpha(glowColorSize * 0.5); + totalAlpha += getDistanceAverageAlpha(glowColorSize * 0.6); + totalAlpha += getDistanceAverageAlpha(glowColorSize * 0.7); + totalAlpha += getDistanceAverageAlpha(glowColorSize * 0.8); + totalAlpha += getDistanceAverageAlpha(glowColorSize * 0.9); + totalAlpha += getDistanceAverageAlpha(glowColorSize * 1.0); + return totalAlpha * (1.0 / 10.0); + } #endif @@ -127,24 +151,27 @@ CCProgram fs %{ gl_FragColor = o; - #if SHOW_OUT_LINE - // 先画背景色 - vec4 color_dest = outlineColor * getBgAlpha(); + #if SHOW_INNER_GLOW + // 先画图案 + vec4 color_dest = o; - // 然后在背景色上方画图案颜色 - vec4 color_src = o; + // 然后在图案上叠加内发光 + vec4 color_src = glowColor * getGlowAlpha(); - // 按照这个顺序,源颜色就是图案颜色,目标颜色就是背景色 + // 按照这个顺序,源颜色就是内发光颜色,目标颜色就是图案颜色色 // 所以命名就是 color_src, color_dest // 按照混合颜色规则 http://docs.cocos.com/creator/manual/zh/advanced-topics/ui-auto-batch.html#blend-%E6%A8%A1%E5%BC%8F - // 要在底色上方,画一个图案,图案完全挡住底色,那么最终选择的混合模式如下: + // 要在图案上方,叠加一个内发光,将两者颜色混合起来,那么最终选择的混合模式如下: // color_src: GL_SRC_ALPHA // color_dest: GL_ONE_MINUS_SRC_ALPHA // 即最终颜色如下: // color_src * GL_SRC_ALPHA + color_dest * GL_ONE_MINUS_SRC_ALPHA gl_FragColor = color_src * color_src.a + color_dest * (1.0 - color_src.a); - // gl_FragColor = color_dest; + // gl_FragColor = color_src + color_dest * (1.0 - color_src.a); + // gl_FragColor = color_src * (1.0 - color_src.a) + color_dest * color_src.a; + // gl_FragColor = color_src; + // gl_FragColor = color_dest * color_dest.a + color_src * (1.0 - color_dest.a); #endif } }% diff --git a/assets/effects/glow-inner.effect.meta b/assets/effects/glow-inner.effect.meta index cef30ab..8d480f4 100644 --- a/assets/effects/glow-inner.effect.meta +++ b/assets/effects/glow-inner.effect.meta @@ -5,11 +5,11 @@ { "glsl1": { "vert": "\nprecision highp float;\nuniform mat4 cc_matViewProj;\nuniform mat4 cc_matWorld;\n\nattribute vec3 a_position;\nattribute vec4 a_color;\nvarying vec4 v_color;\n\n#if USE_TEXTURE\nattribute vec2 a_uv0;\nvarying vec2 v_uv0;\n#endif\n\nvoid main () {\n vec4 pos = vec4(a_position, 1);\n\n #if CC_USE_MODEL\n pos = cc_matViewProj * cc_matWorld * pos;\n #else\n pos = cc_matViewProj * pos;\n #endif\n\n #if USE_TEXTURE\n v_uv0 = a_uv0;\n #endif\n\n v_color = a_color;\n\n gl_Position = pos;\n}\n", - "frag": "\nprecision highp float;\n\n#if USE_ALPHA_TEST\n \n uniform float alphaThreshold;\n#endif\n\nvoid ALPHA_TEST (in vec4 color) {\n #if USE_ALPHA_TEST\n if (color.a < alphaThreshold) discard;\n #endif\n}\n\nvoid ALPHA_TEST (in float alpha) {\n #if USE_ALPHA_TEST\n if (alpha < alphaThreshold) discard;\n #endif\n}\n\nvarying vec4 v_color;\n\n#if USE_TEXTURE\nvarying vec2 v_uv0;\nuniform sampler2D texture;\n#endif\n\n#if SHOW_OUT_LINE\n\nuniform vec4 outlineColor;\nuniform float outlineSize;\n\nfloat getAlpha(float size) {\n vec4 color_up = texture2D(texture, v_uv0 + vec2(0, size)); \n vec4 color_down = texture2D(texture, v_uv0 - vec2(0, size)); \n vec4 color_left = texture2D(texture, v_uv0 - vec2(size, 0)); \n vec4 color_right = texture2D(texture, v_uv0 + vec2(size, 0)); \n vec4 color_up_left = texture2D(texture, v_uv0 + vec2(size, -size)); \n vec4 color_up_right = texture2D(texture, v_uv0 + vec2(size, size)); \n vec4 color_down_left = texture2D(texture, v_uv0 + vec2(-size, -size)); \n vec4 color_down_right = texture2D(texture, v_uv0 + vec2(-size, size)); \n float total = color_right.a + color_left.a + color_down.a + color_up.a + color_up_left.a + color_up_right.a + color_down_left.a + color_down_right.a; \n return step(0.000000001, total);\n}\n\nfloat getBgAlpha() {\n vec4 color_cur = texture2D(texture, v_uv0);\n float alpha = step(0.000000001, color_cur.a);\n if (alpha > 0.000000001) {\n return 1.0;\n } else {\n float total = 0.0;\n for (float i = 0.0; i <= 1.0; i += 0.01) {\n total += getAlpha(outlineSize * i);\n }\n total *= 0.01;\n return clamp(total, 0.0, 1.0);\n }\n}\n\n#endif\n\nvoid main () {\n vec4 o = vec4(1, 1, 1, 1);\n\n #if USE_TEXTURE\n o *= texture2D(texture, v_uv0);\n #if CC_USE_ALPHA_ATLAS_TEXTURE\n o.a *= texture2D(texture, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #endif\n\n o *= v_color;\n\n ALPHA_TEST(o);\n\n gl_FragColor = o;\n\n #if SHOW_OUT_LINE\n\n vec4 color_dest = outlineColor * getBgAlpha();\n\n vec4 color_src = o;\n\n gl_FragColor = color_src * color_src.a + color_dest * (1.0 - color_src.a);\n\n #endif\n}\n" + "frag": "\nprecision highp float;\n\n#if USE_ALPHA_TEST\n \n uniform float alphaThreshold;\n#endif\n\nvoid ALPHA_TEST (in vec4 color) {\n #if USE_ALPHA_TEST\n if (color.a < alphaThreshold) discard;\n #endif\n}\n\nvoid ALPHA_TEST (in float alpha) {\n #if USE_ALPHA_TEST\n if (alpha < alphaThreshold) discard;\n #endif\n}\n\nvarying vec4 v_color;\n\n#if USE_TEXTURE\nvarying vec2 v_uv0;\nuniform sampler2D texture;\n#endif\n\n#if SHOW_INNER_GLOW\n\nuniform vec4 glowColor;\nuniform float glowColorSize;\n\n/**\n * 获取指定角度方向,距离为xxx的像素的透明度\n *\n * @param angle 角度 [0.0, 360.0]\n * @param distance 距离 [0.0, 1.0]\n *\n * @return alpha [0.0, 1.0]\n */\nfloat getColorAlpha(float angle, float distance) {\n\n float radian = angle * 0.01745329252;\n\n vec4 color = texture2D(texture, v_uv0 + vec2(distance * cos(radian), distance * sin(radian))); \n return 1.0 - color.a;\n}\n\n/**\n * 获取指定距离的周边像素的透明度平均值\n *\n * @param distance 距离 [0.0, 1.0]\n *\n * @return average alpha [0.0, 1.0]\n */\nfloat getDistanceAverageAlpha(float distance) {\n float totalAlpha = 0.0;\n totalAlpha += getColorAlpha(0.0, distance);\n totalAlpha += getColorAlpha(30.0, distance);\n totalAlpha += getColorAlpha(60.0, distance);\n totalAlpha += getColorAlpha(90.0, distance);\n totalAlpha += getColorAlpha(120.0, distance);\n totalAlpha += getColorAlpha(150.0, distance);\n totalAlpha += getColorAlpha(180.0, distance);\n totalAlpha += getColorAlpha(210.0, distance);\n totalAlpha += getColorAlpha(240.0, distance);\n totalAlpha += getColorAlpha(270.0, distance);\n totalAlpha += getColorAlpha(300.0, distance);\n totalAlpha += getColorAlpha(330.0, distance);\n return totalAlpha * (1.0 / 12.0);\n}\n\n/**\n * 获取发光的透明度\n */\nfloat getGlowAlpha() {\n float totalAlpha = 0.0;\n totalAlpha += getDistanceAverageAlpha(glowColorSize * 0.1);\n totalAlpha += getDistanceAverageAlpha(glowColorSize * 0.2);\n totalAlpha += getDistanceAverageAlpha(glowColorSize * 0.3);\n totalAlpha += getDistanceAverageAlpha(glowColorSize * 0.4);\n totalAlpha += getDistanceAverageAlpha(glowColorSize * 0.5);\n totalAlpha += getDistanceAverageAlpha(glowColorSize * 0.6);\n totalAlpha += getDistanceAverageAlpha(glowColorSize * 0.7);\n totalAlpha += getDistanceAverageAlpha(glowColorSize * 0.8);\n totalAlpha += getDistanceAverageAlpha(glowColorSize * 0.9);\n totalAlpha += getDistanceAverageAlpha(glowColorSize * 1.0);\n return 1.0 - totalAlpha * (1.0 / 10.0);\n\n}\n\n#endif\n\nvoid main () {\n vec4 o = vec4(1, 1, 1, 1);\n\n #if USE_TEXTURE\n o *= texture2D(texture, v_uv0);\n #if CC_USE_ALPHA_ATLAS_TEXTURE\n o.a *= texture2D(texture, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #endif\n\n o *= v_color;\n\n ALPHA_TEST(o);\n\n gl_FragColor = o;\n\n #if SHOW_INNER_GLOW\n\n vec4 color_dest = o;\n\n vec4 color_src = glowColor * getGlowAlpha();\n\n gl_FragColor = color_src * color_src.a + color_dest * (1.0 - color_src.a);\n\n #endif\n}\n" }, "glsl3": { "vert": "\nprecision highp float;\nuniform CCGlobal {\n vec4 cc_time;\n\n vec4 cc_screenSize;\n\n vec4 cc_screenScale;\n\n vec4 cc_nativeSize;\n\n mat4 cc_matView;\n mat4 cc_matViewInv;\n mat4 cc_matProj;\n mat4 cc_matProjInv;\n mat4 cc_matViewProj;\n mat4 cc_matViewProjInv;\n vec4 cc_cameraPos;\n\n vec4 cc_exposure;\n\n vec4 cc_mainLitDir;\n\n vec4 cc_mainLitColor;\n\n vec4 cc_ambientSky;\n vec4 cc_ambientGround;\n};\nuniform CCLocal {\n mat4 cc_matWorld;\n mat4 cc_matWorldIT;\n};\n\nin vec3 a_position;\nin vec4 a_color;\nout vec4 v_color;\n\n#if USE_TEXTURE\nin vec2 a_uv0;\nout vec2 v_uv0;\n#endif\n\nvoid main () {\n vec4 pos = vec4(a_position, 1);\n\n #if CC_USE_MODEL\n pos = cc_matViewProj * cc_matWorld * pos;\n #else\n pos = cc_matViewProj * pos;\n #endif\n\n #if USE_TEXTURE\n v_uv0 = a_uv0;\n #endif\n\n v_color = a_color;\n\n gl_Position = pos;\n}\n", - "frag": "\nprecision highp float;\n\n#if USE_ALPHA_TEST\n \n uniform ALPHA_TEST {\n float alphaThreshold;\n }\n#endif\n\nvoid ALPHA_TEST (in vec4 color) {\n #if USE_ALPHA_TEST\n if (color.a < alphaThreshold) discard;\n #endif\n}\n\nvoid ALPHA_TEST (in float alpha) {\n #if USE_ALPHA_TEST\n if (alpha < alphaThreshold) discard;\n #endif\n}\n\nin vec4 v_color;\n\n#if USE_TEXTURE\nin vec2 v_uv0;\nuniform sampler2D texture;\n#endif\n\n#if SHOW_OUT_LINE\n\nuniform Outline {\n\n vec4 outlineColor;\n\n float outlineSize;\n\n};\n\nfloat getAlpha(float size) {\n vec4 color_up = texture(texture, v_uv0 + vec2(0, size)); \n vec4 color_down = texture(texture, v_uv0 - vec2(0, size)); \n vec4 color_left = texture(texture, v_uv0 - vec2(size, 0)); \n vec4 color_right = texture(texture, v_uv0 + vec2(size, 0)); \n vec4 color_up_left = texture(texture, v_uv0 + vec2(size, -size)); \n vec4 color_up_right = texture(texture, v_uv0 + vec2(size, size)); \n vec4 color_down_left = texture(texture, v_uv0 + vec2(-size, -size)); \n vec4 color_down_right = texture(texture, v_uv0 + vec2(-size, size)); \n float total = color_right.a + color_left.a + color_down.a + color_up.a + color_up_left.a + color_up_right.a + color_down_left.a + color_down_right.a; \n return step(0.000000001, total);\n}\n\nfloat getBgAlpha() {\n vec4 color_cur = texture(texture, v_uv0);\n float alpha = step(0.000000001, color_cur.a);\n if (alpha > 0.000000001) {\n return 1.0;\n } else {\n float total = 0.0;\n for (float i = 0.0; i <= 1.0; i += 0.01) {\n total += getAlpha(outlineSize * i);\n }\n total *= 0.01;\n return clamp(total, 0.0, 1.0);\n }\n}\n\n#endif\n\nvoid main () {\n vec4 o = vec4(1, 1, 1, 1);\n\n #if USE_TEXTURE\n o *= texture(texture, v_uv0);\n #if CC_USE_ALPHA_ATLAS_TEXTURE\n o.a *= texture2D(texture, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #endif\n\n o *= v_color;\n\n ALPHA_TEST(o);\n\n gl_FragColor = o;\n\n #if SHOW_OUT_LINE\n\n vec4 color_dest = outlineColor * getBgAlpha();\n\n vec4 color_src = o;\n\n gl_FragColor = color_src * color_src.a + color_dest * (1.0 - color_src.a);\n\n #endif\n}\n" + "frag": "\nprecision highp float;\n\n#if USE_ALPHA_TEST\n \n uniform ALPHA_TEST {\n float alphaThreshold;\n }\n#endif\n\nvoid ALPHA_TEST (in vec4 color) {\n #if USE_ALPHA_TEST\n if (color.a < alphaThreshold) discard;\n #endif\n}\n\nvoid ALPHA_TEST (in float alpha) {\n #if USE_ALPHA_TEST\n if (alpha < alphaThreshold) discard;\n #endif\n}\n\nin vec4 v_color;\n\n#if USE_TEXTURE\nin vec2 v_uv0;\nuniform sampler2D texture;\n#endif\n\n#if SHOW_INNER_GLOW\n\nuniform glow {\n\n vec4 glowColor;\n\n float glowColorSize;\n\n};\n\n/**\n * 获取指定角度方向,距离为xxx的像素的透明度\n *\n * @param angle 角度 [0.0, 360.0]\n * @param distance 距离 [0.0, 1.0]\n *\n * @return alpha [0.0, 1.0]\n */\nfloat getColorAlpha(float angle, float distance) {\n\n float radian = angle * 0.01745329252;\n\n vec4 color = texture(texture, v_uv0 + vec2(distance * cos(radian), distance * sin(radian))); \n return 1.0 - color.a;\n}\n\n/**\n * 获取指定距离的周边像素的透明度平均值\n *\n * @param distance 距离 [0.0, 1.0]\n *\n * @return average alpha [0.0, 1.0]\n */\nfloat getDistanceAverageAlpha(float distance) {\n float totalAlpha = 0.0;\n totalAlpha += getColorAlpha(0.0, distance);\n totalAlpha += getColorAlpha(30.0, distance);\n totalAlpha += getColorAlpha(60.0, distance);\n totalAlpha += getColorAlpha(90.0, distance);\n totalAlpha += getColorAlpha(120.0, distance);\n totalAlpha += getColorAlpha(150.0, distance);\n totalAlpha += getColorAlpha(180.0, distance);\n totalAlpha += getColorAlpha(210.0, distance);\n totalAlpha += getColorAlpha(240.0, distance);\n totalAlpha += getColorAlpha(270.0, distance);\n totalAlpha += getColorAlpha(300.0, distance);\n totalAlpha += getColorAlpha(330.0, distance);\n return totalAlpha * (1.0 / 12.0);\n}\n\n/**\n * 获取发光的透明度\n */\nfloat getGlowAlpha() {\n float totalAlpha = 0.0;\n totalAlpha += getDistanceAverageAlpha(glowColorSize * 0.1);\n totalAlpha += getDistanceAverageAlpha(glowColorSize * 0.2);\n totalAlpha += getDistanceAverageAlpha(glowColorSize * 0.3);\n totalAlpha += getDistanceAverageAlpha(glowColorSize * 0.4);\n totalAlpha += getDistanceAverageAlpha(glowColorSize * 0.5);\n totalAlpha += getDistanceAverageAlpha(glowColorSize * 0.6);\n totalAlpha += getDistanceAverageAlpha(glowColorSize * 0.7);\n totalAlpha += getDistanceAverageAlpha(glowColorSize * 0.8);\n totalAlpha += getDistanceAverageAlpha(glowColorSize * 0.9);\n totalAlpha += getDistanceAverageAlpha(glowColorSize * 1.0);\n return 1.0 - totalAlpha * (1.0 / 10.0);\n\n}\n\n#endif\n\nvoid main () {\n vec4 o = vec4(1, 1, 1, 1);\n\n #if USE_TEXTURE\n o *= texture(texture, v_uv0);\n #if CC_USE_ALPHA_ATLAS_TEXTURE\n o.a *= texture2D(texture, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #endif\n\n o *= v_color;\n\n ALPHA_TEST(o);\n\n gl_FragColor = o;\n\n #if SHOW_INNER_GLOW\n\n vec4 color_dest = o;\n\n vec4 color_src = glowColor * getGlowAlpha();\n\n gl_FragColor = color_src * color_src.a + color_dest * (1.0 - color_src.a);\n\n #endif\n}\n" } } ], diff --git a/assets/materials/glow-inner.mtl b/assets/materials/glow-inner.mtl index 0dfb81c..e5e525d 100644 --- a/assets/materials/glow-inner.mtl +++ b/assets/materials/glow-inner.mtl @@ -9,17 +9,9 @@ "_defines": { "USE_TEXTURE": true, "USE_ALPHA_TEST": false, - "SHOW_OUT_LINE": true + "SHOW_INNER_GLOW": true }, "_props": { - "texture": null, - "outlineColor": { - "__type__": "cc.Vec4", - "x": 1, - "y": 1, - "z": 0, - "w": 1 - }, - "outlineSize": 0.1 + "texture": null } } \ No newline at end of file diff --git a/assets/scenes/GlowInnerEffectScene.fire b/assets/scenes/GlowInnerEffectScene.fire index 8e42e28..bacb883 100755 --- a/assets/scenes/GlowInnerEffectScene.fire +++ b/assets/scenes/GlowInnerEffectScene.fire @@ -15,9 +15,6 @@ "_children": [ { "__id__": 2 - }, - { - "__id__": 35 } ], "_active": true, @@ -87,7 +84,10 @@ "_active": true, "_components": [ { - "__id__": 34 + "__id__": 32 + }, + { + "__id__": 33 } ], "_prefab": null, @@ -892,7 +892,7 @@ "__id__": 2 }, "component": "", - "_componentId": "408f4mR69xEbpzjsYAGu3vL", + "_componentId": "eebe5Fr5bhMO7IsowoLW/Yp", "handler": "onSideCallBack", "customEventData": "" }, @@ -975,18 +975,15 @@ }, { "__id__": 28 - }, - { - "__id__": 30 } ], "_active": true, "_components": [ { - "__id__": 32 + "__id__": 30 }, { - "__id__": 33 + "__id__": 31 } ], "_prefab": null, @@ -1109,7 +1106,7 @@ "_enabled": true, "_materials": [ { - "__uuid__": "b878db1a-68e4-460d-95f8-83fdb34c11e6" + "__uuid__": "2c760728-404d-4553-a1d0-7ab18263845c" } ], "_srcBlendFactor": 770, @@ -1131,98 +1128,6 @@ "_atlas": null, "_id": "c5wu68mipC4qBjTD+u0rFa" }, - { - "__type__": "cc.Node", - "_name": "ExampleLabel", - "_objFlags": 0, - "_parent": { - "__id__": 21 - }, - "_children": [], - "_active": false, - "_components": [ - { - "__id__": 25 - } - ], - "_prefab": null, - "_opacity": 255, - "_color": { - "__type__": "cc.Color", - "r": 255, - "g": 255, - "b": 255, - "a": 255 - }, - "_contentSize": { - "__type__": "cc.Size", - "width": 342.33, - "height": 100.8 - }, - "_anchorPoint": { - "__type__": "cc.Vec2", - "x": 0.5, - "y": 0.5 - }, - "_trs": { - "__type__": "TypedArray", - "ctor": "Float64Array", - "array": [ - 18.50000000000003, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1 - ] - }, - "_eulerAngles": { - "__type__": "cc.Vec3", - "x": 0, - "y": 0, - "z": 0 - }, - "_skewX": 0, - "_skewY": 0, - "_is3DNode": false, - "_groupIndex": 0, - "groupIndex": 0, - "_id": "31f1bH7V69Ajr1iXhluMpTB" - }, - { - "__type__": "cc.Label", - "_name": "", - "_objFlags": 0, - "node": { - "__id__": 24 - }, - "_enabled": true, - "_materials": [ - { - "__uuid__": "b878db1a-68e4-460d-95f8-83fdb34c11e6" - } - ], - "_useOriginalSize": false, - "_string": "Hello, World!", - "_N$string": "Hello, World!", - "_fontSize": 60, - "_lineHeight": 80, - "_enableWrapText": true, - "_N$file": null, - "_isSystemFontUsed": true, - "_spacingX": 0, - "_batchAsBitmap": false, - "_N$horizontalAlign": 1, - "_N$verticalAlign": 1, - "_N$fontFamily": "Arial", - "_N$overflow": 0, - "_N$cacheMode": 0, - "_id": "9fH5zrVThO/I9ly3o3xhIT" - }, { "__type__": "cc.Node", "_name": "start_0", @@ -1234,7 +1139,7 @@ "_active": true, "_components": [ { - "__id__": 27 + "__id__": 25 } ], "_prefab": null, @@ -1290,12 +1195,12 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 26 + "__id__": 24 }, "_enabled": true, "_materials": [ { - "__uuid__": "b878db1a-68e4-460d-95f8-83fdb34c11e6" + "__uuid__": "2c760728-404d-4553-a1d0-7ab18263845c" } ], "_srcBlendFactor": 770, @@ -1328,7 +1233,7 @@ "_active": true, "_components": [ { - "__id__": 29 + "__id__": 27 } ], "_prefab": null, @@ -1384,12 +1289,12 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 28 + "__id__": 26 }, "_enabled": true, "_materials": [ { - "__uuid__": "b878db1a-68e4-460d-95f8-83fdb34c11e6" + "__uuid__": "2c760728-404d-4553-a1d0-7ab18263845c" } ], "_srcBlendFactor": 770, @@ -1422,7 +1327,7 @@ "_active": true, "_components": [ { - "__id__": 31 + "__id__": 29 } ], "_prefab": null, @@ -1478,12 +1383,12 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 30 + "__id__": 28 }, "_enabled": true, "_materials": [ { - "__uuid__": "b878db1a-68e4-460d-95f8-83fdb34c11e6" + "__uuid__": "2c760728-404d-4553-a1d0-7ab18263845c" } ], "_srcBlendFactor": 770, @@ -1582,79 +1487,17 @@ "_fitHeight": true, "_id": "4bz2+ak99DBYVlSVIMFGN0" }, - { - "__type__": "cc.Node", - "_name": "GlowInnerEffectScene", - "_objFlags": 0, - "_parent": { - "__id__": 1 - }, - "_children": [], - "_active": true, - "_components": [ - { - "__id__": 36 - } - ], - "_prefab": null, - "_opacity": 255, - "_color": { - "__type__": "cc.Color", - "r": 255, - "g": 255, - "b": 255, - "a": 255 - }, - "_contentSize": { - "__type__": "cc.Size", - "width": 0, - "height": 0 - }, - "_anchorPoint": { - "__type__": "cc.Vec2", - "x": 0.5, - "y": 0.5 - }, - "_trs": { - "__type__": "TypedArray", - "ctor": "Float64Array", - "array": [ - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1 - ] - }, - "_eulerAngles": { - "__type__": "cc.Vec3", - "x": 0, - "y": 0, - "z": 0 - }, - "_skewX": 0, - "_skewY": 0, - "_is3DNode": false, - "_groupIndex": 0, - "groupIndex": 0, - "_id": "72kx+DcCxEba4H6yf1snJe" - }, { "__type__": "eebe5Fr5bhMO7IsowoLW/Yp", "_name": "", "_objFlags": 0, "node": { - "__id__": 35 + "__id__": 2 }, "_enabled": true, "examplesParentNode": { "__id__": 21 }, - "_id": "2buo5DYrlF7akjHTPl2qgk" + "_id": "1a7ypfDW1DQqGMHUC5Sf0L" } ] \ No newline at end of file diff --git a/assets/scripts/GlowInnerEffectScene.ts b/assets/scripts/GlowInnerEffectScene.ts index 007410b..a67bff4 100644 --- a/assets/scripts/GlowInnerEffectScene.ts +++ b/assets/scripts/GlowInnerEffectScene.ts @@ -26,7 +26,7 @@ export default class GlowInnerEffectScene extends cc.Component { this.examplesParentNode.children.forEach(childNode => { childNode.getComponents(cc.RenderComponent).forEach(renderComponent => { let material: cc.Material = renderComponent.getMaterial(0); - material.setProperty("outlineSize", size); + material.setProperty("glowColorSize", size); renderComponent.setMaterial(0, material); }); }); From 5da364c86226f5c8575e9f527cf4fa3b3616d732 Mon Sep 17 00:00:00 2001 From: caizhitao Date: Fri, 20 Dec 2019 15:59:56 +0800 Subject: [PATCH 06/24] =?UTF-8?q?=E5=AE=8C=E5=96=84=E5=86=85=E5=8F=91?= =?UTF-8?q?=E5=85=89demo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/effects/glow-inner.effect | 39 +- assets/effects/glow-inner.effect.meta | 4 +- assets/materials/glow-inner.mtl | 10 +- assets/scenes/GlowInnerEffectScene.fire | 3488 ++++++++++++++--- assets/scripts/GlowInnerEffectScene.ts | 63 +- assets/textures/{ball_00.png => ball_0.png} | Bin .../{ball_00.png.meta => ball_0.png.meta} | 2 +- .../{prestige_04_big.png => ball_1.png} | Bin ...estige_04_big.png.meta => ball_1.png.meta} | 2 +- .../textures/{start_0.png => video_btn.png} | Bin .../{start_0.png.meta => video_btn.png.meta} | 2 +- creator.d.ts | 2 +- 12 files changed, 3124 insertions(+), 488 deletions(-) rename assets/textures/{ball_00.png => ball_0.png} (100%) rename assets/textures/{ball_00.png.meta => ball_0.png.meta} (97%) rename assets/textures/{prestige_04_big.png => ball_1.png} (100%) rename assets/textures/{prestige_04_big.png.meta => ball_1.png.meta} (96%) rename assets/textures/{start_0.png => video_btn.png} (100%) rename assets/textures/{start_0.png.meta => video_btn.png.meta} (97%) diff --git a/assets/effects/glow-inner.effect b/assets/effects/glow-inner.effect index f3eccd8..276e0ec 100644 --- a/assets/effects/glow-inner.effect +++ b/assets/effects/glow-inner.effect @@ -88,7 +88,7 @@ CCProgram fs %{ // 角度转弧度,公式为:弧度 = 角度 * (pi / 180) float radian = angle * 0.01745329252; // 这个浮点数是 pi / 180 vec4 color = texture(texture, v_uv0 + vec2(distance * cos(radian), distance * sin(radian))); - return 1.0 - color.a; + return color.a; } /** @@ -119,6 +119,13 @@ CCProgram fs %{ * 获取发光的透明度 */ float getGlowAlpha() { + // 原来已经透明的点不处理 + vec4 srcColor = texture(texture, v_uv0); + if (srcColor.a < 0.0000000001) { + return srcColor.a; + } + + // 处理原来不透明的点,求周边平均透明度 float totalAlpha = 0.0; totalAlpha += getDistanceAverageAlpha(glowColorSize * 0.1); totalAlpha += getDistanceAverageAlpha(glowColorSize * 0.2); @@ -152,26 +159,34 @@ CCProgram fs %{ gl_FragColor = o; #if SHOW_INNER_GLOW - // 先画图案 + // 目标颜色(图像) vec4 color_dest = o; - // 然后在图案上叠加内发光 - vec4 color_src = glowColor * getGlowAlpha(); + // 源颜色(内发光) + float alpha = getGlowAlpha(); + // 此时我们得到的是内部透明度为1,靠近边缘的为接近0的透明度 + // 而内发光恰恰相反,是需要内部透明度为0,靠近边缘的接近1的透明度 + // 因此我们需要翻转一下透明度 + // 如果图像边缘有大量渐变,那么如果我们取 0.0 的话,那么可能边缘会出现锯齿 + // 因此我们取0.1作为翻转临界值,0.1也不是绝对的,可以自行修改这里的值 + if (alpha > 0.1) { + alpha = 1.0 - alpha; + } + vec4 color_src = glowColor * alpha; // 按照这个顺序,源颜色就是内发光颜色,目标颜色就是图案颜色色 // 所以命名就是 color_src, color_dest // 按照混合颜色规则 http://docs.cocos.com/creator/manual/zh/advanced-topics/ui-auto-batch.html#blend-%E6%A8%A1%E5%BC%8F // 要在图案上方,叠加一个内发光,将两者颜色混合起来,那么最终选择的混合模式如下: - // color_src: GL_SRC_ALPHA - // color_dest: GL_ONE_MINUS_SRC_ALPHA + // + // (内发光)color_src: GL_SRC_ALPHA + // (原图像)color_dest: GL_ONE + // // 即最终颜色如下: - // color_src * GL_SRC_ALPHA + color_dest * GL_ONE_MINUS_SRC_ALPHA - gl_FragColor = color_src * color_src.a + color_dest * (1.0 - color_src.a); - // gl_FragColor = color_src + color_dest * (1.0 - color_src.a); - // gl_FragColor = color_src * (1.0 - color_src.a) + color_dest * color_src.a; - // gl_FragColor = color_src; - // gl_FragColor = color_dest * color_dest.a + color_src * (1.0 - color_dest.a); + // color_src * GL_SRC_ALPHA + color_dest * GL_ONE + + gl_FragColor = color_src * color_src.a + color_dest; #endif } }% diff --git a/assets/effects/glow-inner.effect.meta b/assets/effects/glow-inner.effect.meta index 8d480f4..2acf658 100644 --- a/assets/effects/glow-inner.effect.meta +++ b/assets/effects/glow-inner.effect.meta @@ -5,11 +5,11 @@ { "glsl1": { "vert": "\nprecision highp float;\nuniform mat4 cc_matViewProj;\nuniform mat4 cc_matWorld;\n\nattribute vec3 a_position;\nattribute vec4 a_color;\nvarying vec4 v_color;\n\n#if USE_TEXTURE\nattribute vec2 a_uv0;\nvarying vec2 v_uv0;\n#endif\n\nvoid main () {\n vec4 pos = vec4(a_position, 1);\n\n #if CC_USE_MODEL\n pos = cc_matViewProj * cc_matWorld * pos;\n #else\n pos = cc_matViewProj * pos;\n #endif\n\n #if USE_TEXTURE\n v_uv0 = a_uv0;\n #endif\n\n v_color = a_color;\n\n gl_Position = pos;\n}\n", - "frag": "\nprecision highp float;\n\n#if USE_ALPHA_TEST\n \n uniform float alphaThreshold;\n#endif\n\nvoid ALPHA_TEST (in vec4 color) {\n #if USE_ALPHA_TEST\n if (color.a < alphaThreshold) discard;\n #endif\n}\n\nvoid ALPHA_TEST (in float alpha) {\n #if USE_ALPHA_TEST\n if (alpha < alphaThreshold) discard;\n #endif\n}\n\nvarying vec4 v_color;\n\n#if USE_TEXTURE\nvarying vec2 v_uv0;\nuniform sampler2D texture;\n#endif\n\n#if SHOW_INNER_GLOW\n\nuniform vec4 glowColor;\nuniform float glowColorSize;\n\n/**\n * 获取指定角度方向,距离为xxx的像素的透明度\n *\n * @param angle 角度 [0.0, 360.0]\n * @param distance 距离 [0.0, 1.0]\n *\n * @return alpha [0.0, 1.0]\n */\nfloat getColorAlpha(float angle, float distance) {\n\n float radian = angle * 0.01745329252;\n\n vec4 color = texture2D(texture, v_uv0 + vec2(distance * cos(radian), distance * sin(radian))); \n return 1.0 - color.a;\n}\n\n/**\n * 获取指定距离的周边像素的透明度平均值\n *\n * @param distance 距离 [0.0, 1.0]\n *\n * @return average alpha [0.0, 1.0]\n */\nfloat getDistanceAverageAlpha(float distance) {\n float totalAlpha = 0.0;\n totalAlpha += getColorAlpha(0.0, distance);\n totalAlpha += getColorAlpha(30.0, distance);\n totalAlpha += getColorAlpha(60.0, distance);\n totalAlpha += getColorAlpha(90.0, distance);\n totalAlpha += getColorAlpha(120.0, distance);\n totalAlpha += getColorAlpha(150.0, distance);\n totalAlpha += getColorAlpha(180.0, distance);\n totalAlpha += getColorAlpha(210.0, distance);\n totalAlpha += getColorAlpha(240.0, distance);\n totalAlpha += getColorAlpha(270.0, distance);\n totalAlpha += getColorAlpha(300.0, distance);\n totalAlpha += getColorAlpha(330.0, distance);\n return totalAlpha * (1.0 / 12.0);\n}\n\n/**\n * 获取发光的透明度\n */\nfloat getGlowAlpha() {\n float totalAlpha = 0.0;\n totalAlpha += getDistanceAverageAlpha(glowColorSize * 0.1);\n totalAlpha += getDistanceAverageAlpha(glowColorSize * 0.2);\n totalAlpha += getDistanceAverageAlpha(glowColorSize * 0.3);\n totalAlpha += getDistanceAverageAlpha(glowColorSize * 0.4);\n totalAlpha += getDistanceAverageAlpha(glowColorSize * 0.5);\n totalAlpha += getDistanceAverageAlpha(glowColorSize * 0.6);\n totalAlpha += getDistanceAverageAlpha(glowColorSize * 0.7);\n totalAlpha += getDistanceAverageAlpha(glowColorSize * 0.8);\n totalAlpha += getDistanceAverageAlpha(glowColorSize * 0.9);\n totalAlpha += getDistanceAverageAlpha(glowColorSize * 1.0);\n return 1.0 - totalAlpha * (1.0 / 10.0);\n\n}\n\n#endif\n\nvoid main () {\n vec4 o = vec4(1, 1, 1, 1);\n\n #if USE_TEXTURE\n o *= texture2D(texture, v_uv0);\n #if CC_USE_ALPHA_ATLAS_TEXTURE\n o.a *= texture2D(texture, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #endif\n\n o *= v_color;\n\n ALPHA_TEST(o);\n\n gl_FragColor = o;\n\n #if SHOW_INNER_GLOW\n\n vec4 color_dest = o;\n\n vec4 color_src = glowColor * getGlowAlpha();\n\n gl_FragColor = color_src * color_src.a + color_dest * (1.0 - color_src.a);\n\n #endif\n}\n" + "frag": "\nprecision highp float;\n\n#if USE_ALPHA_TEST\n \n uniform float alphaThreshold;\n#endif\n\nvoid ALPHA_TEST (in vec4 color) {\n #if USE_ALPHA_TEST\n if (color.a < alphaThreshold) discard;\n #endif\n}\n\nvoid ALPHA_TEST (in float alpha) {\n #if USE_ALPHA_TEST\n if (alpha < alphaThreshold) discard;\n #endif\n}\n\nvarying vec4 v_color;\n\n#if USE_TEXTURE\nvarying vec2 v_uv0;\nuniform sampler2D texture;\n#endif\n\n#if SHOW_INNER_GLOW\n\nuniform vec4 glowColor;\nuniform float glowColorSize;\n\n/**\n * 获取指定角度方向,距离为xxx的像素的透明度\n *\n * @param angle 角度 [0.0, 360.0]\n * @param distance 距离 [0.0, 1.0]\n *\n * @return alpha [0.0, 1.0]\n */\nfloat getColorAlpha(float angle, float distance) {\n\n float radian = angle * 0.01745329252;\n\n vec4 color = texture2D(texture, v_uv0 + vec2(distance * cos(radian), distance * sin(radian))); \n return color.a;\n}\n\n/**\n * 获取指定距离的周边像素的透明度平均值\n *\n * @param distance 距离 [0.0, 1.0]\n *\n * @return average alpha [0.0, 1.0]\n */\nfloat getDistanceAverageAlpha(float distance) {\n float totalAlpha = 0.0;\n totalAlpha += getColorAlpha(0.0, distance);\n totalAlpha += getColorAlpha(30.0, distance);\n totalAlpha += getColorAlpha(60.0, distance);\n totalAlpha += getColorAlpha(90.0, distance);\n totalAlpha += getColorAlpha(120.0, distance);\n totalAlpha += getColorAlpha(150.0, distance);\n totalAlpha += getColorAlpha(180.0, distance);\n totalAlpha += getColorAlpha(210.0, distance);\n totalAlpha += getColorAlpha(240.0, distance);\n totalAlpha += getColorAlpha(270.0, distance);\n totalAlpha += getColorAlpha(300.0, distance);\n totalAlpha += getColorAlpha(330.0, distance);\n return totalAlpha * (1.0 / 12.0);\n}\n\n/**\n * 获取发光的透明度\n */\nfloat getGlowAlpha() {\n\n vec4 srcColor = texture2D(texture, v_uv0);\n if (srcColor.a < 0.0000000001) {\n return srcColor.a;\n }\n\n float totalAlpha = 0.0;\n totalAlpha += getDistanceAverageAlpha(glowColorSize * 0.1);\n totalAlpha += getDistanceAverageAlpha(glowColorSize * 0.2);\n totalAlpha += getDistanceAverageAlpha(glowColorSize * 0.3);\n totalAlpha += getDistanceAverageAlpha(glowColorSize * 0.4);\n totalAlpha += getDistanceAverageAlpha(glowColorSize * 0.5);\n totalAlpha += getDistanceAverageAlpha(glowColorSize * 0.6);\n totalAlpha += getDistanceAverageAlpha(glowColorSize * 0.7);\n totalAlpha += getDistanceAverageAlpha(glowColorSize * 0.8);\n totalAlpha += getDistanceAverageAlpha(glowColorSize * 0.9);\n totalAlpha += getDistanceAverageAlpha(glowColorSize * 1.0);\n return totalAlpha * (1.0 / 10.0);\n}\n\n#endif\n\nvoid main () {\n vec4 o = vec4(1, 1, 1, 1);\n\n #if USE_TEXTURE\n o *= texture2D(texture, v_uv0);\n #if CC_USE_ALPHA_ATLAS_TEXTURE\n o.a *= texture2D(texture, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #endif\n\n o *= v_color;\n\n ALPHA_TEST(o);\n\n gl_FragColor = o;\n\n #if SHOW_INNER_GLOW\n\n vec4 color_dest = o;\n\n float alpha = getGlowAlpha();\n\n if (alpha > 0.1) {\n alpha = 1.0 - alpha;\n }\n vec4 color_src = glowColor * alpha;\n\n gl_FragColor = color_src * color_src.a + color_dest;\n #endif\n}\n" }, "glsl3": { "vert": "\nprecision highp float;\nuniform CCGlobal {\n vec4 cc_time;\n\n vec4 cc_screenSize;\n\n vec4 cc_screenScale;\n\n vec4 cc_nativeSize;\n\n mat4 cc_matView;\n mat4 cc_matViewInv;\n mat4 cc_matProj;\n mat4 cc_matProjInv;\n mat4 cc_matViewProj;\n mat4 cc_matViewProjInv;\n vec4 cc_cameraPos;\n\n vec4 cc_exposure;\n\n vec4 cc_mainLitDir;\n\n vec4 cc_mainLitColor;\n\n vec4 cc_ambientSky;\n vec4 cc_ambientGround;\n};\nuniform CCLocal {\n mat4 cc_matWorld;\n mat4 cc_matWorldIT;\n};\n\nin vec3 a_position;\nin vec4 a_color;\nout vec4 v_color;\n\n#if USE_TEXTURE\nin vec2 a_uv0;\nout vec2 v_uv0;\n#endif\n\nvoid main () {\n vec4 pos = vec4(a_position, 1);\n\n #if CC_USE_MODEL\n pos = cc_matViewProj * cc_matWorld * pos;\n #else\n pos = cc_matViewProj * pos;\n #endif\n\n #if USE_TEXTURE\n v_uv0 = a_uv0;\n #endif\n\n v_color = a_color;\n\n gl_Position = pos;\n}\n", - "frag": "\nprecision highp float;\n\n#if USE_ALPHA_TEST\n \n uniform ALPHA_TEST {\n float alphaThreshold;\n }\n#endif\n\nvoid ALPHA_TEST (in vec4 color) {\n #if USE_ALPHA_TEST\n if (color.a < alphaThreshold) discard;\n #endif\n}\n\nvoid ALPHA_TEST (in float alpha) {\n #if USE_ALPHA_TEST\n if (alpha < alphaThreshold) discard;\n #endif\n}\n\nin vec4 v_color;\n\n#if USE_TEXTURE\nin vec2 v_uv0;\nuniform sampler2D texture;\n#endif\n\n#if SHOW_INNER_GLOW\n\nuniform glow {\n\n vec4 glowColor;\n\n float glowColorSize;\n\n};\n\n/**\n * 获取指定角度方向,距离为xxx的像素的透明度\n *\n * @param angle 角度 [0.0, 360.0]\n * @param distance 距离 [0.0, 1.0]\n *\n * @return alpha [0.0, 1.0]\n */\nfloat getColorAlpha(float angle, float distance) {\n\n float radian = angle * 0.01745329252;\n\n vec4 color = texture(texture, v_uv0 + vec2(distance * cos(radian), distance * sin(radian))); \n return 1.0 - color.a;\n}\n\n/**\n * 获取指定距离的周边像素的透明度平均值\n *\n * @param distance 距离 [0.0, 1.0]\n *\n * @return average alpha [0.0, 1.0]\n */\nfloat getDistanceAverageAlpha(float distance) {\n float totalAlpha = 0.0;\n totalAlpha += getColorAlpha(0.0, distance);\n totalAlpha += getColorAlpha(30.0, distance);\n totalAlpha += getColorAlpha(60.0, distance);\n totalAlpha += getColorAlpha(90.0, distance);\n totalAlpha += getColorAlpha(120.0, distance);\n totalAlpha += getColorAlpha(150.0, distance);\n totalAlpha += getColorAlpha(180.0, distance);\n totalAlpha += getColorAlpha(210.0, distance);\n totalAlpha += getColorAlpha(240.0, distance);\n totalAlpha += getColorAlpha(270.0, distance);\n totalAlpha += getColorAlpha(300.0, distance);\n totalAlpha += getColorAlpha(330.0, distance);\n return totalAlpha * (1.0 / 12.0);\n}\n\n/**\n * 获取发光的透明度\n */\nfloat getGlowAlpha() {\n float totalAlpha = 0.0;\n totalAlpha += getDistanceAverageAlpha(glowColorSize * 0.1);\n totalAlpha += getDistanceAverageAlpha(glowColorSize * 0.2);\n totalAlpha += getDistanceAverageAlpha(glowColorSize * 0.3);\n totalAlpha += getDistanceAverageAlpha(glowColorSize * 0.4);\n totalAlpha += getDistanceAverageAlpha(glowColorSize * 0.5);\n totalAlpha += getDistanceAverageAlpha(glowColorSize * 0.6);\n totalAlpha += getDistanceAverageAlpha(glowColorSize * 0.7);\n totalAlpha += getDistanceAverageAlpha(glowColorSize * 0.8);\n totalAlpha += getDistanceAverageAlpha(glowColorSize * 0.9);\n totalAlpha += getDistanceAverageAlpha(glowColorSize * 1.0);\n return 1.0 - totalAlpha * (1.0 / 10.0);\n\n}\n\n#endif\n\nvoid main () {\n vec4 o = vec4(1, 1, 1, 1);\n\n #if USE_TEXTURE\n o *= texture(texture, v_uv0);\n #if CC_USE_ALPHA_ATLAS_TEXTURE\n o.a *= texture2D(texture, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #endif\n\n o *= v_color;\n\n ALPHA_TEST(o);\n\n gl_FragColor = o;\n\n #if SHOW_INNER_GLOW\n\n vec4 color_dest = o;\n\n vec4 color_src = glowColor * getGlowAlpha();\n\n gl_FragColor = color_src * color_src.a + color_dest * (1.0 - color_src.a);\n\n #endif\n}\n" + "frag": "\nprecision highp float;\n\n#if USE_ALPHA_TEST\n \n uniform ALPHA_TEST {\n float alphaThreshold;\n }\n#endif\n\nvoid ALPHA_TEST (in vec4 color) {\n #if USE_ALPHA_TEST\n if (color.a < alphaThreshold) discard;\n #endif\n}\n\nvoid ALPHA_TEST (in float alpha) {\n #if USE_ALPHA_TEST\n if (alpha < alphaThreshold) discard;\n #endif\n}\n\nin vec4 v_color;\n\n#if USE_TEXTURE\nin vec2 v_uv0;\nuniform sampler2D texture;\n#endif\n\n#if SHOW_INNER_GLOW\n\nuniform glow {\n\n vec4 glowColor;\n\n float glowColorSize;\n\n};\n\n/**\n * 获取指定角度方向,距离为xxx的像素的透明度\n *\n * @param angle 角度 [0.0, 360.0]\n * @param distance 距离 [0.0, 1.0]\n *\n * @return alpha [0.0, 1.0]\n */\nfloat getColorAlpha(float angle, float distance) {\n\n float radian = angle * 0.01745329252;\n\n vec4 color = texture(texture, v_uv0 + vec2(distance * cos(radian), distance * sin(radian))); \n return color.a;\n}\n\n/**\n * 获取指定距离的周边像素的透明度平均值\n *\n * @param distance 距离 [0.0, 1.0]\n *\n * @return average alpha [0.0, 1.0]\n */\nfloat getDistanceAverageAlpha(float distance) {\n float totalAlpha = 0.0;\n totalAlpha += getColorAlpha(0.0, distance);\n totalAlpha += getColorAlpha(30.0, distance);\n totalAlpha += getColorAlpha(60.0, distance);\n totalAlpha += getColorAlpha(90.0, distance);\n totalAlpha += getColorAlpha(120.0, distance);\n totalAlpha += getColorAlpha(150.0, distance);\n totalAlpha += getColorAlpha(180.0, distance);\n totalAlpha += getColorAlpha(210.0, distance);\n totalAlpha += getColorAlpha(240.0, distance);\n totalAlpha += getColorAlpha(270.0, distance);\n totalAlpha += getColorAlpha(300.0, distance);\n totalAlpha += getColorAlpha(330.0, distance);\n return totalAlpha * (1.0 / 12.0);\n}\n\n/**\n * 获取发光的透明度\n */\nfloat getGlowAlpha() {\n\n vec4 srcColor = texture(texture, v_uv0);\n if (srcColor.a < 0.0000000001) {\n return srcColor.a;\n }\n\n float totalAlpha = 0.0;\n totalAlpha += getDistanceAverageAlpha(glowColorSize * 0.1);\n totalAlpha += getDistanceAverageAlpha(glowColorSize * 0.2);\n totalAlpha += getDistanceAverageAlpha(glowColorSize * 0.3);\n totalAlpha += getDistanceAverageAlpha(glowColorSize * 0.4);\n totalAlpha += getDistanceAverageAlpha(glowColorSize * 0.5);\n totalAlpha += getDistanceAverageAlpha(glowColorSize * 0.6);\n totalAlpha += getDistanceAverageAlpha(glowColorSize * 0.7);\n totalAlpha += getDistanceAverageAlpha(glowColorSize * 0.8);\n totalAlpha += getDistanceAverageAlpha(glowColorSize * 0.9);\n totalAlpha += getDistanceAverageAlpha(glowColorSize * 1.0);\n return totalAlpha * (1.0 / 10.0);\n}\n\n#endif\n\nvoid main () {\n vec4 o = vec4(1, 1, 1, 1);\n\n #if USE_TEXTURE\n o *= texture(texture, v_uv0);\n #if CC_USE_ALPHA_ATLAS_TEXTURE\n o.a *= texture2D(texture, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #endif\n\n o *= v_color;\n\n ALPHA_TEST(o);\n\n gl_FragColor = o;\n\n #if SHOW_INNER_GLOW\n\n vec4 color_dest = o;\n\n float alpha = getGlowAlpha();\n\n if (alpha > 0.1) {\n alpha = 1.0 - alpha;\n }\n vec4 color_src = glowColor * alpha;\n\n gl_FragColor = color_src * color_src.a + color_dest;\n #endif\n}\n" } } ], diff --git a/assets/materials/glow-inner.mtl b/assets/materials/glow-inner.mtl index e5e525d..54572d4 100644 --- a/assets/materials/glow-inner.mtl +++ b/assets/materials/glow-inner.mtl @@ -12,6 +12,14 @@ "SHOW_INNER_GLOW": true }, "_props": { - "texture": null + "texture": null, + "glowColor": { + "__type__": "cc.Vec4", + "x": 0, + "y": 0, + "z": 1, + "w": 1 + }, + "glowColorSize": 0.5 } } \ No newline at end of file diff --git a/assets/scenes/GlowInnerEffectScene.fire b/assets/scenes/GlowInnerEffectScene.fire index bacb883..4407eac 100755 --- a/assets/scenes/GlowInnerEffectScene.fire +++ b/assets/scenes/GlowInnerEffectScene.fire @@ -78,16 +78,16 @@ "__id__": 8 }, { - "__id__": 21 + "__id__": 71 } ], "_active": true, "_components": [ { - "__id__": 32 + "__id__": 86 }, { - "__id__": 33 + "__id__": 87 } ], "_prefab": null, @@ -362,7 +362,7 @@ }, { "__type__": "cc.Node", - "_name": "Layout", + "_name": "SliderLayouts", "_objFlags": 0, "_parent": { "__id__": 2 @@ -372,7 +372,88 @@ "__id__": 9 }, { - "__id__": 11 + "__id__": 21 + }, + { + "__id__": 33 + }, + { + "__id__": 45 + }, + { + "__id__": 57 + } + ], + "_active": true, + "_components": [ + { + "__id__": 69 + }, + { + "__id__": 70 + } + ], + "_prefab": null, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 672, + "height": 444 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 1 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + -144, + 272, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1 + ] + }, + "_eulerAngles": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_skewX": 0, + "_skewY": 0, + "_is3DNode": false, + "_groupIndex": 0, + "groupIndex": 0, + "_id": "d0PWmVX95D3LEcvBQBPDr+" + }, + { + "__type__": "cc.Node", + "_name": "RedSlider", + "_objFlags": 0, + "_parent": { + "__id__": 8 + }, + "_children": [ + { + "__id__": 10 + }, + { + "__id__": 12 } ], "_active": true, @@ -395,20 +476,20 @@ }, "_contentSize": { "__type__": "cc.Size", - "width": 548, - "height": 150 + "width": 461.38, + "height": 60 }, "_anchorPoint": { "__type__": "cc.Vec2", - "x": 0.5, + "x": 1, "y": 0.5 }, "_trs": { "__type__": "TypedArray", "ctor": "Float64Array", "array": [ - -62, - 168.26, + 235.2, + -30, 0, 0, 0, @@ -430,20 +511,20 @@ "_is3DNode": false, "_groupIndex": 0, "groupIndex": 0, - "_id": "11ZCsp/hhAnoxRSLqdlROB" + "_id": "917ZB8DYlJSY/O0VyEgEDe" }, { "__type__": "cc.Node", - "_name": "Label", + "_name": "SliderDescLabel", "_objFlags": 0, "_parent": { - "__id__": 8 + "__id__": 9 }, "_children": [], "_active": true, "_components": [ { - "__id__": 10 + "__id__": 11 } ], "_prefab": null, @@ -457,19 +538,19 @@ }, "_contentSize": { "__type__": "cc.Size", - "width": 200, + "width": 113.38, "height": 50.4 }, "_anchorPoint": { "__type__": "cc.Vec2", - "x": 0.5, + "x": 1, "y": 0.5 }, "_trs": { "__type__": "TypedArray", "ctor": "Float64Array", "array": [ - -174, + -348, 0, 0, 0, @@ -492,14 +573,14 @@ "_is3DNode": false, "_groupIndex": 0, "groupIndex": 0, - "_id": "a8mK6UowJOqLvmjfPIiuTZ" + "_id": "547VVCPdxBjJnAfoBu4v/U" }, { "__type__": "cc.Label", "_name": "", "_objFlags": 0, "node": { - "__id__": 9 + "__id__": 10 }, "_enabled": true, "_materials": [ @@ -508,8 +589,8 @@ } ], "_useOriginalSize": false, - "_string": "发光宽度:", - "_N$string": "发光宽度:", + "_string": "Red:", + "_N$string": "Red:", "_fontSize": 40, "_lineHeight": 40, "_enableWrapText": true, @@ -522,186 +603,27 @@ "_N$fontFamily": "Arial", "_N$overflow": 0, "_N$cacheMode": 0, - "_id": "5aqqaNVJNJsqy4cwZGvqW5" + "_id": "022uX6BxVOt6uGzaB7djvH" }, { "__type__": "cc.Node", "_name": "Slider", "_objFlags": 0, "_parent": { - "__id__": 8 + "__id__": 9 }, "_children": [ - { - "__id__": 12 - }, - { - "__id__": 14 - } - ], - "_active": true, - "_components": [ - { - "__id__": 17 - } - ], - "_prefab": null, - "_opacity": 255, - "_color": { - "__type__": "cc.Color", - "r": 255, - "g": 255, - "b": 255, - "a": 255 - }, - "_contentSize": { - "__type__": "cc.Size", - "width": 300, - "height": 20 - }, - "_anchorPoint": { - "__type__": "cc.Vec2", - "x": 0.5, - "y": 0.5 - }, - "_trs": { - "__type__": "TypedArray", - "ctor": "Float64Array", - "array": [ - 124, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1 - ] - }, - "_eulerAngles": { - "__type__": "cc.Vec3", - "x": 0, - "y": 0, - "z": 0 - }, - "_skewX": 0, - "_skewY": 0, - "_is3DNode": false, - "_groupIndex": 0, - "groupIndex": 0, - "_id": "e3WHmNWolODK/k/BUhp8n+" - }, - { - "__type__": "cc.Node", - "_name": "Background", - "_objFlags": 0, - "_parent": { - "__id__": 11 - }, - "_children": [], - "_active": true, - "_components": [ { "__id__": 13 - } - ], - "_prefab": null, - "_opacity": 255, - "_color": { - "__type__": "cc.Color", - "r": 255, - "g": 255, - "b": 255, - "a": 255 - }, - "_contentSize": { - "__type__": "cc.Size", - "width": 300, - "height": 20 - }, - "_anchorPoint": { - "__type__": "cc.Vec2", - "x": 0.5, - "y": 0.5 - }, - "_trs": { - "__type__": "TypedArray", - "ctor": "Float64Array", - "array": [ - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1 - ] - }, - "_eulerAngles": { - "__type__": "cc.Vec3", - "x": 0, - "y": 0, - "z": 0 - }, - "_skewX": 0, - "_skewY": 0, - "_is3DNode": false, - "_groupIndex": 0, - "groupIndex": 0, - "_id": "4e4s7CtEpIPYADvmHwxDSt" - }, - { - "__type__": "cc.Sprite", - "_name": "", - "_objFlags": 0, - "node": { - "__id__": 12 - }, - "_enabled": true, - "_materials": [ - { - "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432" - } - ], - "_srcBlendFactor": 770, - "_dstBlendFactor": 771, - "_spriteFrame": { - "__uuid__": "31d8962d-babb-4ec7-be19-8e9f54a4ea99" - }, - "_type": 1, - "_sizeMode": 0, - "_fillType": 0, - "_fillCenter": { - "__type__": "cc.Vec2", - "x": 0, - "y": 0 - }, - "_fillStart": 0, - "_fillRange": 0, - "_isTrimmedMode": true, - "_atlas": null, - "_id": "fc/wnYCLxJKrZ8PoMA1CYw" - }, - { - "__type__": "cc.Node", - "_name": "Handle", - "_objFlags": 0, - "_parent": { - "__id__": 11 - }, - "_children": [], - "_active": true, - "_components": [ + }, { "__id__": 15 - }, + } + ], + "_active": true, + "_components": [ { - "__id__": 16 + "__id__": 18 } ], "_prefab": null, @@ -715,8 +637,8 @@ }, "_contentSize": { "__type__": "cc.Size", - "width": 32, - "height": 32 + "width": 300, + "height": 20 }, "_anchorPoint": { "__type__": "cc.Vec2", @@ -750,14 +672,173 @@ "_is3DNode": false, "_groupIndex": 0, "groupIndex": 0, - "_id": "cboGZ4mmtC7Z7ZvWnGXRab" + "_id": "f3RRvqgCdFJb5/HF2inlH5" + }, + { + "__type__": "cc.Node", + "_name": "Background", + "_objFlags": 0, + "_parent": { + "__id__": 12 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 14 + } + ], + "_prefab": null, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 300, + "height": 20 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1 + ] + }, + "_eulerAngles": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_skewX": 0, + "_skewY": 0, + "_is3DNode": false, + "_groupIndex": 0, + "groupIndex": 0, + "_id": "baDHqeTQhL6IOo+iat5VD2" }, { "__type__": "cc.Sprite", "_name": "", "_objFlags": 0, "node": { - "__id__": 14 + "__id__": 13 + }, + "_enabled": true, + "_materials": [ + { + "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432" + } + ], + "_srcBlendFactor": 770, + "_dstBlendFactor": 771, + "_spriteFrame": { + "__uuid__": "31d8962d-babb-4ec7-be19-8e9f54a4ea99" + }, + "_type": 1, + "_sizeMode": 0, + "_fillType": 0, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": true, + "_atlas": null, + "_id": "75F/F7A0NMy46qZ4WhWqcw" + }, + { + "__type__": "cc.Node", + "_name": "Handle", + "_objFlags": 0, + "_parent": { + "__id__": 12 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 16 + }, + { + "__id__": 17 + } + ], + "_prefab": null, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 32, + "height": 32 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + 150, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1 + ] + }, + "_eulerAngles": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_skewX": 0, + "_skewY": 0, + "_is3DNode": false, + "_groupIndex": 0, + "groupIndex": 0, + "_id": "88hQVlfRJF+bGWN48y+iIl" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 15 }, "_enabled": true, "_materials": [ @@ -782,14 +863,14 @@ "_fillRange": 0, "_isTrimmedMode": true, "_atlas": null, - "_id": "eeIzXLXopG3Ypab6LDsHxh" + "_id": "f4PNW5YfVF2brYJwf0AmMO" }, { "__type__": "cc.Button", "_name": "", "_objFlags": 0, "node": { - "__id__": 14 + "__id__": 15 }, "_enabled": true, "_normalMaterial": null, @@ -862,7 +943,2335 @@ "__uuid__": "29158224-f8dd-4661-a796-1ffab537140e" }, "_N$target": { - "__id__": 14 + "__id__": 15 + }, + "_id": "9ew1jJ3O9JCa/95B6/tzB4" + }, + { + "__type__": "cc.Slider", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 12 + }, + "_enabled": true, + "direction": 0, + "slideEvents": [], + "_N$handle": { + "__id__": 17 + }, + "_N$progress": 1, + "_id": "48613KD+pH6pihPrVckpVo" + }, + { + "__type__": "cc.Widget", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 9 + }, + "_enabled": true, + "alignMode": 1, + "_target": null, + "_alignFlags": 32, + "_left": 0, + "_right": 0.15, + "_top": 0, + "_bottom": 0, + "_verticalCenter": 0, + "_horizontalCenter": 0, + "_isAbsLeft": true, + "_isAbsRight": false, + "_isAbsTop": true, + "_isAbsBottom": true, + "_isAbsHorizontalCenter": true, + "_isAbsVerticalCenter": true, + "_originalWidth": 0, + "_originalHeight": 0, + "_id": "bdpdSkmw5LdIwdkeqaI7ft" + }, + { + "__type__": "cc.Layout", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 9 + }, + "_enabled": true, + "_layoutSize": { + "__type__": "cc.Size", + "width": 461.38, + "height": 60 + }, + "_resize": 1, + "_N$layoutType": 1, + "_N$padding": 0, + "_N$cellSize": { + "__type__": "cc.Size", + "width": 40, + "height": 40 + }, + "_N$startAxis": 0, + "_N$paddingLeft": 0, + "_N$paddingRight": 0, + "_N$paddingTop": 0, + "_N$paddingBottom": 0, + "_N$spacingX": 48, + "_N$spacingY": 0, + "_N$verticalDirection": 1, + "_N$horizontalDirection": 0, + "_N$affectedByScale": false, + "_id": "9cBGwgH+ZAs4SfdS8DZ/jt" + }, + { + "__type__": "cc.Node", + "_name": "GreenSlider", + "_objFlags": 0, + "_parent": { + "__id__": 8 + }, + "_children": [ + { + "__id__": 22 + }, + { + "__id__": 24 + } + ], + "_active": true, + "_components": [ + { + "__id__": 31 + }, + { + "__id__": 32 + } + ], + "_prefab": null, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 499.16999999999996, + "height": 60 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 1, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + 235.2, + -126, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1 + ] + }, + "_eulerAngles": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_skewX": 0, + "_skewY": 0, + "_is3DNode": false, + "_groupIndex": 0, + "groupIndex": 0, + "_id": "53X3lUqGREJbX4l2xgrEgi" + }, + { + "__type__": "cc.Node", + "_name": "SliderDescLabel", + "_objFlags": 0, + "_parent": { + "__id__": 21 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 23 + } + ], + "_prefab": null, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 151.17, + "height": 50.4 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 1, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + -348, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1 + ] + }, + "_eulerAngles": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_skewX": 0, + "_skewY": 0, + "_is3DNode": false, + "_groupIndex": 0, + "groupIndex": 0, + "_id": "2chyKHwV1Hu6tyzetukPaY" + }, + { + "__type__": "cc.Label", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 22 + }, + "_enabled": true, + "_materials": [ + { + "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432" + } + ], + "_useOriginalSize": false, + "_string": "Green:", + "_N$string": "Green:", + "_fontSize": 40, + "_lineHeight": 40, + "_enableWrapText": true, + "_N$file": null, + "_isSystemFontUsed": true, + "_spacingX": 0, + "_batchAsBitmap": false, + "_N$horizontalAlign": 1, + "_N$verticalAlign": 1, + "_N$fontFamily": "Arial", + "_N$overflow": 0, + "_N$cacheMode": 0, + "_id": "ddHnWBHulJV52y1JykFKpi" + }, + { + "__type__": "cc.Node", + "_name": "Slider", + "_objFlags": 0, + "_parent": { + "__id__": 21 + }, + "_children": [ + { + "__id__": 25 + }, + { + "__id__": 27 + } + ], + "_active": true, + "_components": [ + { + "__id__": 30 + } + ], + "_prefab": null, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 300, + "height": 20 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + -150, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1 + ] + }, + "_eulerAngles": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_skewX": 0, + "_skewY": 0, + "_is3DNode": false, + "_groupIndex": 0, + "groupIndex": 0, + "_id": "8eNI13tDJA150bvjO5xAho" + }, + { + "__type__": "cc.Node", + "_name": "Background", + "_objFlags": 0, + "_parent": { + "__id__": 24 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 26 + } + ], + "_prefab": null, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 300, + "height": 20 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1 + ] + }, + "_eulerAngles": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_skewX": 0, + "_skewY": 0, + "_is3DNode": false, + "_groupIndex": 0, + "groupIndex": 0, + "_id": "162WJ5H79B1bvePlpbKu6h" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 25 + }, + "_enabled": true, + "_materials": [ + { + "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432" + } + ], + "_srcBlendFactor": 770, + "_dstBlendFactor": 771, + "_spriteFrame": { + "__uuid__": "31d8962d-babb-4ec7-be19-8e9f54a4ea99" + }, + "_type": 1, + "_sizeMode": 0, + "_fillType": 0, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": true, + "_atlas": null, + "_id": "b1XIJasm5Fz4WgqQUUbAXR" + }, + { + "__type__": "cc.Node", + "_name": "Handle", + "_objFlags": 0, + "_parent": { + "__id__": 24 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 28 + }, + { + "__id__": 29 + } + ], + "_prefab": null, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 32, + "height": 32 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + -150, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1 + ] + }, + "_eulerAngles": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_skewX": 0, + "_skewY": 0, + "_is3DNode": false, + "_groupIndex": 0, + "groupIndex": 0, + "_id": "45XiOCvBpI0bQn+al4ebK5" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 27 + }, + "_enabled": true, + "_materials": [ + { + "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432" + } + ], + "_srcBlendFactor": 770, + "_dstBlendFactor": 771, + "_spriteFrame": { + "__uuid__": "e7aba14b-f956-4480-b254-8d57832e273f" + }, + "_type": 1, + "_sizeMode": 2, + "_fillType": 0, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": true, + "_atlas": null, + "_id": "33MrRg2JhF3aj8sGQoxKL5" + }, + { + "__type__": "cc.Button", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 27 + }, + "_enabled": true, + "_normalMaterial": null, + "_grayMaterial": null, + "duration": 0.1, + "zoomScale": 1.1, + "clickEvents": [], + "_N$interactable": true, + "_N$enableAutoGrayEffect": true, + "_N$transition": 3, + "transition": 3, + "_N$normalColor": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_N$pressedColor": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "pressedColor": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_N$hoverColor": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "hoverColor": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_N$disabledColor": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_N$normalSprite": { + "__uuid__": "e7aba14b-f956-4480-b254-8d57832e273f" + }, + "_N$pressedSprite": { + "__uuid__": "e7aba14b-f956-4480-b254-8d57832e273f" + }, + "pressedSprite": { + "__uuid__": "e7aba14b-f956-4480-b254-8d57832e273f" + }, + "_N$hoverSprite": { + "__uuid__": "e7aba14b-f956-4480-b254-8d57832e273f" + }, + "hoverSprite": { + "__uuid__": "e7aba14b-f956-4480-b254-8d57832e273f" + }, + "_N$disabledSprite": { + "__uuid__": "29158224-f8dd-4661-a796-1ffab537140e" + }, + "_N$target": { + "__id__": 27 + }, + "_id": "76HjLs+hFDdotrY1o07xDq" + }, + { + "__type__": "cc.Slider", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 24 + }, + "_enabled": true, + "direction": 0, + "slideEvents": [], + "_N$handle": { + "__id__": 29 + }, + "_N$progress": 0, + "_id": "1bfa64dcVK35RfVQ0XPKtq" + }, + { + "__type__": "cc.Widget", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 21 + }, + "_enabled": true, + "alignMode": 1, + "_target": null, + "_alignFlags": 32, + "_left": 0, + "_right": 0.15, + "_top": 0, + "_bottom": 0, + "_verticalCenter": 0, + "_horizontalCenter": 0, + "_isAbsLeft": true, + "_isAbsRight": false, + "_isAbsTop": true, + "_isAbsBottom": true, + "_isAbsHorizontalCenter": true, + "_isAbsVerticalCenter": true, + "_originalWidth": 0, + "_originalHeight": 0, + "_id": "74+pn7WUdApYiFfcq4capg" + }, + { + "__type__": "cc.Layout", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 21 + }, + "_enabled": true, + "_layoutSize": { + "__type__": "cc.Size", + "width": 499.16999999999996, + "height": 60 + }, + "_resize": 1, + "_N$layoutType": 1, + "_N$padding": 0, + "_N$cellSize": { + "__type__": "cc.Size", + "width": 40, + "height": 40 + }, + "_N$startAxis": 0, + "_N$paddingLeft": 0, + "_N$paddingRight": 0, + "_N$paddingTop": 0, + "_N$paddingBottom": 0, + "_N$spacingX": 48, + "_N$spacingY": 0, + "_N$verticalDirection": 1, + "_N$horizontalDirection": 0, + "_N$affectedByScale": false, + "_id": "0dIeTTm4BJyIWEBp563fzv" + }, + { + "__type__": "cc.Node", + "_name": "BlueSlider", + "_objFlags": 0, + "_parent": { + "__id__": 8 + }, + "_children": [ + { + "__id__": 34 + }, + { + "__id__": 36 + } + ], + "_active": true, + "_components": [ + { + "__id__": 43 + }, + { + "__id__": 44 + } + ], + "_prefab": null, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 468.06, + "height": 60 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 1, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + 235.2, + -222, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1 + ] + }, + "_eulerAngles": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_skewX": 0, + "_skewY": 0, + "_is3DNode": false, + "_groupIndex": 0, + "groupIndex": 0, + "_id": "74/Xzbb3lGrbAcMyZs+9Gq" + }, + { + "__type__": "cc.Node", + "_name": "SliderDescLabel", + "_objFlags": 0, + "_parent": { + "__id__": 33 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 35 + } + ], + "_prefab": null, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 120.06, + "height": 50.4 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 1, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + -347.99999999999994, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1 + ] + }, + "_eulerAngles": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_skewX": 0, + "_skewY": 0, + "_is3DNode": false, + "_groupIndex": 0, + "groupIndex": 0, + "_id": "cfVZelDchL6YKhcfxeimVX" + }, + { + "__type__": "cc.Label", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 34 + }, + "_enabled": true, + "_materials": [ + { + "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432" + } + ], + "_useOriginalSize": false, + "_string": "Blue:", + "_N$string": "Blue:", + "_fontSize": 40, + "_lineHeight": 40, + "_enableWrapText": true, + "_N$file": null, + "_isSystemFontUsed": true, + "_spacingX": 0, + "_batchAsBitmap": false, + "_N$horizontalAlign": 1, + "_N$verticalAlign": 1, + "_N$fontFamily": "Arial", + "_N$overflow": 0, + "_N$cacheMode": 0, + "_id": "94bzlcTJdGE5lfXLVkQiV6" + }, + { + "__type__": "cc.Node", + "_name": "Slider", + "_objFlags": 0, + "_parent": { + "__id__": 33 + }, + "_children": [ + { + "__id__": 37 + }, + { + "__id__": 39 + } + ], + "_active": true, + "_components": [ + { + "__id__": 42 + } + ], + "_prefab": null, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 300, + "height": 20 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + -149.99999999999994, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1 + ] + }, + "_eulerAngles": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_skewX": 0, + "_skewY": 0, + "_is3DNode": false, + "_groupIndex": 0, + "groupIndex": 0, + "_id": "5c15v6DUxM/5mhDgktRlbC" + }, + { + "__type__": "cc.Node", + "_name": "Background", + "_objFlags": 0, + "_parent": { + "__id__": 36 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 38 + } + ], + "_prefab": null, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 300, + "height": 20 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1 + ] + }, + "_eulerAngles": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_skewX": 0, + "_skewY": 0, + "_is3DNode": false, + "_groupIndex": 0, + "groupIndex": 0, + "_id": "40ST3fvd5DJ69rOS4CcP0P" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 37 + }, + "_enabled": true, + "_materials": [ + { + "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432" + } + ], + "_srcBlendFactor": 770, + "_dstBlendFactor": 771, + "_spriteFrame": { + "__uuid__": "31d8962d-babb-4ec7-be19-8e9f54a4ea99" + }, + "_type": 1, + "_sizeMode": 0, + "_fillType": 0, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": true, + "_atlas": null, + "_id": "37VWgFHUNNIZEtLrsYw0ks" + }, + { + "__type__": "cc.Node", + "_name": "Handle", + "_objFlags": 0, + "_parent": { + "__id__": 36 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 40 + }, + { + "__id__": 41 + } + ], + "_prefab": null, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 32, + "height": 32 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + -150, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1 + ] + }, + "_eulerAngles": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_skewX": 0, + "_skewY": 0, + "_is3DNode": false, + "_groupIndex": 0, + "groupIndex": 0, + "_id": "caoUpILw9A/K63rk81uu82" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 39 + }, + "_enabled": true, + "_materials": [ + { + "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432" + } + ], + "_srcBlendFactor": 770, + "_dstBlendFactor": 771, + "_spriteFrame": { + "__uuid__": "e7aba14b-f956-4480-b254-8d57832e273f" + }, + "_type": 1, + "_sizeMode": 2, + "_fillType": 0, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": true, + "_atlas": null, + "_id": "83vpX7M5NHkIFPkLFntBX7" + }, + { + "__type__": "cc.Button", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 39 + }, + "_enabled": true, + "_normalMaterial": null, + "_grayMaterial": null, + "duration": 0.1, + "zoomScale": 1.1, + "clickEvents": [], + "_N$interactable": true, + "_N$enableAutoGrayEffect": true, + "_N$transition": 3, + "transition": 3, + "_N$normalColor": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_N$pressedColor": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "pressedColor": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_N$hoverColor": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "hoverColor": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_N$disabledColor": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_N$normalSprite": { + "__uuid__": "e7aba14b-f956-4480-b254-8d57832e273f" + }, + "_N$pressedSprite": { + "__uuid__": "e7aba14b-f956-4480-b254-8d57832e273f" + }, + "pressedSprite": { + "__uuid__": "e7aba14b-f956-4480-b254-8d57832e273f" + }, + "_N$hoverSprite": { + "__uuid__": "e7aba14b-f956-4480-b254-8d57832e273f" + }, + "hoverSprite": { + "__uuid__": "e7aba14b-f956-4480-b254-8d57832e273f" + }, + "_N$disabledSprite": { + "__uuid__": "29158224-f8dd-4661-a796-1ffab537140e" + }, + "_N$target": { + "__id__": 39 + }, + "_id": "c8PrWZtelAVpRem7h8nHhw" + }, + { + "__type__": "cc.Slider", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 36 + }, + "_enabled": true, + "direction": 0, + "slideEvents": [], + "_N$handle": { + "__id__": 41 + }, + "_N$progress": 0, + "_id": "4aqIcWSgtBl4URx3XgtuPJ" + }, + { + "__type__": "cc.Widget", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 33 + }, + "_enabled": true, + "alignMode": 1, + "_target": null, + "_alignFlags": 32, + "_left": 0, + "_right": 0.15, + "_top": 0, + "_bottom": 0, + "_verticalCenter": 0, + "_horizontalCenter": 0, + "_isAbsLeft": true, + "_isAbsRight": false, + "_isAbsTop": true, + "_isAbsBottom": true, + "_isAbsHorizontalCenter": true, + "_isAbsVerticalCenter": true, + "_originalWidth": 0, + "_originalHeight": 0, + "_id": "eceqgzwWNLA4FddrW65YYp" + }, + { + "__type__": "cc.Layout", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 33 + }, + "_enabled": true, + "_layoutSize": { + "__type__": "cc.Size", + "width": 468.06, + "height": 60 + }, + "_resize": 1, + "_N$layoutType": 1, + "_N$padding": 0, + "_N$cellSize": { + "__type__": "cc.Size", + "width": 40, + "height": 40 + }, + "_N$startAxis": 0, + "_N$paddingLeft": 0, + "_N$paddingRight": 0, + "_N$paddingTop": 0, + "_N$paddingBottom": 0, + "_N$spacingX": 48, + "_N$spacingY": 0, + "_N$verticalDirection": 1, + "_N$horizontalDirection": 0, + "_N$affectedByScale": false, + "_id": "53O7y5LFNCwYcoOPkCscyJ" + }, + { + "__type__": "cc.Node", + "_name": "AlphaSlider", + "_objFlags": 0, + "_parent": { + "__id__": 8 + }, + "_children": [ + { + "__id__": 46 + }, + { + "__id__": 48 + } + ], + "_active": true, + "_components": [ + { + "__id__": 55 + }, + { + "__id__": 56 + } + ], + "_prefab": null, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 490.3, + "height": 60 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 1, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + 235.2, + -318, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1 + ] + }, + "_eulerAngles": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_skewX": 0, + "_skewY": 0, + "_is3DNode": false, + "_groupIndex": 0, + "groupIndex": 0, + "_id": "4e9vmBXj1JmoNSSM0vrz49" + }, + { + "__type__": "cc.Node", + "_name": "SliderDescLabel", + "_objFlags": 0, + "_parent": { + "__id__": 45 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 47 + } + ], + "_prefab": null, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 142.3, + "height": 50.4 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 1, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + -347.99999999999994, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1 + ] + }, + "_eulerAngles": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_skewX": 0, + "_skewY": 0, + "_is3DNode": false, + "_groupIndex": 0, + "groupIndex": 0, + "_id": "6ci/QQKflHu4YL2qkog4Jx" + }, + { + "__type__": "cc.Label", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 46 + }, + "_enabled": true, + "_materials": [ + { + "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432" + } + ], + "_useOriginalSize": false, + "_string": "Alpha:", + "_N$string": "Alpha:", + "_fontSize": 40, + "_lineHeight": 40, + "_enableWrapText": true, + "_N$file": null, + "_isSystemFontUsed": true, + "_spacingX": 0, + "_batchAsBitmap": false, + "_N$horizontalAlign": 1, + "_N$verticalAlign": 1, + "_N$fontFamily": "Arial", + "_N$overflow": 0, + "_N$cacheMode": 0, + "_id": "94Bq6BDyFC5KNnyikS2uTs" + }, + { + "__type__": "cc.Node", + "_name": "Slider", + "_objFlags": 0, + "_parent": { + "__id__": 45 + }, + "_children": [ + { + "__id__": 49 + }, + { + "__id__": 51 + } + ], + "_active": true, + "_components": [ + { + "__id__": 54 + } + ], + "_prefab": null, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 300, + "height": 20 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + -149.99999999999994, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1 + ] + }, + "_eulerAngles": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_skewX": 0, + "_skewY": 0, + "_is3DNode": false, + "_groupIndex": 0, + "groupIndex": 0, + "_id": "37QFwiFDZBaZK7nzeeNFun" + }, + { + "__type__": "cc.Node", + "_name": "Background", + "_objFlags": 0, + "_parent": { + "__id__": 48 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 50 + } + ], + "_prefab": null, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 300, + "height": 20 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1 + ] + }, + "_eulerAngles": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_skewX": 0, + "_skewY": 0, + "_is3DNode": false, + "_groupIndex": 0, + "groupIndex": 0, + "_id": "27U7JP0etD05nPaxaY5BWG" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 49 + }, + "_enabled": true, + "_materials": [ + { + "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432" + } + ], + "_srcBlendFactor": 770, + "_dstBlendFactor": 771, + "_spriteFrame": { + "__uuid__": "31d8962d-babb-4ec7-be19-8e9f54a4ea99" + }, + "_type": 1, + "_sizeMode": 0, + "_fillType": 0, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": true, + "_atlas": null, + "_id": "d6FF02ZXRM64bpfTSyx54m" + }, + { + "__type__": "cc.Node", + "_name": "Handle", + "_objFlags": 0, + "_parent": { + "__id__": 48 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 52 + }, + { + "__id__": 53 + } + ], + "_prefab": null, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 32, + "height": 32 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + 149.99999999999994, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1 + ] + }, + "_eulerAngles": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_skewX": 0, + "_skewY": 0, + "_is3DNode": false, + "_groupIndex": 0, + "groupIndex": 0, + "_id": "c6XaonTwlIiaTyN5xcc1/L" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 51 + }, + "_enabled": true, + "_materials": [ + { + "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432" + } + ], + "_srcBlendFactor": 770, + "_dstBlendFactor": 771, + "_spriteFrame": { + "__uuid__": "e7aba14b-f956-4480-b254-8d57832e273f" + }, + "_type": 1, + "_sizeMode": 2, + "_fillType": 0, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": true, + "_atlas": null, + "_id": "5djy3TMkdGvL6GwhWCtsFe" + }, + { + "__type__": "cc.Button", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 51 + }, + "_enabled": true, + "_normalMaterial": null, + "_grayMaterial": null, + "duration": 0.1, + "zoomScale": 1.1, + "clickEvents": [], + "_N$interactable": true, + "_N$enableAutoGrayEffect": true, + "_N$transition": 3, + "transition": 3, + "_N$normalColor": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_N$pressedColor": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "pressedColor": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_N$hoverColor": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "hoverColor": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_N$disabledColor": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_N$normalSprite": { + "__uuid__": "e7aba14b-f956-4480-b254-8d57832e273f" + }, + "_N$pressedSprite": { + "__uuid__": "e7aba14b-f956-4480-b254-8d57832e273f" + }, + "pressedSprite": { + "__uuid__": "e7aba14b-f956-4480-b254-8d57832e273f" + }, + "_N$hoverSprite": { + "__uuid__": "e7aba14b-f956-4480-b254-8d57832e273f" + }, + "hoverSprite": { + "__uuid__": "e7aba14b-f956-4480-b254-8d57832e273f" + }, + "_N$disabledSprite": { + "__uuid__": "29158224-f8dd-4661-a796-1ffab537140e" + }, + "_N$target": { + "__id__": 51 + }, + "_id": "acT89hk6xLuKbrpKdJpYd5" + }, + { + "__type__": "cc.Slider", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 48 + }, + "_enabled": true, + "direction": 0, + "slideEvents": [], + "_N$handle": { + "__id__": 53 + }, + "_N$progress": 1, + "_id": "9aeUKzsglOTpbXM6jdaRcX" + }, + { + "__type__": "cc.Widget", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 45 + }, + "_enabled": true, + "alignMode": 1, + "_target": null, + "_alignFlags": 32, + "_left": 0, + "_right": 0.15, + "_top": 0, + "_bottom": 0, + "_verticalCenter": 0, + "_horizontalCenter": 0, + "_isAbsLeft": true, + "_isAbsRight": false, + "_isAbsTop": true, + "_isAbsBottom": true, + "_isAbsHorizontalCenter": true, + "_isAbsVerticalCenter": true, + "_originalWidth": 0, + "_originalHeight": 0, + "_id": "daZ+n3F0JH5JogFUVAIRGC" + }, + { + "__type__": "cc.Layout", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 45 + }, + "_enabled": true, + "_layoutSize": { + "__type__": "cc.Size", + "width": 490.3, + "height": 60 + }, + "_resize": 1, + "_N$layoutType": 1, + "_N$padding": 0, + "_N$cellSize": { + "__type__": "cc.Size", + "width": 40, + "height": 40 + }, + "_N$startAxis": 0, + "_N$paddingLeft": 0, + "_N$paddingRight": 0, + "_N$paddingTop": 0, + "_N$paddingBottom": 0, + "_N$spacingX": 48, + "_N$spacingY": 0, + "_N$verticalDirection": 1, + "_N$horizontalDirection": 0, + "_N$affectedByScale": false, + "_id": "01uRyMdHVAUb43Ran0ph7t" + }, + { + "__type__": "cc.Node", + "_name": "WidthSlider", + "_objFlags": 0, + "_parent": { + "__id__": 8 + }, + "_children": [ + { + "__id__": 58 + }, + { + "__id__": 60 + } + ], + "_active": true, + "_components": [ + { + "__id__": 67 + }, + { + "__id__": 68 + } + ], + "_prefab": null, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 548, + "height": 60 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 1, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + 235.2, + -414, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1 + ] + }, + "_eulerAngles": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_skewX": 0, + "_skewY": 0, + "_is3DNode": false, + "_groupIndex": 0, + "groupIndex": 0, + "_id": "11ZCsp/hhAnoxRSLqdlROB" + }, + { + "__type__": "cc.Node", + "_name": "SliderDescLabel", + "_objFlags": 0, + "_parent": { + "__id__": 57 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 59 + } + ], + "_prefab": null, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 200, + "height": 50.4 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 1, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + -348, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1 + ] + }, + "_eulerAngles": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_skewX": 0, + "_skewY": 0, + "_is3DNode": false, + "_groupIndex": 0, + "groupIndex": 0, + "_id": "a8mK6UowJOqLvmjfPIiuTZ" + }, + { + "__type__": "cc.Label", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 58 + }, + "_enabled": true, + "_materials": [ + { + "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432" + } + ], + "_useOriginalSize": false, + "_string": "发光宽度:", + "_N$string": "发光宽度:", + "_fontSize": 40, + "_lineHeight": 40, + "_enableWrapText": true, + "_N$file": null, + "_isSystemFontUsed": true, + "_spacingX": 0, + "_batchAsBitmap": false, + "_N$horizontalAlign": 1, + "_N$verticalAlign": 1, + "_N$fontFamily": "Arial", + "_N$overflow": 0, + "_N$cacheMode": 0, + "_id": "5aqqaNVJNJsqy4cwZGvqW5" + }, + { + "__type__": "cc.Node", + "_name": "Slider", + "_objFlags": 0, + "_parent": { + "__id__": 57 + }, + "_children": [ + { + "__id__": 61 + }, + { + "__id__": 63 + } + ], + "_active": true, + "_components": [ + { + "__id__": 66 + } + ], + "_prefab": null, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 300, + "height": 20 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + -150, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1 + ] + }, + "_eulerAngles": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_skewX": 0, + "_skewY": 0, + "_is3DNode": false, + "_groupIndex": 0, + "groupIndex": 0, + "_id": "e3WHmNWolODK/k/BUhp8n+" + }, + { + "__type__": "cc.Node", + "_name": "Background", + "_objFlags": 0, + "_parent": { + "__id__": 60 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 62 + } + ], + "_prefab": null, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 300, + "height": 20 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1 + ] + }, + "_eulerAngles": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_skewX": 0, + "_skewY": 0, + "_is3DNode": false, + "_groupIndex": 0, + "groupIndex": 0, + "_id": "4e4s7CtEpIPYADvmHwxDSt" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 61 + }, + "_enabled": true, + "_materials": [ + { + "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432" + } + ], + "_srcBlendFactor": 770, + "_dstBlendFactor": 771, + "_spriteFrame": { + "__uuid__": "31d8962d-babb-4ec7-be19-8e9f54a4ea99" + }, + "_type": 1, + "_sizeMode": 0, + "_fillType": 0, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": true, + "_atlas": null, + "_id": "fc/wnYCLxJKrZ8PoMA1CYw" + }, + { + "__type__": "cc.Node", + "_name": "Handle", + "_objFlags": 0, + "_parent": { + "__id__": 60 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 64 + }, + { + "__id__": 65 + } + ], + "_prefab": null, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 32, + "height": 32 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1 + ] + }, + "_eulerAngles": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_skewX": 0, + "_skewY": 0, + "_is3DNode": false, + "_groupIndex": 0, + "groupIndex": 0, + "_id": "cboGZ4mmtC7Z7ZvWnGXRab" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 63 + }, + "_enabled": true, + "_materials": [ + { + "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432" + } + ], + "_srcBlendFactor": 770, + "_dstBlendFactor": 771, + "_spriteFrame": { + "__uuid__": "e7aba14b-f956-4480-b254-8d57832e273f" + }, + "_type": 1, + "_sizeMode": 2, + "_fillType": 0, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": true, + "_atlas": null, + "_id": "eeIzXLXopG3Ypab6LDsHxh" + }, + { + "__type__": "cc.Button", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 63 + }, + "_enabled": true, + "_normalMaterial": null, + "_grayMaterial": null, + "duration": 0.1, + "zoomScale": 1.1, + "clickEvents": [], + "_N$interactable": true, + "_N$enableAutoGrayEffect": true, + "_N$transition": 3, + "transition": 3, + "_N$normalColor": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_N$pressedColor": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "pressedColor": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_N$hoverColor": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "hoverColor": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_N$disabledColor": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_N$normalSprite": { + "__uuid__": "e7aba14b-f956-4480-b254-8d57832e273f" + }, + "_N$pressedSprite": { + "__uuid__": "e7aba14b-f956-4480-b254-8d57832e273f" + }, + "pressedSprite": { + "__uuid__": "e7aba14b-f956-4480-b254-8d57832e273f" + }, + "_N$hoverSprite": { + "__uuid__": "e7aba14b-f956-4480-b254-8d57832e273f" + }, + "hoverSprite": { + "__uuid__": "e7aba14b-f956-4480-b254-8d57832e273f" + }, + "_N$disabledSprite": { + "__uuid__": "29158224-f8dd-4661-a796-1ffab537140e" + }, + "_N$target": { + "__id__": 63 }, "_id": "f8CMhOw3JJrJn6+CKLopHY" }, @@ -871,43 +3280,56 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 11 + "__id__": 60 }, "_enabled": true, "direction": 0, - "slideEvents": [ - { - "__id__": 18 - } - ], + "slideEvents": [], "_N$handle": { - "__id__": 16 + "__id__": 65 }, - "_N$progress": 0, + "_N$progress": 0.5, "_id": "69kbIKMEFE4ISodttSO13M" }, { - "__type__": "cc.ClickEvent", - "target": { - "__id__": 2 + "__type__": "cc.Widget", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 57 }, - "component": "", - "_componentId": "eebe5Fr5bhMO7IsowoLW/Yp", - "handler": "onSideCallBack", - "customEventData": "" + "_enabled": true, + "alignMode": 1, + "_target": null, + "_alignFlags": 32, + "_left": 0, + "_right": 0.15, + "_top": 0, + "_bottom": 0, + "_verticalCenter": 0, + "_horizontalCenter": 0, + "_isAbsLeft": true, + "_isAbsRight": false, + "_isAbsTop": true, + "_isAbsBottom": true, + "_isAbsHorizontalCenter": true, + "_isAbsVerticalCenter": true, + "_originalWidth": 0, + "_originalHeight": 0, + "_id": "041mI8XB9PgI4sIACdk3eA" }, { "__type__": "cc.Layout", "_name": "", "_objFlags": 0, "node": { - "__id__": 8 + "__id__": 57 }, "_enabled": true, "_layoutSize": { "__type__": "cc.Size", "width": 548, - "height": 150 + "height": 60 }, "_resize": 1, "_N$layoutType": 1, @@ -939,51 +3361,84 @@ "_enabled": true, "alignMode": 1, "_target": null, - "_alignFlags": 8, - "_left": 0.15, - "_right": 0, - "_top": 0, - "_bottom": 0, + "_alignFlags": 40, + "_left": 0, + "_right": 0.3, + "_top": 48, + "_bottom": 0.23125, "_verticalCenter": 0, "_horizontalCenter": 0, - "_isAbsLeft": false, - "_isAbsRight": true, + "_isAbsLeft": true, + "_isAbsRight": false, "_isAbsTop": true, - "_isAbsBottom": true, + "_isAbsBottom": false, "_isAbsHorizontalCenter": true, "_isAbsVerticalCenter": true, "_originalWidth": 0, - "_originalHeight": 0, - "_id": "47RYUMeTFP0bPLCO+5W3tH" + "_originalHeight": 444, + "_id": "e7Os7KkLlEeLOPd7JQzY4j" + }, + { + "__type__": "cc.Layout", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 8 + }, + "_enabled": true, + "_layoutSize": { + "__type__": "cc.Size", + "width": 672, + "height": 444 + }, + "_resize": 1, + "_N$layoutType": 2, + "_N$padding": 0, + "_N$cellSize": { + "__type__": "cc.Size", + "width": 40, + "height": 40 + }, + "_N$startAxis": 0, + "_N$paddingLeft": 0, + "_N$paddingRight": 0, + "_N$paddingTop": 0, + "_N$paddingBottom": 0, + "_N$spacingX": 0, + "_N$spacingY": 36, + "_N$verticalDirection": 1, + "_N$horizontalDirection": 0, + "_N$affectedByScale": false, + "_id": "dcesuWs1ZLArYMt73TQ8nN" }, { "__type__": "cc.Node", - "_name": "Layout", + "_name": "Examples", "_objFlags": 0, "_parent": { "__id__": 2 }, "_children": [ { - "__id__": 22 + "__id__": 72 }, { - "__id__": 24 + "__id__": 75 }, { - "__id__": 26 + "__id__": 78 }, { - "__id__": 28 + "__id__": 81 } ], "_active": true, "_components": [ { - "__id__": 30 + "__id__": 84 }, { - "__id__": 31 + "__id__": 85 } ], "_prefab": null, @@ -997,20 +3452,20 @@ }, "_contentSize": { "__type__": "cc.Size", - "width": 509, - "height": 0 + "width": 384, + "height": 584 }, "_anchorPoint": { "__type__": "cc.Vec2", "x": 0.5, - "y": 0.5 + "y": 1 }, "_trs": { "__type__": "TypedArray", "ctor": "Float64Array", "array": [ - -43.335000000000036, - -63.427, + 288, + 272, 0, 0, 0, @@ -1036,16 +3491,143 @@ }, { "__type__": "cc.Node", - "_name": "ExampleSprite", + "_name": "ball_0", "_objFlags": 0, "_parent": { - "__id__": 21 + "__id__": 71 }, "_children": [], "_active": true, "_components": [ { - "__id__": 23 + "__id__": 73 + }, + { + "__id__": 74 + } + ], + "_prefab": null, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 60, + "height": 60 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + 0, + -30, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1 + ] + }, + "_eulerAngles": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_skewX": 0, + "_skewY": 0, + "_is3DNode": false, + "_groupIndex": 0, + "groupIndex": 0, + "_id": "49czqIEPBHr6kLJbb+kN8/" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 72 + }, + "_enabled": true, + "_materials": [ + { + "__uuid__": "2c760728-404d-4553-a1d0-7ab18263845c" + } + ], + "_srcBlendFactor": 770, + "_dstBlendFactor": 771, + "_spriteFrame": { + "__uuid__": "d0b78623-4e79-4de1-b1d2-ea211bf4652c" + }, + "_type": 0, + "_sizeMode": 1, + "_fillType": 0, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": true, + "_atlas": null, + "_id": "94vIBMHVlAN4EGbkr2wRvX" + }, + { + "__type__": "cc.Widget", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 72 + }, + "_enabled": true, + "alignMode": 1, + "_target": null, + "_alignFlags": 16, + "_left": 0, + "_right": 0, + "_top": 0, + "_bottom": 0, + "_verticalCenter": 0, + "_horizontalCenter": 0, + "_isAbsLeft": true, + "_isAbsRight": true, + "_isAbsTop": true, + "_isAbsBottom": true, + "_isAbsHorizontalCenter": true, + "_isAbsVerticalCenter": true, + "_originalWidth": 0, + "_originalHeight": 0, + "_id": "c2R02zD6FJWbRRKfsWc+5P" + }, + { + "__type__": "cc.Node", + "_name": "cocos_logo", + "_objFlags": 0, + "_parent": { + "__id__": 71 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 76 + }, + { + "__id__": 77 } ], "_prefab": null, @@ -1071,8 +3653,8 @@ "__type__": "TypedArray", "ctor": "Float64Array", "array": [ - -157, 0, + -243, 0, 0, 0, @@ -1094,14 +3676,14 @@ "_is3DNode": false, "_groupIndex": 0, "groupIndex": 0, - "_id": "c4f30YOS65G64U2TwufdJ+2" + "_id": "25JHa6EcNEBZ1hoesQM1Q4" }, { "__type__": "cc.Sprite", "_name": "", "_objFlags": 0, "node": { - "__id__": 22 + "__id__": 75 }, "_enabled": true, "_materials": [ @@ -1126,20 +3708,174 @@ "_fillRange": 0, "_isTrimmedMode": true, "_atlas": null, - "_id": "c5wu68mipC4qBjTD+u0rFa" + "_id": "74+WCqN01NIbcSpr5gcxmE" + }, + { + "__type__": "cc.Widget", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 75 + }, + "_enabled": true, + "alignMode": 1, + "_target": null, + "_alignFlags": 16, + "_left": 0, + "_right": 0, + "_top": 60, + "_bottom": 0, + "_verticalCenter": 0, + "_horizontalCenter": 0, + "_isAbsLeft": true, + "_isAbsRight": true, + "_isAbsTop": true, + "_isAbsBottom": true, + "_isAbsHorizontalCenter": true, + "_isAbsVerticalCenter": true, + "_originalWidth": 0, + "_originalHeight": 0, + "_id": "edEKpqZyRGTYfw+r3bBtzV" }, { "__type__": "cc.Node", - "_name": "start_0", + "_name": "ball_1", "_objFlags": 0, "_parent": { - "__id__": 21 + "__id__": 71 }, "_children": [], "_active": true, "_components": [ { - "__id__": 25 + "__id__": 79 + }, + { + "__id__": 80 + } + ], + "_prefab": null, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 60, + "height": 60 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + 0, + -456, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1 + ] + }, + "_eulerAngles": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_skewX": 0, + "_skewY": 0, + "_is3DNode": false, + "_groupIndex": 0, + "groupIndex": 0, + "_id": "08wsP0gQdCnrq+UzPWkn0+" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 78 + }, + "_enabled": true, + "_materials": [ + { + "__uuid__": "2c760728-404d-4553-a1d0-7ab18263845c" + } + ], + "_srcBlendFactor": 770, + "_dstBlendFactor": 771, + "_spriteFrame": { + "__uuid__": "969fa66a-ae10-4157-b16e-4c1a4665920c" + }, + "_type": 0, + "_sizeMode": 1, + "_fillType": 0, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": true, + "_atlas": null, + "_id": "4bH5hzKe9LsLQeXjLynIHQ" + }, + { + "__type__": "cc.Widget", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 78 + }, + "_enabled": true, + "alignMode": 1, + "_target": null, + "_alignFlags": 16, + "_left": 0, + "_right": 0, + "_top": 0, + "_bottom": 0, + "_verticalCenter": 0, + "_horizontalCenter": 0, + "_isAbsLeft": true, + "_isAbsRight": true, + "_isAbsTop": true, + "_isAbsBottom": true, + "_isAbsHorizontalCenter": true, + "_isAbsVerticalCenter": true, + "_originalWidth": 0, + "_originalHeight": 0, + "_id": "b0cIibhqpDE4frsR3khU/c" + }, + { + "__type__": "cc.Node", + "_name": "video_btn", + "_objFlags": 0, + "_parent": { + "__id__": 71 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 82 + }, + { + "__id__": 83 } ], "_prefab": null, @@ -1165,8 +3901,8 @@ "__type__": "TypedArray", "ctor": "Float64Array", "array": [ - 13.5, 0, + -559, 0, 0, 0, @@ -1188,14 +3924,14 @@ "_is3DNode": false, "_groupIndex": 0, "groupIndex": 0, - "_id": "4bo6rvkTlF5rMMdsguMMH3" + "_id": "c73V7fMuVE0aD5fGtmyzmF" }, { "__type__": "cc.Sprite", "_name": "", "_objFlags": 0, "node": { - "__id__": 24 + "__id__": 81 }, "_enabled": true, "_materials": [ @@ -1220,211 +3956,77 @@ "_fillRange": 0, "_isTrimmedMode": true, "_atlas": null, - "_id": "59FQF0oT5EwKmj0nBbaZdm" + "_id": "f43fJCjNdOS5VHAEhp0yDU" }, { - "__type__": "cc.Node", - "_name": "ball_00", - "_objFlags": 0, - "_parent": { - "__id__": 21 - }, - "_children": [], - "_active": true, - "_components": [ - { - "__id__": 27 - } - ], - "_prefab": null, - "_opacity": 255, - "_color": { - "__type__": "cc.Color", - "r": 255, - "g": 255, - "b": 255, - "a": 255 - }, - "_contentSize": { - "__type__": "cc.Size", - "width": 60, - "height": 60 - }, - "_anchorPoint": { - "__type__": "cc.Vec2", - "x": 0.5, - "y": 0.5 - }, - "_trs": { - "__type__": "TypedArray", - "ctor": "Float64Array", - "array": [ - 116.5, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1 - ] - }, - "_eulerAngles": { - "__type__": "cc.Vec3", - "x": 0, - "y": 0, - "z": 0 - }, - "_skewX": 0, - "_skewY": 0, - "_is3DNode": false, - "_groupIndex": 0, - "groupIndex": 0, - "_id": "7e02DWsH9JIajxCtAZc1ug" - }, - { - "__type__": "cc.Sprite", + "__type__": "cc.Widget", "_name": "", "_objFlags": 0, "node": { - "__id__": 26 + "__id__": 81 }, "_enabled": true, - "_materials": [ - { - "__uuid__": "2c760728-404d-4553-a1d0-7ab18263845c" - } - ], - "_srcBlendFactor": 770, - "_dstBlendFactor": 771, - "_spriteFrame": { - "__uuid__": "d0b78623-4e79-4de1-b1d2-ea211bf4652c" - }, - "_type": 0, - "_sizeMode": 1, - "_fillType": 0, - "_fillCenter": { - "__type__": "cc.Vec2", - "x": 0, - "y": 0 - }, - "_fillStart": 0, - "_fillRange": 0, - "_isTrimmedMode": true, - "_atlas": null, - "_id": "24JG5wcHpMbKwEVWPmOT/7" + "alignMode": 1, + "_target": null, + "_alignFlags": 16, + "_left": 0, + "_right": 0, + "_top": 0, + "_bottom": 0, + "_verticalCenter": -195, + "_horizontalCenter": 0, + "_isAbsLeft": true, + "_isAbsRight": true, + "_isAbsTop": true, + "_isAbsBottom": true, + "_isAbsHorizontalCenter": true, + "_isAbsVerticalCenter": true, + "_originalWidth": 0, + "_originalHeight": 0, + "_id": "27r/pOzQhOrJIV7E87RRJH" }, { - "__type__": "cc.Node", - "_name": "prestige_04_big", - "_objFlags": 0, - "_parent": { - "__id__": 21 - }, - "_children": [], - "_active": true, - "_components": [ - { - "__id__": 29 - } - ], - "_prefab": null, - "_opacity": 255, - "_color": { - "__type__": "cc.Color", - "r": 255, - "g": 255, - "b": 255, - "a": 255 - }, - "_contentSize": { - "__type__": "cc.Size", - "width": 60, - "height": 60 - }, - "_anchorPoint": { - "__type__": "cc.Vec2", - "x": 0.5, - "y": 0.5 - }, - "_trs": { - "__type__": "TypedArray", - "ctor": "Float64Array", - "array": [ - 224.5, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1 - ] - }, - "_eulerAngles": { - "__type__": "cc.Vec3", - "x": 0, - "y": 0, - "z": 0 - }, - "_skewX": 0, - "_skewY": 0, - "_is3DNode": false, - "_groupIndex": 0, - "groupIndex": 0, - "_id": "b1QYdYwQ1GIbxm/N2yRRUD" - }, - { - "__type__": "cc.Sprite", + "__type__": "cc.Widget", "_name": "", "_objFlags": 0, "node": { - "__id__": 28 + "__id__": 71 }, "_enabled": true, - "_materials": [ - { - "__uuid__": "2c760728-404d-4553-a1d0-7ab18263845c" - } - ], - "_srcBlendFactor": 770, - "_dstBlendFactor": 771, - "_spriteFrame": { - "__uuid__": "969fa66a-ae10-4157-b16e-4c1a4665920c" - }, - "_type": 0, - "_sizeMode": 1, - "_fillType": 0, - "_fillCenter": { - "__type__": "cc.Vec2", - "x": 0, - "y": 0 - }, - "_fillStart": 0, - "_fillRange": 0, - "_isTrimmedMode": true, - "_atlas": null, - "_id": "75+LzaMdNGFbA4yyUIIz9s" + "alignMode": 1, + "_target": null, + "_alignFlags": 41, + "_left": 0.6, + "_right": 0, + "_top": 48, + "_bottom": 48, + "_verticalCenter": 0, + "_horizontalCenter": 0, + "_isAbsLeft": false, + "_isAbsRight": true, + "_isAbsTop": true, + "_isAbsBottom": true, + "_isAbsHorizontalCenter": true, + "_isAbsVerticalCenter": true, + "_originalWidth": 509, + "_originalHeight": 0, + "_id": "80mVZhmc1LHYCtsbpy1Jnu" }, { "__type__": "cc.Layout", "_name": "", "_objFlags": 0, "node": { - "__id__": 21 + "__id__": 71 }, "_enabled": true, "_layoutSize": { "__type__": "cc.Size", - "width": 509, - "height": 0 + "width": 384, + "height": 584 }, "_resize": 1, - "_N$layoutType": 1, + "_N$layoutType": 2, "_N$padding": 0, "_N$cellSize": { "__type__": "cc.Size", @@ -1437,39 +4039,12 @@ "_N$paddingTop": 0, "_N$paddingBottom": 0, "_N$spacingX": 48, - "_N$spacingY": 0, + "_N$spacingY": 48, "_N$verticalDirection": 1, "_N$horizontalDirection": 0, "_N$affectedByScale": false, "_id": "ff9z0nF9BGm5zFMuGhj1jt" }, - { - "__type__": "cc.Widget", - "_name": "", - "_objFlags": 0, - "node": { - "__id__": 21 - }, - "_enabled": true, - "alignMode": 1, - "_target": null, - "_alignFlags": 8, - "_left": 0.18975520833333331, - "_right": 0, - "_top": 0, - "_bottom": 0, - "_verticalCenter": 0, - "_horizontalCenter": 0, - "_isAbsLeft": false, - "_isAbsRight": true, - "_isAbsTop": true, - "_isAbsBottom": true, - "_isAbsHorizontalCenter": true, - "_isAbsVerticalCenter": true, - "_originalWidth": 0, - "_originalHeight": 0, - "_id": "a4H/CsfipEB73tJmLtFf9/" - }, { "__type__": "cc.Canvas", "_name": "", @@ -1483,7 +4058,7 @@ "width": 960, "height": 640 }, - "_fitWidth": false, + "_fitWidth": true, "_fitHeight": true, "_id": "4bz2+ak99DBYVlSVIMFGN0" }, @@ -1495,9 +4070,6 @@ "__id__": 2 }, "_enabled": true, - "examplesParentNode": { - "__id__": 21 - }, "_id": "1a7ypfDW1DQqGMHUC5Sf0L" } ] \ No newline at end of file diff --git a/assets/scripts/GlowInnerEffectScene.ts b/assets/scripts/GlowInnerEffectScene.ts index a67bff4..4913f86 100644 --- a/assets/scripts/GlowInnerEffectScene.ts +++ b/assets/scripts/GlowInnerEffectScene.ts @@ -2,15 +2,47 @@ const { ccclass, property } = cc._decorator; @ccclass export default class GlowInnerEffectScene extends cc.Component { - @property(cc.Node) - examplesParentNode: cc.Node = null; + private _redSlider: cc.Slider = null; + private _greenSlider: cc.Slider = null; + private _blueSlider: cc.Slider = null; + private _alphaSlider: cc.Slider = null; + private _widthSlider: cc.Slider = null; + private _examplesParentNode: cc.Node = null; - start() { - this._updateRenderComponentOutterGlowMaterial(0); + onLoad() { + this._redSlider = cc.find("Canvas/SliderLayouts/RedSlider/Slider").getComponent(cc.Slider); + this._greenSlider = cc.find("Canvas/SliderLayouts/GreenSlider/Slider").getComponent(cc.Slider); + this._blueSlider = cc.find("Canvas/SliderLayouts/BlueSlider/Slider").getComponent(cc.Slider); + this._alphaSlider = cc.find("Canvas/SliderLayouts/AlphaSlider/Slider").getComponent(cc.Slider); + this._widthSlider = cc.find("Canvas/SliderLayouts/WidthSlider/Slider").getComponent(cc.Slider); + this._examplesParentNode = cc.find("Canvas/Examples"); } - onSideCallBack(slider: cc.Slider, customEventData: string) { - this._updateRenderComponentOutterGlowMaterial(slider.progress / 100); + onEnable() { + this._redSlider.node.on("slide", this._onSliderChanged, this); + this._greenSlider.node.on("slide", this._onSliderChanged, this); + this._blueSlider.node.on("slide", this._onSliderChanged, this); + this._alphaSlider.node.on("slide", this._onSliderChanged, this); + this._widthSlider.node.on("slide", this._onSliderChanged, this); + } + + onDisable() { + this._redSlider.node.off("slide", this._onSliderChanged, this); + this._greenSlider.node.off("slide", this._onSliderChanged, this); + this._blueSlider.node.off("slide", this._onSliderChanged, this); + this._alphaSlider.node.off("slide", this._onSliderChanged, this); + this._widthSlider.node.off("slide", this._onSliderChanged, this); + } + + start() { + this._onSliderChanged(); + } + + private _onSliderChanged() { + this._updateRenderComponentOutterGlowMaterial({ + glowColor: cc.v4(this._redSlider.progress, this._greenSlider.progress, this._blueSlider.progress, this._alphaSlider.progress), + glowColorSize: this._widthSlider.progress / 100 + }); } /** @@ -19,14 +51,23 @@ export default class GlowInnerEffectScene extends cc.Component { * 1. 获取材质 * 2. 给材质的自定义 unitform 变量赋值 * 3. 重新将材质赋值回去 - * - * @param size 描边长度比例[0,1] 比如0.5,那么就是宽*0.5 高*0.5 */ - private _updateRenderComponentOutterGlowMaterial(size: number) { - this.examplesParentNode.children.forEach(childNode => { + private _updateRenderComponentOutterGlowMaterial(param: { + /** + * 发光宽度 [0.0, 1.0] + */ + glowColorSize: number; + + /** + * 发光颜色 [0.0, 1.0] + */ + glowColor: cc.Vec4; + }) { + this._examplesParentNode.children.forEach(childNode => { childNode.getComponents(cc.RenderComponent).forEach(renderComponent => { let material: cc.Material = renderComponent.getMaterial(0); - material.setProperty("glowColorSize", size); + material.setProperty("glowColorSize", param.glowColorSize); + material.setProperty("glowColor", param.glowColor); renderComponent.setMaterial(0, material); }); }); diff --git a/assets/textures/ball_00.png b/assets/textures/ball_0.png similarity index 100% rename from assets/textures/ball_00.png rename to assets/textures/ball_0.png diff --git a/assets/textures/ball_00.png.meta b/assets/textures/ball_0.png.meta similarity index 97% rename from assets/textures/ball_00.png.meta rename to assets/textures/ball_0.png.meta index 7e70c4e..0cead14 100644 --- a/assets/textures/ball_00.png.meta +++ b/assets/textures/ball_0.png.meta @@ -9,7 +9,7 @@ "packable": true, "platformSettings": {}, "subMetas": { - "ball_00": { + "ball_0": { "ver": "1.0.4", "uuid": "d0b78623-4e79-4de1-b1d2-ea211bf4652c", "rawTextureUuid": "c996c862-3d09-4bc6-915d-e8a8e7226933", diff --git a/assets/textures/prestige_04_big.png b/assets/textures/ball_1.png similarity index 100% rename from assets/textures/prestige_04_big.png rename to assets/textures/ball_1.png diff --git a/assets/textures/prestige_04_big.png.meta b/assets/textures/ball_1.png.meta similarity index 96% rename from assets/textures/prestige_04_big.png.meta rename to assets/textures/ball_1.png.meta index f64c4d3..b9cef08 100644 --- a/assets/textures/prestige_04_big.png.meta +++ b/assets/textures/ball_1.png.meta @@ -9,7 +9,7 @@ "packable": true, "platformSettings": {}, "subMetas": { - "prestige_04_big": { + "ball_1": { "ver": "1.0.4", "uuid": "969fa66a-ae10-4157-b16e-4c1a4665920c", "rawTextureUuid": "bdfd3151-8c13-406b-8f94-1f101c972e7e", diff --git a/assets/textures/start_0.png b/assets/textures/video_btn.png similarity index 100% rename from assets/textures/start_0.png rename to assets/textures/video_btn.png diff --git a/assets/textures/start_0.png.meta b/assets/textures/video_btn.png.meta similarity index 97% rename from assets/textures/start_0.png.meta rename to assets/textures/video_btn.png.meta index 10d5898..e89ca29 100644 --- a/assets/textures/start_0.png.meta +++ b/assets/textures/video_btn.png.meta @@ -9,7 +9,7 @@ "packable": true, "platformSettings": {}, "subMetas": { - "start_0": { + "video_btn": { "ver": "1.0.4", "uuid": "54142b08-a163-426e-a75e-4c7b21046413", "rawTextureUuid": "2453b01d-4364-4d87-ab53-391d1a42d07d", diff --git a/creator.d.ts b/creator.d.ts index c4b806a..88cbd5e 100644 --- a/creator.d.ts +++ b/creator.d.ts @@ -1633,7 +1633,7 @@ declare namespace cc { var v4 = cc.v4({x: 100, y: 100, z: 0}); ``` */ - export function v4(x?: number|any, y?: number, z?: number): Vec4; + export function v4(x?: number|any, y?: number, z?: number, w?: number): Vec4; export var dynamicAtlasManager: DynamicAtlasManager; /** !#en cc.NodePool is the cache pool designed for node type.
From 6d9bd2c8ceae9670183311c71c3e49a9396ab763 Mon Sep 17 00:00:00 2001 From: caizhitao Date: Fri, 20 Dec 2019 16:11:45 +0800 Subject: [PATCH 07/24] =?UTF-8?q?=E5=AE=8C=E5=96=84=E5=86=85=E5=8F=91?= =?UTF-8?q?=E5=85=89=E6=95=88=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/effects/glow-inner.effect | 2 ++ assets/effects/glow-inner.effect.meta | 4 ++-- assets/materials/glow-inner.mtl | 6 +++--- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/assets/effects/glow-inner.effect b/assets/effects/glow-inner.effect index 276e0ec..2335079 100644 --- a/assets/effects/glow-inner.effect +++ b/assets/effects/glow-inner.effect @@ -171,6 +171,8 @@ CCProgram fs %{ // 因此我们取0.1作为翻转临界值,0.1也不是绝对的,可以自行修改这里的值 if (alpha > 0.1) { alpha = 1.0 - alpha; + // 给点调料,让靠近边缘的更加亮 + alpha = -1.0 * (alpha - 1.0) * (alpha - 1.0) * (alpha - 1.0) * (alpha - 1.0) + 1.0; } vec4 color_src = glowColor * alpha; diff --git a/assets/effects/glow-inner.effect.meta b/assets/effects/glow-inner.effect.meta index 2acf658..d641606 100644 --- a/assets/effects/glow-inner.effect.meta +++ b/assets/effects/glow-inner.effect.meta @@ -5,11 +5,11 @@ { "glsl1": { "vert": "\nprecision highp float;\nuniform mat4 cc_matViewProj;\nuniform mat4 cc_matWorld;\n\nattribute vec3 a_position;\nattribute vec4 a_color;\nvarying vec4 v_color;\n\n#if USE_TEXTURE\nattribute vec2 a_uv0;\nvarying vec2 v_uv0;\n#endif\n\nvoid main () {\n vec4 pos = vec4(a_position, 1);\n\n #if CC_USE_MODEL\n pos = cc_matViewProj * cc_matWorld * pos;\n #else\n pos = cc_matViewProj * pos;\n #endif\n\n #if USE_TEXTURE\n v_uv0 = a_uv0;\n #endif\n\n v_color = a_color;\n\n gl_Position = pos;\n}\n", - "frag": "\nprecision highp float;\n\n#if USE_ALPHA_TEST\n \n uniform float alphaThreshold;\n#endif\n\nvoid ALPHA_TEST (in vec4 color) {\n #if USE_ALPHA_TEST\n if (color.a < alphaThreshold) discard;\n #endif\n}\n\nvoid ALPHA_TEST (in float alpha) {\n #if USE_ALPHA_TEST\n if (alpha < alphaThreshold) discard;\n #endif\n}\n\nvarying vec4 v_color;\n\n#if USE_TEXTURE\nvarying vec2 v_uv0;\nuniform sampler2D texture;\n#endif\n\n#if SHOW_INNER_GLOW\n\nuniform vec4 glowColor;\nuniform float glowColorSize;\n\n/**\n * 获取指定角度方向,距离为xxx的像素的透明度\n *\n * @param angle 角度 [0.0, 360.0]\n * @param distance 距离 [0.0, 1.0]\n *\n * @return alpha [0.0, 1.0]\n */\nfloat getColorAlpha(float angle, float distance) {\n\n float radian = angle * 0.01745329252;\n\n vec4 color = texture2D(texture, v_uv0 + vec2(distance * cos(radian), distance * sin(radian))); \n return color.a;\n}\n\n/**\n * 获取指定距离的周边像素的透明度平均值\n *\n * @param distance 距离 [0.0, 1.0]\n *\n * @return average alpha [0.0, 1.0]\n */\nfloat getDistanceAverageAlpha(float distance) {\n float totalAlpha = 0.0;\n totalAlpha += getColorAlpha(0.0, distance);\n totalAlpha += getColorAlpha(30.0, distance);\n totalAlpha += getColorAlpha(60.0, distance);\n totalAlpha += getColorAlpha(90.0, distance);\n totalAlpha += getColorAlpha(120.0, distance);\n totalAlpha += getColorAlpha(150.0, distance);\n totalAlpha += getColorAlpha(180.0, distance);\n totalAlpha += getColorAlpha(210.0, distance);\n totalAlpha += getColorAlpha(240.0, distance);\n totalAlpha += getColorAlpha(270.0, distance);\n totalAlpha += getColorAlpha(300.0, distance);\n totalAlpha += getColorAlpha(330.0, distance);\n return totalAlpha * (1.0 / 12.0);\n}\n\n/**\n * 获取发光的透明度\n */\nfloat getGlowAlpha() {\n\n vec4 srcColor = texture2D(texture, v_uv0);\n if (srcColor.a < 0.0000000001) {\n return srcColor.a;\n }\n\n float totalAlpha = 0.0;\n totalAlpha += getDistanceAverageAlpha(glowColorSize * 0.1);\n totalAlpha += getDistanceAverageAlpha(glowColorSize * 0.2);\n totalAlpha += getDistanceAverageAlpha(glowColorSize * 0.3);\n totalAlpha += getDistanceAverageAlpha(glowColorSize * 0.4);\n totalAlpha += getDistanceAverageAlpha(glowColorSize * 0.5);\n totalAlpha += getDistanceAverageAlpha(glowColorSize * 0.6);\n totalAlpha += getDistanceAverageAlpha(glowColorSize * 0.7);\n totalAlpha += getDistanceAverageAlpha(glowColorSize * 0.8);\n totalAlpha += getDistanceAverageAlpha(glowColorSize * 0.9);\n totalAlpha += getDistanceAverageAlpha(glowColorSize * 1.0);\n return totalAlpha * (1.0 / 10.0);\n}\n\n#endif\n\nvoid main () {\n vec4 o = vec4(1, 1, 1, 1);\n\n #if USE_TEXTURE\n o *= texture2D(texture, v_uv0);\n #if CC_USE_ALPHA_ATLAS_TEXTURE\n o.a *= texture2D(texture, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #endif\n\n o *= v_color;\n\n ALPHA_TEST(o);\n\n gl_FragColor = o;\n\n #if SHOW_INNER_GLOW\n\n vec4 color_dest = o;\n\n float alpha = getGlowAlpha();\n\n if (alpha > 0.1) {\n alpha = 1.0 - alpha;\n }\n vec4 color_src = glowColor * alpha;\n\n gl_FragColor = color_src * color_src.a + color_dest;\n #endif\n}\n" + "frag": "\nprecision highp float;\n\n#if USE_ALPHA_TEST\n \n uniform float alphaThreshold;\n#endif\n\nvoid ALPHA_TEST (in vec4 color) {\n #if USE_ALPHA_TEST\n if (color.a < alphaThreshold) discard;\n #endif\n}\n\nvoid ALPHA_TEST (in float alpha) {\n #if USE_ALPHA_TEST\n if (alpha < alphaThreshold) discard;\n #endif\n}\n\nvarying vec4 v_color;\n\n#if USE_TEXTURE\nvarying vec2 v_uv0;\nuniform sampler2D texture;\n#endif\n\n#if SHOW_INNER_GLOW\n\nuniform vec4 glowColor;\nuniform float glowColorSize;\n\n/**\n * 获取指定角度方向,距离为xxx的像素的透明度\n *\n * @param angle 角度 [0.0, 360.0]\n * @param distance 距离 [0.0, 1.0]\n *\n * @return alpha [0.0, 1.0]\n */\nfloat getColorAlpha(float angle, float distance) {\n\n float radian = angle * 0.01745329252;\n\n vec4 color = texture2D(texture, v_uv0 + vec2(distance * cos(radian), distance * sin(radian))); \n return color.a;\n}\n\n/**\n * 获取指定距离的周边像素的透明度平均值\n *\n * @param distance 距离 [0.0, 1.0]\n *\n * @return average alpha [0.0, 1.0]\n */\nfloat getDistanceAverageAlpha(float distance) {\n float totalAlpha = 0.0;\n totalAlpha += getColorAlpha(0.0, distance);\n totalAlpha += getColorAlpha(30.0, distance);\n totalAlpha += getColorAlpha(60.0, distance);\n totalAlpha += getColorAlpha(90.0, distance);\n totalAlpha += getColorAlpha(120.0, distance);\n totalAlpha += getColorAlpha(150.0, distance);\n totalAlpha += getColorAlpha(180.0, distance);\n totalAlpha += getColorAlpha(210.0, distance);\n totalAlpha += getColorAlpha(240.0, distance);\n totalAlpha += getColorAlpha(270.0, distance);\n totalAlpha += getColorAlpha(300.0, distance);\n totalAlpha += getColorAlpha(330.0, distance);\n return totalAlpha * (1.0 / 12.0);\n}\n\n/**\n * 获取发光的透明度\n */\nfloat getGlowAlpha() {\n\n vec4 srcColor = texture2D(texture, v_uv0);\n if (srcColor.a < 0.0000000001) {\n return srcColor.a;\n }\n\n float totalAlpha = 0.0;\n totalAlpha += getDistanceAverageAlpha(glowColorSize * 0.1);\n totalAlpha += getDistanceAverageAlpha(glowColorSize * 0.2);\n totalAlpha += getDistanceAverageAlpha(glowColorSize * 0.3);\n totalAlpha += getDistanceAverageAlpha(glowColorSize * 0.4);\n totalAlpha += getDistanceAverageAlpha(glowColorSize * 0.5);\n totalAlpha += getDistanceAverageAlpha(glowColorSize * 0.6);\n totalAlpha += getDistanceAverageAlpha(glowColorSize * 0.7);\n totalAlpha += getDistanceAverageAlpha(glowColorSize * 0.8);\n totalAlpha += getDistanceAverageAlpha(glowColorSize * 0.9);\n totalAlpha += getDistanceAverageAlpha(glowColorSize * 1.0);\n return totalAlpha * (1.0 / 10.0);\n}\n\n#endif\n\nvoid main () {\n vec4 o = vec4(1, 1, 1, 1);\n\n #if USE_TEXTURE\n o *= texture2D(texture, v_uv0);\n #if CC_USE_ALPHA_ATLAS_TEXTURE\n o.a *= texture2D(texture, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #endif\n\n o *= v_color;\n\n ALPHA_TEST(o);\n\n gl_FragColor = o;\n\n #if SHOW_INNER_GLOW\n\n vec4 color_dest = o;\n\n float alpha = getGlowAlpha();\n\n if (alpha > 0.1) {\n alpha = 1.0 - alpha;\n\n alpha = -1.0 * (alpha - 1.0) * (alpha - 1.0) * (alpha - 1.0) * (alpha - 1.0) + 1.0;\n }\n vec4 color_src = glowColor * alpha;\n\n gl_FragColor = color_src * color_src.a + color_dest;\n #endif\n}\n" }, "glsl3": { "vert": "\nprecision highp float;\nuniform CCGlobal {\n vec4 cc_time;\n\n vec4 cc_screenSize;\n\n vec4 cc_screenScale;\n\n vec4 cc_nativeSize;\n\n mat4 cc_matView;\n mat4 cc_matViewInv;\n mat4 cc_matProj;\n mat4 cc_matProjInv;\n mat4 cc_matViewProj;\n mat4 cc_matViewProjInv;\n vec4 cc_cameraPos;\n\n vec4 cc_exposure;\n\n vec4 cc_mainLitDir;\n\n vec4 cc_mainLitColor;\n\n vec4 cc_ambientSky;\n vec4 cc_ambientGround;\n};\nuniform CCLocal {\n mat4 cc_matWorld;\n mat4 cc_matWorldIT;\n};\n\nin vec3 a_position;\nin vec4 a_color;\nout vec4 v_color;\n\n#if USE_TEXTURE\nin vec2 a_uv0;\nout vec2 v_uv0;\n#endif\n\nvoid main () {\n vec4 pos = vec4(a_position, 1);\n\n #if CC_USE_MODEL\n pos = cc_matViewProj * cc_matWorld * pos;\n #else\n pos = cc_matViewProj * pos;\n #endif\n\n #if USE_TEXTURE\n v_uv0 = a_uv0;\n #endif\n\n v_color = a_color;\n\n gl_Position = pos;\n}\n", - "frag": "\nprecision highp float;\n\n#if USE_ALPHA_TEST\n \n uniform ALPHA_TEST {\n float alphaThreshold;\n }\n#endif\n\nvoid ALPHA_TEST (in vec4 color) {\n #if USE_ALPHA_TEST\n if (color.a < alphaThreshold) discard;\n #endif\n}\n\nvoid ALPHA_TEST (in float alpha) {\n #if USE_ALPHA_TEST\n if (alpha < alphaThreshold) discard;\n #endif\n}\n\nin vec4 v_color;\n\n#if USE_TEXTURE\nin vec2 v_uv0;\nuniform sampler2D texture;\n#endif\n\n#if SHOW_INNER_GLOW\n\nuniform glow {\n\n vec4 glowColor;\n\n float glowColorSize;\n\n};\n\n/**\n * 获取指定角度方向,距离为xxx的像素的透明度\n *\n * @param angle 角度 [0.0, 360.0]\n * @param distance 距离 [0.0, 1.0]\n *\n * @return alpha [0.0, 1.0]\n */\nfloat getColorAlpha(float angle, float distance) {\n\n float radian = angle * 0.01745329252;\n\n vec4 color = texture(texture, v_uv0 + vec2(distance * cos(radian), distance * sin(radian))); \n return color.a;\n}\n\n/**\n * 获取指定距离的周边像素的透明度平均值\n *\n * @param distance 距离 [0.0, 1.0]\n *\n * @return average alpha [0.0, 1.0]\n */\nfloat getDistanceAverageAlpha(float distance) {\n float totalAlpha = 0.0;\n totalAlpha += getColorAlpha(0.0, distance);\n totalAlpha += getColorAlpha(30.0, distance);\n totalAlpha += getColorAlpha(60.0, distance);\n totalAlpha += getColorAlpha(90.0, distance);\n totalAlpha += getColorAlpha(120.0, distance);\n totalAlpha += getColorAlpha(150.0, distance);\n totalAlpha += getColorAlpha(180.0, distance);\n totalAlpha += getColorAlpha(210.0, distance);\n totalAlpha += getColorAlpha(240.0, distance);\n totalAlpha += getColorAlpha(270.0, distance);\n totalAlpha += getColorAlpha(300.0, distance);\n totalAlpha += getColorAlpha(330.0, distance);\n return totalAlpha * (1.0 / 12.0);\n}\n\n/**\n * 获取发光的透明度\n */\nfloat getGlowAlpha() {\n\n vec4 srcColor = texture(texture, v_uv0);\n if (srcColor.a < 0.0000000001) {\n return srcColor.a;\n }\n\n float totalAlpha = 0.0;\n totalAlpha += getDistanceAverageAlpha(glowColorSize * 0.1);\n totalAlpha += getDistanceAverageAlpha(glowColorSize * 0.2);\n totalAlpha += getDistanceAverageAlpha(glowColorSize * 0.3);\n totalAlpha += getDistanceAverageAlpha(glowColorSize * 0.4);\n totalAlpha += getDistanceAverageAlpha(glowColorSize * 0.5);\n totalAlpha += getDistanceAverageAlpha(glowColorSize * 0.6);\n totalAlpha += getDistanceAverageAlpha(glowColorSize * 0.7);\n totalAlpha += getDistanceAverageAlpha(glowColorSize * 0.8);\n totalAlpha += getDistanceAverageAlpha(glowColorSize * 0.9);\n totalAlpha += getDistanceAverageAlpha(glowColorSize * 1.0);\n return totalAlpha * (1.0 / 10.0);\n}\n\n#endif\n\nvoid main () {\n vec4 o = vec4(1, 1, 1, 1);\n\n #if USE_TEXTURE\n o *= texture(texture, v_uv0);\n #if CC_USE_ALPHA_ATLAS_TEXTURE\n o.a *= texture2D(texture, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #endif\n\n o *= v_color;\n\n ALPHA_TEST(o);\n\n gl_FragColor = o;\n\n #if SHOW_INNER_GLOW\n\n vec4 color_dest = o;\n\n float alpha = getGlowAlpha();\n\n if (alpha > 0.1) {\n alpha = 1.0 - alpha;\n }\n vec4 color_src = glowColor * alpha;\n\n gl_FragColor = color_src * color_src.a + color_dest;\n #endif\n}\n" + "frag": "\nprecision highp float;\n\n#if USE_ALPHA_TEST\n \n uniform ALPHA_TEST {\n float alphaThreshold;\n }\n#endif\n\nvoid ALPHA_TEST (in vec4 color) {\n #if USE_ALPHA_TEST\n if (color.a < alphaThreshold) discard;\n #endif\n}\n\nvoid ALPHA_TEST (in float alpha) {\n #if USE_ALPHA_TEST\n if (alpha < alphaThreshold) discard;\n #endif\n}\n\nin vec4 v_color;\n\n#if USE_TEXTURE\nin vec2 v_uv0;\nuniform sampler2D texture;\n#endif\n\n#if SHOW_INNER_GLOW\n\nuniform glow {\n\n vec4 glowColor;\n\n float glowColorSize;\n\n};\n\n/**\n * 获取指定角度方向,距离为xxx的像素的透明度\n *\n * @param angle 角度 [0.0, 360.0]\n * @param distance 距离 [0.0, 1.0]\n *\n * @return alpha [0.0, 1.0]\n */\nfloat getColorAlpha(float angle, float distance) {\n\n float radian = angle * 0.01745329252;\n\n vec4 color = texture(texture, v_uv0 + vec2(distance * cos(radian), distance * sin(radian))); \n return color.a;\n}\n\n/**\n * 获取指定距离的周边像素的透明度平均值\n *\n * @param distance 距离 [0.0, 1.0]\n *\n * @return average alpha [0.0, 1.0]\n */\nfloat getDistanceAverageAlpha(float distance) {\n float totalAlpha = 0.0;\n totalAlpha += getColorAlpha(0.0, distance);\n totalAlpha += getColorAlpha(30.0, distance);\n totalAlpha += getColorAlpha(60.0, distance);\n totalAlpha += getColorAlpha(90.0, distance);\n totalAlpha += getColorAlpha(120.0, distance);\n totalAlpha += getColorAlpha(150.0, distance);\n totalAlpha += getColorAlpha(180.0, distance);\n totalAlpha += getColorAlpha(210.0, distance);\n totalAlpha += getColorAlpha(240.0, distance);\n totalAlpha += getColorAlpha(270.0, distance);\n totalAlpha += getColorAlpha(300.0, distance);\n totalAlpha += getColorAlpha(330.0, distance);\n return totalAlpha * (1.0 / 12.0);\n}\n\n/**\n * 获取发光的透明度\n */\nfloat getGlowAlpha() {\n\n vec4 srcColor = texture(texture, v_uv0);\n if (srcColor.a < 0.0000000001) {\n return srcColor.a;\n }\n\n float totalAlpha = 0.0;\n totalAlpha += getDistanceAverageAlpha(glowColorSize * 0.1);\n totalAlpha += getDistanceAverageAlpha(glowColorSize * 0.2);\n totalAlpha += getDistanceAverageAlpha(glowColorSize * 0.3);\n totalAlpha += getDistanceAverageAlpha(glowColorSize * 0.4);\n totalAlpha += getDistanceAverageAlpha(glowColorSize * 0.5);\n totalAlpha += getDistanceAverageAlpha(glowColorSize * 0.6);\n totalAlpha += getDistanceAverageAlpha(glowColorSize * 0.7);\n totalAlpha += getDistanceAverageAlpha(glowColorSize * 0.8);\n totalAlpha += getDistanceAverageAlpha(glowColorSize * 0.9);\n totalAlpha += getDistanceAverageAlpha(glowColorSize * 1.0);\n return totalAlpha * (1.0 / 10.0);\n}\n\n#endif\n\nvoid main () {\n vec4 o = vec4(1, 1, 1, 1);\n\n #if USE_TEXTURE\n o *= texture(texture, v_uv0);\n #if CC_USE_ALPHA_ATLAS_TEXTURE\n o.a *= texture2D(texture, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #endif\n\n o *= v_color;\n\n ALPHA_TEST(o);\n\n gl_FragColor = o;\n\n #if SHOW_INNER_GLOW\n\n vec4 color_dest = o;\n\n float alpha = getGlowAlpha();\n\n if (alpha > 0.1) {\n alpha = 1.0 - alpha;\n\n alpha = -1.0 * (alpha - 1.0) * (alpha - 1.0) * (alpha - 1.0) * (alpha - 1.0) + 1.0;\n }\n vec4 color_src = glowColor * alpha;\n\n gl_FragColor = color_src * color_src.a + color_dest;\n #endif\n}\n" } } ], diff --git a/assets/materials/glow-inner.mtl b/assets/materials/glow-inner.mtl index 54572d4..b82e982 100644 --- a/assets/materials/glow-inner.mtl +++ b/assets/materials/glow-inner.mtl @@ -15,11 +15,11 @@ "texture": null, "glowColor": { "__type__": "cc.Vec4", - "x": 0, + "x": 1, "y": 0, - "z": 1, + "z": 0, "w": 1 }, - "glowColorSize": 0.5 + "glowColorSize": 0.1 } } \ No newline at end of file From e3905b9c0ad968a9ad381d5bcdb79977b3be1878 Mon Sep 17 00:00:00 2001 From: caizhitao Date: Mon, 23 Dec 2019 23:12:22 +0800 Subject: [PATCH 08/24] =?UTF-8?q?=E5=AE=8C=E5=96=84Demo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/prefabs.meta | 7 + assets/prefabs/ColorAlphaSliderPrefab.prefab | 870 +++++ .../ColorAlphaSliderPrefab.prefab.meta | 8 + assets/prefabs/ColorBlueSliderPrefab.prefab | 870 +++++ .../prefabs/ColorBlueSliderPrefab.prefab.meta | 8 + assets/prefabs/ColorGreenSliderPrefab.prefab | 870 +++++ .../ColorGreenSliderPrefab.prefab.meta | 8 + assets/prefabs/ColorRedSliderPrefab.prefab | 870 +++++ .../prefabs/ColorRedSliderPrefab.prefab.meta | 8 + assets/prefabs/GlowWidthSliderPrefab.prefab | 870 +++++ .../prefabs/GlowWidthSliderPrefab.prefab.meta | 8 + assets/scenes/GlowInnerEffectScene.fire | 2922 +---------------- assets/scripts/GlowInnerEffectScene.ts | 12 +- assets/scripts/common.meta | 7 + assets/scripts/common/prefabs.meta | 7 + .../common/prefabs/ColorSliderPrefab.ts | 26 + .../common/prefabs/ColorSliderPrefab.ts.meta | 9 + .../common/prefabs/GlowWidthSliderPrefab.ts | 27 + .../prefabs/GlowWidthSliderPrefab.ts.meta | 9 + 19 files changed, 4609 insertions(+), 2807 deletions(-) create mode 100644 assets/prefabs.meta create mode 100644 assets/prefabs/ColorAlphaSliderPrefab.prefab create mode 100644 assets/prefabs/ColorAlphaSliderPrefab.prefab.meta create mode 100644 assets/prefabs/ColorBlueSliderPrefab.prefab create mode 100644 assets/prefabs/ColorBlueSliderPrefab.prefab.meta create mode 100644 assets/prefabs/ColorGreenSliderPrefab.prefab create mode 100644 assets/prefabs/ColorGreenSliderPrefab.prefab.meta create mode 100644 assets/prefabs/ColorRedSliderPrefab.prefab create mode 100644 assets/prefabs/ColorRedSliderPrefab.prefab.meta create mode 100644 assets/prefabs/GlowWidthSliderPrefab.prefab create mode 100644 assets/prefabs/GlowWidthSliderPrefab.prefab.meta create mode 100644 assets/scripts/common.meta create mode 100644 assets/scripts/common/prefabs.meta create mode 100644 assets/scripts/common/prefabs/ColorSliderPrefab.ts create mode 100644 assets/scripts/common/prefabs/ColorSliderPrefab.ts.meta create mode 100644 assets/scripts/common/prefabs/GlowWidthSliderPrefab.ts create mode 100644 assets/scripts/common/prefabs/GlowWidthSliderPrefab.ts.meta diff --git a/assets/prefabs.meta b/assets/prefabs.meta new file mode 100644 index 0000000..e7e0c50 --- /dev/null +++ b/assets/prefabs.meta @@ -0,0 +1,7 @@ +{ + "ver": "1.0.1", + "uuid": "8b73c029-c8a2-494d-be88-fd85f92e9591", + "isSubpackage": false, + "subpackageName": "", + "subMetas": {} +} \ No newline at end of file diff --git a/assets/prefabs/ColorAlphaSliderPrefab.prefab b/assets/prefabs/ColorAlphaSliderPrefab.prefab new file mode 100644 index 0000000..d832a7d --- /dev/null +++ b/assets/prefabs/ColorAlphaSliderPrefab.prefab @@ -0,0 +1,870 @@ +[ + { + "__type__": "cc.Prefab", + "_name": "", + "_objFlags": 0, + "_native": "", + "data": { + "__id__": 1 + }, + "optimizationPolicy": 0, + "asyncLoadAssets": false, + "readonly": false + }, + { + "__type__": "cc.Node", + "_name": "ColorAlphaSliderPrefab", + "_objFlags": 0, + "_parent": null, + "_children": [ + { + "__id__": 2 + }, + { + "__id__": 6 + }, + { + "__id__": 18 + } + ], + "_active": true, + "_components": [ + { + "__id__": 22 + }, + { + "__id__": 23 + } + ], + "_prefab": { + "__id__": 24 + }, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 576, + "height": 60 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + 0, + -318, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1 + ] + }, + "_eulerAngles": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_skewX": 0, + "_skewY": 0, + "_is3DNode": false, + "_groupIndex": 0, + "groupIndex": 0, + "_id": "" + }, + { + "__type__": "cc.Node", + "_name": "SliderDescLabel", + "_objFlags": 0, + "_parent": { + "__id__": 1 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 3 + }, + { + "__id__": 4 + } + ], + "_prefab": { + "__id__": 5 + }, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 144, + "height": 40 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 1, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + -144, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1 + ] + }, + "_eulerAngles": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_skewX": 0, + "_skewY": 0, + "_is3DNode": false, + "_groupIndex": 0, + "groupIndex": 0, + "_id": "" + }, + { + "__type__": "cc.Label", + "_name": "SliderDescLabel