整理内发光V1版本

This commit is contained in:
caizhitao 2020-06-23 18:57:36 +08:00
parent 41d62f0f8e
commit 97eac60477
4 changed files with 212 additions and 214 deletions

View File

@ -58,7 +58,7 @@
"_groupIndex": 0, "_groupIndex": 0,
"groupIndex": 0, "groupIndex": 0,
"autoReleaseAssets": false, "autoReleaseAssets": false,
"_id": "69a920f1-0509-4d54-b033-5fb5b1283b72" "_id": "d9314270-2175-430f-9b5b-e4cef9314a76"
}, },
{ {
"__type__": "cc.Node", "__type__": "cc.Node",
@ -174,7 +174,7 @@
"array": [ "array": [
0, 0,
0, 0,
415.69219381653056, 416.8423838059318,
0, 0,
0, 0,
0, 0,
@ -5314,7 +5314,7 @@
}, },
{ {
"__type__": "cc.Node", "__type__": "cc.Node",
"_name": "shark_1", "_name": "cocos_logo",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 115 "__id__": 115
@ -5335,6 +5335,194 @@
"b": 255, "b": 255,
"a": 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": [
0,
-147,
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": "19I84S9glPKYKXBymxRb7M"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 116
},
"_enabled": true,
"_materials": [
{
"__uuid__": "647e873f-e0ed-4ce7-84cb-9e4d4f8a211f"
}
],
"_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": "63wzO33IhIzYLBDumqR/qS"
},
{
"__type__": "cc.Node",
"_name": "ball_1",
"_objFlags": 0,
"_parent": {
"__id__": 115
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 119
}
],
"_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,
-378,
0,
0,
0,
0,
1,
2,
2,
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__": 118
},
"_enabled": true,
"_materials": [
{
"__uuid__": "647e873f-e0ed-4ce7-84cb-9e4d4f8a211f"
}
],
"_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": "shark_1",
"_objFlags": 0,
"_parent": {
"__id__": 115
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 121
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 553, "width": 553,
@ -5350,7 +5538,7 @@
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
0, 0,
-82.64999999999999, -544.65,
0, 0,
0, 0,
0, 0,
@ -5379,12 +5567,12 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 116 "__id__": 120
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
{ {
"__uuid__": "5e2baa0c-d8bf-493f-89f7-a11352092439" "__uuid__": "647e873f-e0ed-4ce7-84cb-9e4d4f8a211f"
} }
], ],
"_srcBlendFactor": 770, "_srcBlendFactor": 770,
@ -5417,7 +5605,7 @@
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 119 "__id__": 123
} }
], ],
"_prefab": null, "_prefab": null,
@ -5444,7 +5632,7 @@
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
0, 0,
-261.04999999999995, -723.05,
0, 0,
0, 0,
0, 0,
@ -5473,12 +5661,12 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 118 "__id__": 122
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
{ {
"__uuid__": "5e2baa0c-d8bf-493f-89f7-a11352092439" "__uuid__": "647e873f-e0ed-4ce7-84cb-9e4d4f8a211f"
} }
], ],
"_srcBlendFactor": 770, "_srcBlendFactor": 770,
@ -5511,7 +5699,7 @@
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 121 "__id__": 125
} }
], ],
"_prefab": null, "_prefab": null,
@ -5538,7 +5726,7 @@
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
0, 0,
-528.8, -990.8,
0, 0,
0, 0,
0, 0,
@ -5567,12 +5755,12 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 120 "__id__": 124
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
{ {
"__uuid__": "5e2baa0c-d8bf-493f-89f7-a11352092439" "__uuid__": "647e873f-e0ed-4ce7-84cb-9e4d4f8a211f"
} }
], ],
"_srcBlendFactor": 770, "_srcBlendFactor": 770,
@ -5594,194 +5782,6 @@
"_atlas": null, "_atlas": null,
"_id": "1eCplTTO9BSJ6wePyWwtmu" "_id": "1eCplTTO9BSJ6wePyWwtmu"
}, },
{
"__type__": "cc.Node",
"_name": "cocos_logo",
"_objFlags": 0,
"_parent": {
"__id__": 115
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 123
}
],
"_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": [
0,
-859.8,
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": "25JHa6EcNEBZ1hoesQM1Q4"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 122
},
"_enabled": true,
"_materials": [
{
"__uuid__": "5e2baa0c-d8bf-493f-89f7-a11352092439"
}
],
"_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": "74+WCqN01NIbcSpr5gcxmE"
},
{
"__type__": "cc.Node",
"_name": "ball_1",
"_objFlags": 0,
"_parent": {
"__id__": 115
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 125
}
],
"_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,
-1090.8,
0,
0,
0,
0,
1,
2,
2,
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__": 124
},
"_enabled": true,
"_materials": [
{
"__uuid__": "5e2baa0c-d8bf-493f-89f7-a11352092439"
}
],
"_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", "__type__": "cc.Node",
"_name": "BmFont", "_name": "BmFont",
@ -5854,7 +5854,7 @@
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
{ {
"__uuid__": "5e2baa0c-d8bf-493f-89f7-a11352092439" "__uuid__": "647e873f-e0ed-4ce7-84cb-9e4d4f8a211f"
} }
], ],
"_useOriginalSize": false, "_useOriginalSize": false,
@ -6023,6 +6023,6 @@
"__id__": 2 "__id__": 2
}, },
"_enabled": true, "_enabled": true,
"_id": "1a7ypfDW1DQqGMHUC5Sf0L" "_id": "68onf5NstN0Z3WZhqOSIoJ"
} }
] ]

View File

@ -1,6 +1,6 @@
{ {
"ver": "1.2.7", "ver": "1.2.7",
"uuid": "69a920f1-0509-4d54-b033-5fb5b1283b72", "uuid": "d9314270-2175-430f-9b5b-e4cef9314a76",
"asyncLoadAssets": false, "asyncLoadAssets": false,
"autoReleaseAssets": false, "autoReleaseAssets": false,
"subMetas": {} "subMetas": {}

View File

@ -74,8 +74,9 @@ export default class GlowInnerEffectScene extends cc.Component {
this._blueSliderLabel.string = `${this._blueSlider.progress.toFixed(2)} | ${Math.round(255 * this._blueSlider.progress)}`; this._blueSliderLabel.string = `${this._blueSlider.progress.toFixed(2)} | ${Math.round(255 * this._blueSlider.progress)}`;
this._alphaSliderLabel.string = `${this._alphaSlider.progress.toFixed(2)} | ${Math.round(255 * this._alphaSlider.progress)}`; this._alphaSliderLabel.string = `${this._alphaSlider.progress.toFixed(2)} | ${Math.round(255 * this._alphaSlider.progress)}`;
let realGlowWidthProgress = this._glowWidthSlider.progress * 200; // 这里为约束一下值发光宽度值在 [0.0, 0.1] 因为 0.1+ 之后的效果可能不明显,也可以自己尝试修改
this._glowWidthSliderLabel.string = `${realGlowWidthProgress.toFixed(0)}`; let realGlowWidthProgress = this._glowWidthSlider.progress * 0.2;
this._glowWidthSliderLabel.string = `${realGlowWidthProgress.toFixed(2)}`;
// 这里为约束一下值发光阈值值在 [0.0, 0.5] 因为 0.5+ 之后的效果可能就是其他效果,也可以自己修改这里 // 这里为约束一下值发光阈值值在 [0.0, 0.5] 因为 0.5+ 之后的效果可能就是其他效果,也可以自己修改这里
// let realGlowThresholdProgress = this._glowThresholdSlider.progress * 0.5; // let realGlowThresholdProgress = this._glowThresholdSlider.progress * 0.5;
@ -85,7 +86,7 @@ export default class GlowInnerEffectScene extends cc.Component {
// 更新材质 // 更新材质
this._updateRenderComponentMaterial({ this._updateRenderComponentMaterial({
glowColor: cc.v4(this._redSlider.progress, this._greenSlider.progress, this._blueSlider.progress, this._alphaSlider.progress), glowColor: cc.v4(this._redSlider.progress, this._greenSlider.progress, this._blueSlider.progress, this._alphaSlider.progress),
glowRange: realGlowWidthProgress, glowColorSize: realGlowWidthProgress,
glowThreshold: realGlowThresholdProgress, glowThreshold: realGlowThresholdProgress,
}); });
} }
@ -99,9 +100,9 @@ export default class GlowInnerEffectScene extends cc.Component {
*/ */
private _updateRenderComponentMaterial(param: { private _updateRenderComponentMaterial(param: {
/** /**
* px * [0.0, 1.0]
*/ */
glowRange: number; glowColorSize: number;
/** /**
* [0.0, 1.0] * [0.0, 1.0]
@ -115,11 +116,8 @@ export default class GlowInnerEffectScene extends cc.Component {
}) { }) {
this._scrollView.content.children.forEach((childNode) => { this._scrollView.content.children.forEach((childNode) => {
childNode.getComponents(cc.RenderComponent).forEach((renderComponent) => { childNode.getComponents(cc.RenderComponent).forEach((renderComponent) => {
let spriteFrameRect = (<cc.Sprite>renderComponent).spriteFrame.getRect();
let material: cc.Material = renderComponent.getMaterial(0); let material: cc.Material = renderComponent.getMaterial(0);
material.setProperty("spriteWidth", spriteFrameRect.width); material.setProperty("glowColorSize", param.glowColorSize);
material.setProperty("spriteHeight", spriteFrameRect.height);
material.setProperty("glowRange", param.glowRange);
material.setProperty("glowColor", param.glowColor); material.setProperty("glowColor", param.glowColor);
material.setProperty("glowThreshold", param.glowThreshold); material.setProperty("glowThreshold", param.glowThreshold);
renderComponent.setMaterial(0, material); renderComponent.setMaterial(0, material);