diff --git a/CHANGELOG.md b/CHANGELOG.md index 24090e2..e59a6c4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # ChangeLog +## 0.6.0 (2020-01-17) + +- 加入新的圆角裁剪特效 v2 ,支持任意宽高纹理圆角裁剪 + ## 0.5.0 (2020-01-13) - 加入扫光特效 diff --git a/README.md b/README.md index ac9184a..0fc3a00 100755 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Cocos Creator Shader Effect Demo -[![](https://img.shields.io/badge/Release-0.5.0-green.svg)](CHANGELOG.md) +[![](https://img.shields.io/badge/Release-0.6.0-green.svg)](CHANGELOG.md) [![](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE) [![](https://img.shields.io/badge/Support-Cocos%20Creator%20v2.2.1-orange.svg)](http://www.cocos.com/creator) @@ -28,13 +28,7 @@ ## 三、特效预览 -### 扫光(实现原理同点光一样,可参考[点光实现原理文章](https://www.jianshu.com/p/711a54ff2fa0))(2020.01.13更新) -![](static/effects/2d-sprite-flash-light.gif) - -### 点光([实现原理](https://www.jianshu.com/p/8ff03b34b0bd))(2020.01.12更新) - -![](static/effects/2d-sprite-point-light.gif) ### 内发光([实现原理](https://www.jianshu.com/p/326b73f86ecc)) @@ -52,14 +46,35 @@ ![](static/effects/2d-sprite-gray.gif) -### 圆角裁剪 +### 点光([实现原理](https://www.jianshu.com/p/8ff03b34b0bd))(2020.01.12更新) + +![](static/effects/2d-sprite-point-light.gif) + +### 扫光(实现原理同点光一样,可参考[点光实现原理文章](https://www.jianshu.com/p/711a54ff2fa0))(2020.01.13更新) + +![](static/effects/2d-sprite-flash-light.gif) + +### 圆角裁剪-v1(2020.01.17更新) > * 声明:此特效为搬运过来的特效,非原创。 > * 修改的地方:搬运后,在原来的主要代码上加入了自己的理解注释 > * 实现原理:参考文章 [《圆角计算 Shader》](https://www.cnblogs.com/jqm304775992/p/4987793.html) > * 参考代码:Cocos 论坛帖子[《分享更高效的 creator 裁圆角头像 shader》](https://forum.cocos.org/t/creator-shader-2019-10-22-2-2-0/82548) 和对应的 [实现代码](https://github.com/yanjifa/shaderDemo/blob/master/assets/Effect/CircleAvatar.effect) -![](static/effects/2d-sprite-round-corner-crop.gif) +**此版本存在局限性:只有在正方形纹理上,才能裁剪出圆角,在非正方形上,无法裁剪出圆角,具体变现为有拉伸效果** + +如:下面GIF中第3到5秒演示所示,黄色和红色的非正方形纹理的圆角明显被拉伸 + +![](static/effects/2d-sprite-round-corner-crop-v1.gif) + +### 圆角裁剪-v2(2020.01.17更新) + +在 **圆角裁剪-v1** 的原理基础上,新增支持任意宽高纹理的圆角裁剪 + +如:下面Gif中第3到5秒演示所示,黄色和红色的非正方形纹理也能裁剪出圆角效果 + +![](static/effects/2d-sprite-round-corner-crop-v2.gif) + ### 外发光(完善中...) diff --git a/assets/effects/sprite-round-corner-crop.effect b/assets/effects/sprite-round-corner-crop-v1.effect similarity index 79% rename from assets/effects/sprite-round-corner-crop.effect rename to assets/effects/sprite-round-corner-crop-v1.effect index 9b4b299..6e0e190 100644 --- a/assets/effects/sprite-round-corner-crop.effect +++ b/assets/effects/sprite-round-corner-crop-v1.effect @@ -1,5 +1,7 @@ // Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. -// 圆角裁剪 +// +// 圆角裁剪(仅支持正方形纹理) +// // 原理:https://www.cnblogs.com/jqm304775992/p/4987793.html // 代码:复制 yanjifa/shaderDemor 的 https://github.com/yanjifa/shaderDemo/blob/master/assets/Effect/CircleAvatar.effect @@ -17,8 +19,8 @@ CCEffect %{ texture: { value: white } alphaThreshold: { value: 0.5 } # 圆角半径 - roundCornerRadius: { - value: 0.1, + radius: { + value: 0.4, inspector: { tooltip: "圆角半径", range: [0.0, 0.5] @@ -77,7 +79,7 @@ CCProgram fs %{ #if ENABLE_ROUNDCORNER uniform RoundCorner { // 圆角半径 - float roundCornerRadius; + float radius; } #endif @@ -97,7 +99,7 @@ CCProgram fs %{ #if ENABLE_ROUNDCORNER // 约束圆角半径范围在 [0.0, 0.5] - float radius = clamp(0.0, 0.5, roundCornerRadius); + float circleRadius = clamp(0.0, 0.5, radius); // 将纹理uv往左上偏移,实现偏移后的坐标系原点在纹理中心 vec2 uv = v_uv0.xy - vec2(0.5, 0.5); @@ -106,8 +108,8 @@ CCProgram fs %{ // abs(uv.x) , abs(uv.y) : 将第二、三、四象限的点都投影到第一象限上,这样子只需要处理第一象限的情况就可以,简化判断 // 0.5 - radius : 计算出第一象限的圆角所在圆的圆心坐标 // (rx, ry) : 偏移映射后的 新的uv 坐标,相对于 第一象限圆角坐在圆心坐标 的相对坐标 - float rx = abs(uv.x) - (0.5 - radius); - float ry = abs(uv.y) - (0.5 - radius); + float rx = abs(uv.x) - (0.5 - circleRadius); + float ry = abs(uv.y) - (0.5 - circleRadius); // 区分 以第一象限圆角所在圆心坐标为原点的坐标的四个象限 // @@ -117,26 +119,26 @@ CCProgram fs %{ // 第四象限 mx = 1, my = 0 // // 当 mx * my 时,只要等于1,那就是标识第一象限(实际对应圆角区域所在矩形),否则就是第二、三、四象限 - float mx = step(0.5 - radius, abs(uv.x)); - float my = step(0.5 - radius, abs(uv.y)); + float mx = step(0.5 - circleRadius, abs(uv.x)); + float my = step(0.5 - circleRadius, abs(uv.y)); // 计算相对uv坐标到圆心的距离 float len = length(vec2(rx, ry)); // mx * my = 0 时,代表非圆角区域,a 值为1,代表完全采用原始纹理的透明度 // mx * my = 1 时,代表园所所在矩形区域 - // step(radius, len) 可以区分出圆角所在矩形区域的 圆角区域 和 非圆角区域 + // step(circleRadius, len) 可以区分出圆角所在矩形区域的 圆角区域 和 非圆角区域 // 其中圆角区域值为0,非圆角区域值为1 // 当为圆角区域时,a 值为1,代表完全采用原始纹理透明度 // 当为非圆角区域时,a 值为0,代表完全透明 // 至此已经实现圆角裁剪 // - // smoothstep(0., radius * 0.01, len - radius) 是用于抗锯齿优化 + // smoothstep(0., circleRadius * 0.01, len - circleRadius) 是用于抗锯齿优化 // 原理:针对点在非圆角区域的情况,针对点在大于「圆半径一点点」地方的区域,进行平滑过渡,以实现抗锯齿 // 其中, - // 「圆半径一点点」用 radius * 0.01 表示(0.01 可自行改变) - // 点在大于圆半径的区域用 len - radius ,此值会在 [0.0, radius * 0.01] 之间时会平滑过渡 - float a = 1.0 - mx * my * step(radius, len) * smoothstep(0., radius * 0.01, len - radius); + // 「圆半径一点点」用 circleRadius * 0.01 表示(0.01 可自行改变) + // 点在大于圆半径的区域用 len - circleRadius ,此值会在 [0.0, circleRadius * 0.01] 之间时会平滑过渡 + float a = 1.0 - mx * my * step(circleRadius, len) * smoothstep(0., circleRadius * 0.01, len - circleRadius); o = vec4(o.rgb, o.a * a); #endif gl_FragColor = o; diff --git a/assets/effects/sprite-round-corner-crop.effect.meta b/assets/effects/sprite-round-corner-crop-v1.effect.meta similarity index 60% rename from assets/effects/sprite-round-corner-crop.effect.meta rename to assets/effects/sprite-round-corner-crop-v1.effect.meta index 4f9bb47..3e3ff59 100644 --- a/assets/effects/sprite-round-corner-crop.effect.meta +++ b/assets/effects/sprite-round-corner-crop-v1.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 ENABLE_ROUNDCORNER\nuniform float roundCornerRadius;\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 #if ENABLE_ROUNDCORNER\n\n float radius = clamp(0.0, 0.5, roundCornerRadius);\n\n vec2 uv = v_uv0.xy - vec2(0.5, 0.5);\n\n float rx = abs(uv.x) - (0.5 - radius);\n float ry = abs(uv.y) - (0.5 - radius);\n\n float mx = step(0.5 - radius, abs(uv.x));\n float my = step(0.5 - radius, abs(uv.y));\n\n float len = length(vec2(rx, ry));\n\n float a = 1.0 - mx * my * step(radius, len) * smoothstep(0., radius * 0.01, len - radius);\n o = vec4(o.rgb, o.a * a);\n #endif\n gl_FragColor = o;\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 ENABLE_ROUNDCORNER\nuniform float radius;\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 #if ENABLE_ROUNDCORNER\n\n float circleRadius = clamp(0.0, 0.5, radius);\n\n vec2 uv = v_uv0.xy - vec2(0.5, 0.5);\n\n float rx = abs(uv.x) - (0.5 - circleRadius);\n float ry = abs(uv.y) - (0.5 - circleRadius);\n\n float mx = step(0.5 - circleRadius, abs(uv.x));\n float my = step(0.5 - circleRadius, abs(uv.y));\n\n float len = length(vec2(rx, ry));\n\n float a = 1.0 - mx * my * step(circleRadius, len) * smoothstep(0., circleRadius * 0.01, len - circleRadius);\n o = vec4(o.rgb, o.a * a);\n #endif\n gl_FragColor = o;\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 ENABLE_ROUNDCORNER\nuniform RoundCorner {\n\n float roundCornerRadius;\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 #if ENABLE_ROUNDCORNER\n\n float radius = clamp(0.0, 0.5, roundCornerRadius);\n\n vec2 uv = v_uv0.xy - vec2(0.5, 0.5);\n\n float rx = abs(uv.x) - (0.5 - radius);\n float ry = abs(uv.y) - (0.5 - radius);\n\n float mx = step(0.5 - radius, abs(uv.x));\n float my = step(0.5 - radius, abs(uv.y));\n\n float len = length(vec2(rx, ry));\n\n float a = 1.0 - mx * my * step(radius, len) * smoothstep(0., radius * 0.01, len - radius);\n o = vec4(o.rgb, o.a * a);\n #endif\n gl_FragColor = o;\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 ENABLE_ROUNDCORNER\nuniform RoundCorner {\n\n float radius;\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 #if ENABLE_ROUNDCORNER\n\n float circleRadius = clamp(0.0, 0.5, radius);\n\n vec2 uv = v_uv0.xy - vec2(0.5, 0.5);\n\n float rx = abs(uv.x) - (0.5 - circleRadius);\n float ry = abs(uv.y) - (0.5 - circleRadius);\n\n float mx = step(0.5 - circleRadius, abs(uv.x));\n float my = step(0.5 - circleRadius, abs(uv.y));\n\n float len = length(vec2(rx, ry));\n\n float a = 1.0 - mx * my * step(circleRadius, len) * smoothstep(0., circleRadius * 0.01, len - circleRadius);\n o = vec4(o.rgb, o.a * a);\n #endif\n gl_FragColor = o;\n}\n" } } ], diff --git a/assets/effects/sprite-round-corner-crop-v2.effect b/assets/effects/sprite-round-corner-crop-v2.effect new file mode 100644 index 0000000..cb6c1a3 --- /dev/null +++ b/assets/effects/sprite-round-corner-crop-v2.effect @@ -0,0 +1,194 @@ +// Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. +// +// 圆角裁剪(支持任意宽高纹理) +// +// 原理: +// 1. 正方形纹理的圆角原理参考 https://www.cnblogs.com/jqm304775992/p/4987793.html +// 2. 正方形纹理的圆角代码参考 yanjifa/shaderDemor 的 https://github.com/yanjifa/shaderDemo/blob/master/assets/Effect/CircleAvatar.effect +// 3. 上述皆为只针对正方形纹理做的操作,如果是长方形的纹理,那么圆角就会有拉伸后的效果,最后变成看起来就不是圆角了,本特效支持任意长方形做圆角 + +CCEffect %{ + techniques: + - passes: + - vert: vs + frag: fs + blendState: + targets: + - blend: true + rasterizerState: + cullMode: none + properties: + texture: { value: white } + alphaThreshold: { value: 0.5 } + + # 圆角x轴半径长度(相对于纹理宽度) + xRadius: { + value: 0.4, + inspector: { + tooltip: "圆角x轴半径长度(相对于纹理宽度)", + range: [0.0, 0.5] + } + } + + # 圆角y轴半径长度(相对于纹理高度) + yRadius: { + value: 0.4, + inspector: { + tooltip: "圆角y轴半径长度(相对于纹理高度)", + range: [0.0, 0.5] + } + } +}% + + +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 ENABLE_ROUNDCORNER + uniform RoundCorner { + // 圆角x轴半径长度(相对于纹理宽度) + float xRadius; + + // 圆角y轴半径长度(相对于纹理高度) + float yRadius; + } + #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); + + #if ENABLE_ROUNDCORNER + + // 约束圆角半径范围在 [0.0, 0.5] + // + // 请注意这里我是用椭圆前缀去命名的半径 + // + // 为什么是椭圆? + // + // 因为圆角,相对于长方形的纹理的宽高来说,归一化后值并不一样,不是圆,而是一个椭圆 + // + // 比如: + // + // 纹理是 200 x 100 的像素,圆角半径是20像素,那么归一化后 + // X轴上的半径就是 20 / 200 = 0.1 + // Y轴上的半径就是 20 / 100 = 0.2 + // + // 这就会变成是椭圆,而不是圆 + float ellipseXRadius = clamp(0.0, 0.5, xRadius); + float ellipseYRadius = clamp(0.0, 0.5, yRadius); + + // 将纹理uv往左上偏移,实现偏移后的坐标系原点在纹理中心 + vec2 uv = v_uv0.xy - vec2(0.5, 0.5); + + // uv.x , uv.y : 为偏移后的的uv + // abs(uv.x) , abs(uv.y) : 将第二、三、四象限的点都投影到第一象限上,这样子只需要处理第一象限的情况就可以,简化判断 + // 0.5 - radius : 计算出第一象限的圆角所在圆的圆心坐标 + // (rx, ry) : 偏移映射后的 新的uv 坐标,相对于 第一象限圆角坐在圆心坐标 的相对坐标 + float rx = abs(uv.x) - (0.5 - ellipseXRadius); + float ry = abs(uv.y) - (0.5 - ellipseYRadius); + + // 区分 以第一象限圆角所在圆心坐标为原点的坐标的四个象限 + // + // 第一象限 mx = 1, my = 1 + // 第二象限 mx = 0, my = 1 + // 第三象限 mx = 0, my = 0 + // 第四象限 mx = 1, my = 0 + // + // 当 mx * my 时,只要等于1,那就是标识第一象限(实际对应圆角区域所在矩形),否则就是第二、三、四象限 + float mx = step(0.5 - ellipseXRadius, abs(uv.x)); + float my = step(0.5 - ellipseYRadius, abs(uv.y)); + + // 判断点(rx, ry)是否在椭圆外部(应用椭圆公式) + float isOutOfEllipse = step(1.0, pow(rx, 2.0) / pow(xRadius, 2.0) + pow(ry, 2.0) / pow(yRadius, 2.0)); + + /////////////////////////////////////////////////////////////////////////////////////////// + // 抗锯齿 + // 1. 先计算当前点到椭圆中心的角度 + float angleInRadian = atan(ry / rx); + + // 2. 计算这个角度下,对于对应圆角(椭圆)上的点 + vec2 pointInEllipse = vec2(xRadius * cos(angleInRadian), yRadius * sin(angleInRadian)); + + // 3. 计算这个角度下,比当前圆角大一点椭圆上的点 + vec2 pointInBigEllipse = vec2((xRadius * 1.01) * cos(angleInRadian), (yRadius * 1.01)* sin(angleInRadian)); + + // 4. 计算最远点到当前椭圆的距离 + float maxDis = distance(pointInBigEllipse, pointInEllipse); + + // 5. 计算当前点到当前椭圆的距离 + float curDis = distance(vec2(rx, ry), pointInEllipse); + + // 6. 生成插值 + float smo = smoothstep(0.0, maxDis, curDis); + /////////////////////////////////////////////////////////////////////////////////////////// + + // mx * my = 0 时,代表非椭圆角区域,alpha 值为1,代表完全采用原始纹理的透明度 + // mx * my = 1 时,代表椭圆角所在矩形区域 + // isOutOfEllipse: + // 当点在椭圆外部时,此值为1,导致 alpha 最终值为0.0,即表示不显示椭圆外部的像素 + // 当点在椭圆内部时,此值为0,导致 alpha 最终值为1.0,即表示显示椭圆内部的像素 + // smo : 抗锯齿实现 + // float alpha = 1.0 - mx * my * isOutOfEllipse; + float alpha = 1.0 - mx * my * isOutOfEllipse * smo; + + o = vec4(o.rgb, o.a * alpha); + + #endif + gl_FragColor = o; + } +}% diff --git a/assets/effects/sprite-round-corner-crop-v2.effect.meta b/assets/effects/sprite-round-corner-crop-v2.effect.meta new file mode 100644 index 0000000..6c0bfb1 --- /dev/null +++ b/assets/effects/sprite-round-corner-crop-v2.effect.meta @@ -0,0 +1,17 @@ +{ + "ver": "1.0.23", + "uuid": "7c24b57e-e819-4fc9-a8d2-b06cf61b782d", + "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 ENABLE_ROUNDCORNER\nuniform float xRadius;\nuniform float yRadius;\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 #if ENABLE_ROUNDCORNER\n\n float ellipseXRadius = clamp(0.0, 0.5, xRadius);\n float ellipseYRadius = clamp(0.0, 0.5, yRadius);\n\n vec2 uv = v_uv0.xy - vec2(0.5, 0.5);\n\n float rx = abs(uv.x) - (0.5 - ellipseXRadius);\n float ry = abs(uv.y) - (0.5 - ellipseYRadius);\n\n float mx = step(0.5 - ellipseXRadius, abs(uv.x));\n float my = step(0.5 - ellipseYRadius, abs(uv.y));\n\n float isOutOfEllipse = step(1.0, pow(rx, 2.0) / pow(xRadius, 2.0) + pow(ry, 2.0) / pow(yRadius, 2.0));\n\n float angleInRadian = atan(ry / rx);\n\n vec2 pointInEllipse = vec2(xRadius * cos(angleInRadian), yRadius * sin(angleInRadian));\n\n vec2 pointInBigEllipse = vec2((xRadius * 1.01) * cos(angleInRadian), (yRadius * 1.01)* sin(angleInRadian));\n\n float maxDis = distance(pointInBigEllipse, pointInEllipse);\n\n float curDis = distance(vec2(rx, ry), pointInEllipse);\n\n float smo = smoothstep(0.0, maxDis, curDis);\n\n float alpha = 1.0 - mx * my * isOutOfEllipse * smo;\n\n o = vec4(o.rgb, o.a * alpha);\n\n #endif\n gl_FragColor = o;\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 ENABLE_ROUNDCORNER\nuniform RoundCorner {\n\n float xRadius;\n\n float yRadius;\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 #if ENABLE_ROUNDCORNER\n\n float ellipseXRadius = clamp(0.0, 0.5, xRadius);\n float ellipseYRadius = clamp(0.0, 0.5, yRadius);\n\n vec2 uv = v_uv0.xy - vec2(0.5, 0.5);\n\n float rx = abs(uv.x) - (0.5 - ellipseXRadius);\n float ry = abs(uv.y) - (0.5 - ellipseYRadius);\n\n float mx = step(0.5 - ellipseXRadius, abs(uv.x));\n float my = step(0.5 - ellipseYRadius, abs(uv.y));\n\n float isOutOfEllipse = step(1.0, pow(rx, 2.0) / pow(xRadius, 2.0) + pow(ry, 2.0) / pow(yRadius, 2.0));\n\n float angleInRadian = atan(ry / rx);\n\n vec2 pointInEllipse = vec2(xRadius * cos(angleInRadian), yRadius * sin(angleInRadian));\n\n vec2 pointInBigEllipse = vec2((xRadius * 1.01) * cos(angleInRadian), (yRadius * 1.01)* sin(angleInRadian));\n\n float maxDis = distance(pointInBigEllipse, pointInEllipse);\n\n float curDis = distance(vec2(rx, ry), pointInEllipse);\n\n float smo = smoothstep(0.0, maxDis, curDis);\n\n float alpha = 1.0 - mx * my * isOutOfEllipse * smo;\n\n o = vec4(o.rgb, o.a * alpha);\n\n #endif\n gl_FragColor = o;\n}\n" + } + } + ], + "subMetas": {} +} \ No newline at end of file diff --git a/assets/materials/sprite-round-corner-crop.mtl b/assets/materials/sprite-round-corner-crop-v1.mtl similarity index 83% rename from assets/materials/sprite-round-corner-crop.mtl rename to assets/materials/sprite-round-corner-crop-v1.mtl index a1346a7..279cad8 100644 --- a/assets/materials/sprite-round-corner-crop.mtl +++ b/assets/materials/sprite-round-corner-crop-v1.mtl @@ -10,7 +10,5 @@ "USE_TEXTURE": true, "ENABLE_ROUNDCORNER": true }, - "_props": { - "roundCornerRadius": 0.1 - } + "_props": {} } \ No newline at end of file diff --git a/assets/materials/sprite-round-corner-crop.mtl.meta b/assets/materials/sprite-round-corner-crop-v1.mtl.meta similarity index 100% rename from assets/materials/sprite-round-corner-crop.mtl.meta rename to assets/materials/sprite-round-corner-crop-v1.mtl.meta diff --git a/assets/materials/sprite-round-corner-crop-v2.mtl b/assets/materials/sprite-round-corner-crop-v2.mtl new file mode 100644 index 0000000..e8c7371 --- /dev/null +++ b/assets/materials/sprite-round-corner-crop-v2.mtl @@ -0,0 +1,14 @@ +{ + "__type__": "cc.Material", + "_name": "", + "_objFlags": 0, + "_native": "", + "_effectAsset": { + "__uuid__": "7c24b57e-e819-4fc9-a8d2-b06cf61b782d" + }, + "_defines": { + "USE_TEXTURE": true, + "ENABLE_ROUNDCORNER": true + }, + "_props": {} +} \ No newline at end of file diff --git a/assets/materials/sprite-round-corner-crop-v2.mtl.meta b/assets/materials/sprite-round-corner-crop-v2.mtl.meta new file mode 100644 index 0000000..c7d5f5d --- /dev/null +++ b/assets/materials/sprite-round-corner-crop-v2.mtl.meta @@ -0,0 +1,6 @@ +{ + "ver": "1.0.2", + "uuid": "a86e8864-5390-443f-b41b-b38e9d584c43", + "dataAsSubAsset": null, + "subMetas": {} +} \ No newline at end of file diff --git a/assets/scenes/RoundCornerCropEffectScene.fire b/assets/scenes/RoundCornerCropV1EffectScene.fire similarity index 80% rename from assets/scenes/RoundCornerCropEffectScene.fire rename to assets/scenes/RoundCornerCropV1EffectScene.fire index 4f320fb..fcf9e7f 100755 --- a/assets/scenes/RoundCornerCropEffectScene.fire +++ b/assets/scenes/RoundCornerCropV1EffectScene.fire @@ -78,10 +78,10 @@ "_active": true, "_components": [ { - "__id__": 47 + "__id__": 39 }, { - "__id__": 48 + "__id__": 40 } ], "_prefab": null, @@ -171,7 +171,7 @@ "array": [ 0, 0, - 418.2902700278839, + 351.60631393648214, 0, 0, 0, @@ -251,7 +251,7 @@ "_active": true, "_components": [ { - "__id__": 46 + "__id__": 38 } ], "_prefab": null, @@ -428,7 +428,7 @@ }, { "__type__": "cc.Node", - "_name": "Sliders", + "_name": "Controller", "_objFlags": 0, "_parent": { "__id__": 5 @@ -497,7 +497,7 @@ }, { "__type__": "cc.Node", - "_name": "RoundCornerRadiusSlider", + "_name": "RadiusSlider", "_objFlags": 0, "_parent": { "__id__": 9 @@ -1332,27 +1332,15 @@ }, { "__id__": 34 - }, - { - "__id__": 36 - }, - { - "__id__": 38 - }, - { - "__id__": 40 - }, - { - "__id__": 42 } ], "_active": true, "_components": [ { - "__id__": 44 + "__id__": 36 }, { - "__id__": 45 + "__id__": 37 } ], "_prefab": null, @@ -1367,7 +1355,7 @@ "_contentSize": { "__type__": "cc.Size", "width": 384, - "height": 629.73 + "height": 564 }, "_anchorPoint": { "__type__": "cc.Vec2", @@ -1403,100 +1391,6 @@ "groupIndex": 0, "_id": "feymBChPxA1pr6+/rlPqey" }, - { - "__type__": "cc.Node", - "_name": "ball_0", - "_objFlags": 0, - "_parent": { - "__id__": 29 - }, - "_children": [], - "_active": false, - "_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": [ - 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__": 30 - }, - "_enabled": true, - "_materials": [ - { - "__uuid__": "642c2d0e-7eb6-4d65-96f2-d6e0d0305310" - } - ], - "_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.Node", "_name": "freedom", @@ -1508,7 +1402,7 @@ "_active": true, "_components": [ { - "__id__": 33 + "__id__": 31 } ], "_prefab": null, @@ -1564,7 +1458,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 32 + "__id__": 30 }, "_enabled": true, "_materials": [ @@ -1593,7 +1487,101 @@ }, { "__type__": "cc.Node", - "_name": "cocos_logo", + "_name": "Rectangle1", + "_objFlags": 0, + "_parent": { + "__id__": 29 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 33 + } + ], + "_prefab": null, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 0, + "b": 0, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 200, + "height": 100 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + 0, + -302, + 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": "2eSZfgubZMxpkxf6Wv6VoZ" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 32 + }, + "_enabled": true, + "_materials": [ + { + "__uuid__": "642c2d0e-7eb6-4d65-96f2-d6e0d0305310" + } + ], + "_srcBlendFactor": 770, + "_dstBlendFactor": 771, + "_spriteFrame": { + "__uuid__": "a23235d1-15db-4b95-8439-a2e005bfff91" + }, + "_type": 0, + "_sizeMode": 0, + "_fillType": 0, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": true, + "_atlas": null, + "_id": "2enlbFjsJLJqVy8iYfWwca" + }, + { + "__type__": "cc.Node", + "_name": "Rectangle2", "_objFlags": 0, "_parent": { "__id__": 29 @@ -1611,13 +1599,13 @@ "__type__": "cc.Color", "r": 255, "g": 255, - "b": 255, + "b": 0, "a": 255 }, "_contentSize": { "__type__": "cc.Size", - "width": 195, - "height": 270 + "width": 100, + "height": 200 }, "_anchorPoint": { "__type__": "cc.Vec2", @@ -1629,7 +1617,7 @@ "ctor": "Float64Array", "array": [ 0, - -387, + -464, 0, 0, 0, @@ -1651,7 +1639,7 @@ "_is3DNode": false, "_groupIndex": 0, "groupIndex": 0, - "_id": "25JHa6EcNEBZ1hoesQM1Q4" + "_id": "eeRQw29nZJXYOderYE6uKz" }, { "__type__": "cc.Sprite", @@ -1669,10 +1657,10 @@ "_srcBlendFactor": 770, "_dstBlendFactor": 771, "_spriteFrame": { - "__uuid__": "31bc895a-c003-4566-a9f3-2e54ae1c17dc" + "__uuid__": "a23235d1-15db-4b95-8439-a2e005bfff91" }, "_type": 0, - "_sizeMode": 1, + "_sizeMode": 0, "_fillType": 0, "_fillCenter": { "__type__": "cc.Vec2", @@ -1683,381 +1671,7 @@ "_fillRange": 0, "_isTrimmedMode": true, "_atlas": null, - "_id": "74+WCqN01NIbcSpr5gcxmE" - }, - { - "__type__": "cc.Node", - "_name": "ball_1", - "_objFlags": 0, - "_parent": { - "__id__": 29 - }, - "_children": [], - "_active": false, - "_components": [ - { - "__id__": 37 - } - ], - "_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, - -564, - 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__": 36 - }, - "_enabled": true, - "_materials": [ - { - "__uuid__": "642c2d0e-7eb6-4d65-96f2-d6e0d0305310" - } - ], - "_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.Node", - "_name": "video_btn", - "_objFlags": 0, - "_parent": { - "__id__": 29 - }, - "_children": [], - "_active": false, - "_components": [ - { - "__id__": 39 - } - ], - "_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": [ - 0, - -631, - 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": "c73V7fMuVE0aD5fGtmyzmF" - }, - { - "__type__": "cc.Sprite", - "_name": "", - "_objFlags": 0, - "node": { - "__id__": 38 - }, - "_enabled": true, - "_materials": [ - { - "__uuid__": "642c2d0e-7eb6-4d65-96f2-d6e0d0305310" - } - ], - "_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": "f43fJCjNdOS5VHAEhp0yDU" - }, - { - "__type__": "cc.Node", - "_name": "SystemFont", - "_objFlags": 0, - "_parent": { - "__id__": 29 - }, - "_children": [], - "_active": true, - "_components": [ - { - "__id__": 41 - } - ], - "_prefab": null, - "_opacity": 255, - "_color": { - "__type__": "cc.Color", - "r": 255, - "g": 255, - "b": 255, - "a": 255 - }, - "_contentSize": { - "__type__": "cc.Size", - "width": 224.51, - "height": 50.4 - }, - "_anchorPoint": { - "__type__": "cc.Vec2", - "x": 0.5, - "y": 0.5 - }, - "_trs": { - "__type__": "TypedArray", - "ctor": "Float64Array", - "array": [ - 0, - -559.2, - 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": "5dfIaYLgJPQKk50HqrgyHI" - }, - { - "__type__": "cc.Label", - "_name": "", - "_objFlags": 0, - "node": { - "__id__": 40 - }, - "_enabled": true, - "_materials": [ - { - "__uuid__": "642c2d0e-7eb6-4d65-96f2-d6e0d0305310" - } - ], - "_useOriginalSize": false, - "_string": "System Font", - "_N$string": "System Font", - "_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": "d1whc7H8RHdrROcYj+2Qh1" - }, - { - "__type__": "cc.Node", - "_name": "BmFont", - "_objFlags": 0, - "_parent": { - "__id__": 29 - }, - "_children": [], - "_active": true, - "_components": [ - { - "__id__": 43 - } - ], - "_prefab": null, - "_opacity": 255, - "_color": { - "__type__": "cc.Color", - "r": 255, - "g": 255, - "b": 255, - "a": 255 - }, - "_contentSize": { - "__type__": "cc.Size", - "width": 167.5, - "height": 33.33 - }, - "_anchorPoint": { - "__type__": "cc.Vec2", - "x": 0.5, - "y": 0.5 - }, - "_trs": { - "__type__": "TypedArray", - "ctor": "Float64Array", - "array": [ - 0, - -613.065, - 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": "e4XmdmRoVPxKoDxfbOgm42" - }, - { - "__type__": "cc.Label", - "_name": "", - "_objFlags": 0, - "node": { - "__id__": 42 - }, - "_enabled": true, - "_materials": [ - { - "__uuid__": "642c2d0e-7eb6-4d65-96f2-d6e0d0305310" - } - ], - "_useOriginalSize": false, - "_string": "BM Font", - "_N$string": "BM Font", - "_fontSize": 40, - "_lineHeight": 40, - "_enableWrapText": true, - "_N$file": { - "__uuid__": "4c95de7e-8cca-47bf-a446-47b7594e0992" - }, - "_isSystemFontUsed": false, - "_spacingX": 0, - "_batchAsBitmap": false, - "_N$horizontalAlign": 1, - "_N$verticalAlign": 1, - "_N$fontFamily": "Arial", - "_N$overflow": 0, - "_N$cacheMode": 0, - "_id": "7cXLgoUJhDP7BPjr4yx+Ep" + "_id": "0c/FhoiupJMaG6rjicnytU" }, { "__type__": "cc.Widget", @@ -2097,7 +1711,7 @@ "_layoutSize": { "__type__": "cc.Size", "width": 384, - "height": 629.73 + "height": 564 }, "_resize": 1, "_N$layoutType": 2, @@ -2147,13 +1761,13 @@ "_id": "4bz2+ak99DBYVlSVIMFGN0" }, { - "__type__": "d3d2b7nIXNDbKEclKMbIFTC", + "__type__": "d2765jFqWZOUKFiCcevAVee", "_name": "", "_objFlags": 0, "node": { "__id__": 2 }, "_enabled": true, - "_id": "9ayfD37bZP1IEjPxGKO6+/" + "_id": "ffrfD4b9VHdpBJCBGtbsue" } ] \ No newline at end of file diff --git a/assets/scenes/RoundCornerCropEffectScene.fire.meta b/assets/scenes/RoundCornerCropV1EffectScene.fire.meta similarity index 100% rename from assets/scenes/RoundCornerCropEffectScene.fire.meta rename to assets/scenes/RoundCornerCropV1EffectScene.fire.meta diff --git a/assets/scenes/RoundCornerCropV2EffectScene.fire b/assets/scenes/RoundCornerCropV2EffectScene.fire new file mode 100755 index 0000000..8136358 --- /dev/null +++ b/assets/scenes/RoundCornerCropV2EffectScene.fire @@ -0,0 +1,1773 @@ +[ + { + "__type__": "cc.SceneAsset", + "_name": "", + "_objFlags": 0, + "_native": "", + "scene": { + "__id__": 1 + } + }, + { + "__type__": "cc.Scene", + "_objFlags": 0, + "_parent": null, + "_children": [ + { + "__id__": 2 + } + ], + "_active": false, + "_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": "c2dec4ed-8129-40a2-9a1e-2440da772015" + }, + { + "__type__": "cc.Node", + "_name": "Canvas", + "_objFlags": 0, + "_parent": { + "__id__": 1 + }, + "_children": [ + { + "__id__": 3 + }, + { + "__id__": 5 + } + ], + "_active": true, + "_components": [ + { + "__id__": 39 + }, + { + "__id__": 40 + } + ], + "_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, + 351.60631393648214, + 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": "Content", + "_objFlags": 0, + "_parent": { + "__id__": 2 + }, + "_children": [ + { + "__id__": 6 + }, + { + "__id__": 9 + }, + { + "__id__": 29 + } + ], + "_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": 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": "faqYlnbttBCaJJgkn4Ntv/" + }, + { + "__type__": "cc.Node", + "_name": "Bg", + "_objFlags": 0, + "_parent": { + "__id__": 5 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 7 + }, + { + "__id__": 8 + } + ], + "_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__": 6 + }, + "_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__": 6 + }, + "_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": "Controller", + "_objFlags": 0, + "_parent": { + "__id__": 5 + }, + "_children": [ + { + "__id__": 10 + } + ], + "_active": true, + "_components": [ + { + "__id__": 27 + }, + { + "__id__": 28 + } + ], + "_prefab": null, + "_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": 1 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + -192, + 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": "d0PWmVX95D3LEcvBQBPDr+" + }, + { + "__type__": "cc.Node", + "_name": "RadiusSlider", + "_objFlags": 0, + "_parent": { + "__id__": 9 + }, + "_children": [ + { + "__id__": 11 + }, + { + "__id__": 14 + }, + { + "__id__": 23 + } + ], + "_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": 576, + "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": "669o93+gJMWJFGUDKSDUJ7" + }, + { + "__type__": "cc.Node", + "_name": "SliderDescLabel", + "_objFlags": 0, + "_parent": { + "__id__": 10 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 12 + }, + { + "__id__": 13 + } + ], + "_prefab": null, + "_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": "d9MLgZpaFCEZu70E0LAUbn" + }, + { + "__type__": "cc.Widget", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 11 + }, + "_enabled": true, + "alignMode": 1, + "_target": null, + "_alignFlags": 45, + "_left": 0, + "_right": 0.75, + "_top": 10, + "_bottom": 10, + "_verticalCenter": 0, + "_horizontalCenter": 0, + "_isAbsLeft": true, + "_isAbsRight": false, + "_isAbsTop": true, + "_isAbsBottom": true, + "_isAbsHorizontalCenter": true, + "_isAbsVerticalCenter": true, + "_originalWidth": 113.38, + "_originalHeight": 50.4, + "_id": "bep2S1v8FL15W8eBH2S6xE" + }, + { + "__type__": "cc.Label", + "_name": "SliderDescLabel