diff --git a/assets/Scene/Home/Home.fire b/assets/Scene/Home/Home.fire index a3709fd..7e75e56 100755 --- a/assets/Scene/Home/Home.fire +++ b/assets/Scene/Home/Home.fire @@ -192,7 +192,7 @@ "array": [ 0, 0, - 769.0305585605815, + 452.93128617926146, 0, 0, 0, @@ -2225,7 +2225,7 @@ }, { "__type__": "cc.Node", - "_name": "SceneTransition", + "_name": "ScreenTransition", "_objFlags": 0, "_parent": { "__id__": 1 @@ -2260,8 +2260,8 @@ "__type__": "TypedArray", "ctor": "Float64Array", "array": [ - 0, - 0, + 667, + 375, 0, 0, 0, @@ -2283,7 +2283,7 @@ "_is3DNode": false, "_groupIndex": 0, "groupIndex": 0, - "_id": "eeaY/+TfZLz4P/SykmO5T3" + "_id": "e5RQj3G6VEhL2bHSWO3bD2" }, { "__type__": "1cd9dHF3nRI24w/zAzyk3Q3", @@ -2295,10 +2295,31 @@ "_enabled": true, "time": 0, "materials": [ + { + "__uuid__": "94d8d991-9e84-4d88-89f7-33d14f1bc9bf" + }, + { + "__uuid__": "c27b1317-6f94-4d6c-9760-adee279b2ad4" + }, + { + "__uuid__": "acd92272-4481-49c6-81ef-5ae28e699ecf" + }, + { + "__uuid__": "dbf06bcd-8024-4f08-a535-08f7383edf00" + }, + { + "__uuid__": "985a2d90-fd09-4d07-9d94-a50d5af116d9" + }, { "__uuid__": "a869ac13-ffed-4334-b5df-1251273f2b07" + }, + { + "__uuid__": "ee73e8c0-5ff0-486a-bcdf-dec85b04755b" + }, + { + "__uuid__": "6dd2566a-a5ef-48ff-a3a2-521163be1e1e" } ], - "_id": "606YRpjk1JGqOLoeXBmJQ3" + "_id": "e6NgBxPOVL9YQp8rpWon4s" } ] \ No newline at end of file diff --git a/assets/Scene/Home/Home.ts b/assets/Scene/Home/Home.ts index 88d862c..f725132 100644 --- a/assets/Scene/Home/Home.ts +++ b/assets/Scene/Home/Home.ts @@ -13,7 +13,6 @@ enum sceneList { 'Specular_gloss' = '镜面光泽效果(shader)', 'Metaball' = '融球效果(shader)', 'Bullet_Tracking' = '子弹跟踪效果', - 'SwitchScene__SquaresWire' = '场景切换(Squares Wire)', 'Circle_avatar' = '圆形头像(shader)', 'Coin_fly_to_wallet' = '金币落袋效果', 'Infinite_bg_scroll' = '背景无限滚动', @@ -22,6 +21,14 @@ enum sceneList { 'Joystick' = '遥控杆', 'Filter' = '颜色滤镜', 'Photo_gallery' = '渐变过渡的相册(shader)', + 'SwitchScene__DoomScreen' = '场景切换效果一', + 'SwitchScene__GlitchMemories' = '场景切换效果二', + 'SwitchScene__Morph' = '场景切换效果三', + 'SwitchScene__Perlin' = '场景切换效果四', + 'SwitchScene__PolkaDotsCurtain' = '场景切换效果五', + 'SwitchScene__SquaresWire' = '场景切换效果六', + 'SwitchScene__Strip' = '场景切换效果七', + 'SwitchScene__Wind' = '场景切换效果八', } @ccclass diff --git a/assets/Scene/Home/Transition.ts b/assets/Scene/Home/ScreenTransition.ts similarity index 93% rename from assets/Scene/Home/Transition.ts rename to assets/Scene/Home/ScreenTransition.ts index dd4c9a6..a4370cc 100644 --- a/assets/Scene/Home/Transition.ts +++ b/assets/Scene/Home/ScreenTransition.ts @@ -31,9 +31,10 @@ export default class Transition extends cc.Component { cc.director.on('switchSceneByTransition', this.switchSceneByTransition.bind(this)); } - switchSceneByTransition() { - this.materialIndex = this.materialIndex + 1 > this.materials.length ? 0 : this.materialIndex + 1; - this.loadScene('Scene/Home/Home', 'Canvas/Main Camera', 'Canvas/Main Camera'); + switchSceneByTransition(index) { + this.materialIndex = Number(index || 0); + this.updateSpriteMaterial(); + setTimeout(() => this.loadScene('Scene/Home/Home', 'Canvas/Main Camera', 'Canvas/Main Camera')); } init() { @@ -85,7 +86,8 @@ export default class Transition extends cc.Component { let newMaterial = cc.MaterialVariant.create(this.materials[this.materialIndex], this._sprite); newMaterial.setProperty('texture', this._texture1); newMaterial.setProperty('texture2', this._texture2); - newMaterial.setProperty('screenSize', new Float32Array([this._texture2.width, this._texture2.height])); + if (this.materialIndex == 6) + newMaterial.setProperty('screenSize', new Float32Array([this._texture2.width, this._texture2.height])); this._sprite.setMaterial(0, newMaterial); this._spriteMaterial = newMaterial; diff --git a/assets/Scene/Home/Transition.ts.meta b/assets/Scene/Home/ScreenTransition.ts.meta similarity index 100% rename from assets/Scene/Home/Transition.ts.meta rename to assets/Scene/Home/ScreenTransition.ts.meta diff --git a/assets/Scene/SwitchScene__SquaresWire/LocalStorage.meta b/assets/Scene/SwitchScene__DoomScreen.meta similarity index 63% rename from assets/Scene/SwitchScene__SquaresWire/LocalStorage.meta rename to assets/Scene/SwitchScene__DoomScreen.meta index 4113a4e..9b6d829 100644 --- a/assets/Scene/SwitchScene__SquaresWire/LocalStorage.meta +++ b/assets/Scene/SwitchScene__DoomScreen.meta @@ -1,6 +1,6 @@ { "ver": "1.0.1", - "uuid": "d1c25e17-c4ab-49e9-914a-946b38dc5365", + "uuid": "fc466dc2-e18c-4003-82ae-68cfc1269b29", "isSubpackage": false, "subpackageName": "", "subMetas": {} diff --git a/assets/Scene/SwitchScene__DoomScreen/Materials.meta b/assets/Scene/SwitchScene__DoomScreen/Materials.meta new file mode 100644 index 0000000..9fe8e8f --- /dev/null +++ b/assets/Scene/SwitchScene__DoomScreen/Materials.meta @@ -0,0 +1,7 @@ +{ + "ver": "1.0.1", + "uuid": "56aaf958-2440-4235-bc06-c174b6779619", + "isSubpackage": false, + "subpackageName": "", + "subMetas": {} +} \ No newline at end of file diff --git a/assets/Scene/SwitchScene__DoomScreen/Materials/DoomScreen.effect b/assets/Scene/SwitchScene__DoomScreen/Materials/DoomScreen.effect new file mode 100644 index 0000000..ba75660 --- /dev/null +++ b/assets/Scene/SwitchScene__DoomScreen/Materials/DoomScreen.effect @@ -0,0 +1,117 @@ +// Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + +CCEffect %{ + techniques: + - passes: + - vert: vs + frag: fs + blendState: + targets: + - blend: true + rasterizerState: + cullMode: none + properties: + bars: { value: 50, editor: { tooltip: "列数" }} + amplitude: { value: 2, editor: { tooltip: "速度:0向下移动时没有变化,值越高一些元素移动得更快" }} + noise: { value: 0.1, editor: { tooltip: "速度的离散程度:0 = 无噪声,1 = 噪声很大" }} + frequency: { value: 0.5, editor: { tooltip: "水平速度变化:值越大,波浪越短" }} + dripScale: { value: 0.5, editor: { tooltip: "屏幕两侧条形黏连的程度:0 = 无滴落,1 = 曲线滴落" }} + time: { value: 0 } +}% + + +CCProgram vs %{ + precision highp float; + + #include + #include + + in vec3 a_position; + in vec4 a_color; + out vec4 v_color; + + in vec2 a_uv0; + out vec2 v_uv0; + + void main () { + vec4 pos = vec4(a_position, 1); + + pos = cc_matViewProj * pos; + v_uv0 = a_uv0; + v_color = a_color; + + gl_Position = pos; + } +}% + + +CCProgram fs %{ + precision highp float; + uniform sampler2D texture; + uniform sampler2D texture2; + uniform DoomScreen { + float bars; + float amplitude; + float noise; + float frequency; + float dripScale; + float time; + }; + float progress = time; + in mediump vec2 v_uv0; + in vec4 v_color; + + vec4 getFromColor(vec2 uv) { + return texture(texture, uv); + } + vec4 getToColor(vec2 uv) { + return texture(texture2, uv); + } + float rand(int num) { + return fract(mod(float(num) * 67123.313, 12.0) * sin(float(num) * 10.3) * cos(float(num))); + } + + float wave(int num) { + // 根据传入的索引值计算波浪的频率 + float fn = float(num) * frequency * 0.1 * float(bars); + return cos(fn * 0.5) * cos(fn * 0.13) * sin((fn + 10.0) * 0.3) / 2.0 + 0.5; + } + + float drip(int num) { + // 根据传入的索引值计算滴水效果的幅度 + return sin(float(num) / float(bars - 1.0) * 3.141592) * dripScale; + } + + // 计算条的位置 + float pos(int num) { + // 如果没有噪声,则返回波浪效果;否则使用波浪效果和随机数进行混合 + return (noise == 0.0 ? wave(num) : mix(wave(num), rand(num), noise)) + (dripScale == 0.0 ? 0.0 : drip(num)); + } + + vec4 transition(vec2 uv) { + // 根据水平位置计算当前条的索引值 + int bar = int(uv.x * (float(bars))); + // 根据当前条的位置计算缩放比例和进度 + float scale = 1.0 + pos(bar) * amplitude; + float phase = progress * scale; + // 计算垂直位置的比例 + float posY = uv.y / vec2(1.0).y; + vec2 p; + vec4 c; + // 根据进度判断使用起始颜色还是目标颜色 + if (phase + posY < 1.0) { + // 根据当前条的位置和进度计算新的垂直位置 + p = vec2(uv.x, uv.y + mix(0.0, vec2(1.0).y, phase)) / vec2(1.0).xy; + // 获取起始颜色 + c = getFromColor(p); + } else { + // 获取目标颜色 + p = uv.xy / vec2(1.0).xy; + c = getToColor(p); + } + return c; + } + void main () { + gl_FragColor = v_color * transition(v_uv0); + } +}% diff --git a/assets/Scene/SwitchScene__DoomScreen/Materials/DoomScreen.effect.meta b/assets/Scene/SwitchScene__DoomScreen/Materials/DoomScreen.effect.meta new file mode 100644 index 0000000..7d24684 --- /dev/null +++ b/assets/Scene/SwitchScene__DoomScreen/Materials/DoomScreen.effect.meta @@ -0,0 +1,17 @@ +{ + "ver": "1.0.25", + "uuid": "6af67cb9-1430-48c0-8704-792a7406fa41", + "compiledShaders": [ + { + "glsl1": { + "vert": "\nprecision highp float;\nuniform mediump mat4 cc_matViewProj;\nattribute vec3 a_position;\nattribute vec4 a_color;\nvarying vec4 v_color;\nattribute vec2 a_uv0;\nvarying vec2 v_uv0;\nvoid main () {\n vec4 pos = vec4(a_position, 1);\n pos = cc_matViewProj * pos;\n v_uv0 = a_uv0;\n v_color = a_color;\n gl_Position = pos;\n}", + "frag": "\nprecision highp float;\nuniform sampler2D texture;\nuniform sampler2D texture2;\nuniform float bars;\nuniform float amplitude;\nuniform float noise;\nuniform float frequency;\nuniform float dripScale;\nuniform float time;\nfloat progress = time;\nvarying mediump vec2 v_uv0;\nvarying vec4 v_color;\nvec4 getFromColor(vec2 uv) {\n return texture2D(texture, uv);\n}\nvec4 getToColor(vec2 uv) {\n return texture2D(texture2, uv);\n}\nfloat rand(int num) {\n return fract(mod(float(num) * 67123.313, 12.0) * sin(float(num) * 10.3) * cos(float(num)));\n}\nfloat wave(int num) {\n float fn = float(num) * frequency * 0.1 * float(bars);\n return cos(fn * 0.5) * cos(fn * 0.13) * sin((fn + 10.0) * 0.3) / 2.0 + 0.5;\n}\nfloat drip(int num) {\n return sin(float(num) / float(bars - 1.0) * 3.141592) * dripScale;\n}\nfloat pos(int num) {\n return (noise == 0.0 ? wave(num) : mix(wave(num), rand(num), noise)) + (dripScale == 0.0 ? 0.0 : drip(num));\n}\nvec4 transition(vec2 uv) {\n int bar = int(uv.x * (float(bars)));\n float scale = 1.0 + pos(bar) * amplitude;\n float phase = progress * scale;\n float posY = uv.y / vec2(1.0).y;\n vec2 p;\n vec4 c;\n if (phase + posY < 1.0) {\n p = vec2(uv.x, uv.y + mix(0.0, vec2(1.0).y, phase)) / vec2(1.0).xy;\n c = getFromColor(p);\n } else {\n p = uv.xy / vec2(1.0).xy;\n c = getToColor(p);\n }\n return c;\n}\nvoid main () {\n gl_FragColor = v_color * transition(v_uv0);\n}" + }, + "glsl3": { + "vert": "\nprecision highp float;\nuniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_nativeSize;\n highp mat4 cc_matView;\n mediump mat4 cc_matViewInv;\n mediump mat4 cc_matProj;\n mediump mat4 cc_matProjInv;\n mediump mat4 cc_matViewProj;\n mediump mat4 cc_matViewProjInv;\n mediump vec4 cc_cameraPos;\n};\nuniform CCLocal {\n mat4 cc_matWorld;\n mat4 cc_matWorldIT;\n};\nin vec3 a_position;\nin vec4 a_color;\nout vec4 v_color;\nin vec2 a_uv0;\nout vec2 v_uv0;\nvoid main () {\n vec4 pos = vec4(a_position, 1);\n pos = cc_matViewProj * pos;\n v_uv0 = a_uv0;\n v_color = a_color;\n gl_Position = pos;\n}", + "frag": "\nprecision highp float;\nuniform sampler2D texture;\nuniform sampler2D texture2;\nuniform DoomScreen {\n float bars;\n float amplitude;\n float noise;\n float frequency;\n float dripScale;\n float time;\n};\nfloat progress = time;\nin mediump vec2 v_uv0;\nin vec4 v_color;\nvec4 getFromColor(vec2 uv) {\n return texture(texture, uv);\n}\nvec4 getToColor(vec2 uv) {\n return texture(texture2, uv);\n}\nfloat rand(int num) {\n return fract(mod(float(num) * 67123.313, 12.0) * sin(float(num) * 10.3) * cos(float(num)));\n}\nfloat wave(int num) {\n float fn = float(num) * frequency * 0.1 * float(bars);\n return cos(fn * 0.5) * cos(fn * 0.13) * sin((fn + 10.0) * 0.3) / 2.0 + 0.5;\n}\nfloat drip(int num) {\n return sin(float(num) / float(bars - 1.0) * 3.141592) * dripScale;\n}\nfloat pos(int num) {\n return (noise == 0.0 ? wave(num) : mix(wave(num), rand(num), noise)) + (dripScale == 0.0 ? 0.0 : drip(num));\n}\nvec4 transition(vec2 uv) {\n int bar = int(uv.x * (float(bars)));\n float scale = 1.0 + pos(bar) * amplitude;\n float phase = progress * scale;\n float posY = uv.y / vec2(1.0).y;\n vec2 p;\n vec4 c;\n if (phase + posY < 1.0) {\n p = vec2(uv.x, uv.y + mix(0.0, vec2(1.0).y, phase)) / vec2(1.0).xy;\n c = getFromColor(p);\n } else {\n p = uv.xy / vec2(1.0).xy;\n c = getToColor(p);\n }\n return c;\n}\nvoid main () {\n gl_FragColor = v_color * transition(v_uv0);\n}" + } + } + ], + "subMetas": {} +} \ No newline at end of file diff --git a/assets/Scene/SwitchScene__DoomScreen/Materials/DoomScreen.mtl b/assets/Scene/SwitchScene__DoomScreen/Materials/DoomScreen.mtl new file mode 100644 index 0000000..92e2eab --- /dev/null +++ b/assets/Scene/SwitchScene__DoomScreen/Materials/DoomScreen.mtl @@ -0,0 +1,24 @@ +{ + "__type__": "cc.Material", + "_name": "DoomScreen", + "_objFlags": 0, + "_native": "", + "_effectAsset": { + "__uuid__": "6af67cb9-1430-48c0-8704-792a7406fa41" + }, + "_techniqueIndex": 0, + "_techniqueData": { + "0": { + "defines": {}, + "props": { + "bars": 50, + "texture": { + "__uuid__": "bdc5b1b7-faf4-4186-9895-f5ee7ed31093" + }, + "texture2": { + "__uuid__": "c8b7f468-dad7-41d2-892a-13b1e106ec06" + } + } + } + } +} \ No newline at end of file diff --git a/assets/Scene/SwitchScene__DoomScreen/Materials/DoomScreen.mtl.meta b/assets/Scene/SwitchScene__DoomScreen/Materials/DoomScreen.mtl.meta new file mode 100644 index 0000000..43149b6 --- /dev/null +++ b/assets/Scene/SwitchScene__DoomScreen/Materials/DoomScreen.mtl.meta @@ -0,0 +1,6 @@ +{ + "ver": "1.0.3", + "uuid": "94d8d991-9e84-4d88-89f7-33d14f1bc9bf", + "dataAsSubAsset": null, + "subMetas": {} +} \ No newline at end of file diff --git a/assets/Scene/SwitchScene__SquaresWire/SwitchScene.ts b/assets/Scene/SwitchScene__DoomScreen/SwitchScene.ts similarity index 94% rename from assets/Scene/SwitchScene__SquaresWire/SwitchScene.ts rename to assets/Scene/SwitchScene__DoomScreen/SwitchScene.ts index e8e26c0..baa8cf3 100644 --- a/assets/Scene/SwitchScene__SquaresWire/SwitchScene.ts +++ b/assets/Scene/SwitchScene__DoomScreen/SwitchScene.ts @@ -25,9 +25,9 @@ export default class SwitchScene extends cc.Component { this.node.on(cc.Node.EventType.TOUCH_MOVE, this.onTouchMove, this); } - switchSceneByTransition() { + switchSceneByTransition(event, value) { cc.director.emit('setBackBtnVisibility', false); - cc.director.emit('switchSceneByTransition'); + cc.director.emit('switchSceneByTransition', value); } playTransitionAnimation() { @@ -78,7 +78,6 @@ export default class SwitchScene extends cc.Component { let newMaterial = cc.MaterialVariant.create(this.material, this.bgSprite); newMaterial.setProperty('texture', this.spriteFrame1._texture); newMaterial.setProperty('texture2', this.spriteFrame2._texture); - newMaterial.setProperty('screenSize', new Float32Array([cc.winSize.width, cc.winSize.height])); newMaterial.setProperty('time', 0.25); this.spriteFrame1._texture.setFlipY(true); diff --git a/assets/Scene/SwitchScene__SquaresWire/SwitchScene.ts.meta b/assets/Scene/SwitchScene__DoomScreen/SwitchScene.ts.meta similarity index 74% rename from assets/Scene/SwitchScene__SquaresWire/SwitchScene.ts.meta rename to assets/Scene/SwitchScene__DoomScreen/SwitchScene.ts.meta index 25cafeb..d8f4b5a 100644 --- a/assets/Scene/SwitchScene__SquaresWire/SwitchScene.ts.meta +++ b/assets/Scene/SwitchScene__DoomScreen/SwitchScene.ts.meta @@ -1,6 +1,6 @@ { "ver": "1.0.5", - "uuid": "d3f4aa83-177e-4b31-b4f8-168797fa6b26", + "uuid": "de7b06f3-2c55-4d64-bf64-8262f16171ce", "isPlugin": false, "loadPluginInWeb": true, "loadPluginInNative": true, diff --git a/assets/Scene/SwitchScene__DoomScreen/SwitchScene__DoomScreen.fire b/assets/Scene/SwitchScene__DoomScreen/SwitchScene__DoomScreen.fire new file mode 100644 index 0000000..47946c7 --- /dev/null +++ b/assets/Scene/SwitchScene__DoomScreen/SwitchScene__DoomScreen.fire @@ -0,0 +1,740 @@ +[ + { + "__type__": "cc.SceneAsset", + "_name": "", + "_objFlags": 0, + "_native": "", + "scene": { + "__id__": 1 + } + }, + { + "__type__": "cc.Scene", + "_objFlags": 0, + "_parent": null, + "_children": [ + { + "__id__": 2 + }, + { + "__id__": 11 + }, + { + "__id__": 13 + }, + { + "__id__": 8 + } + ], + "_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": "832db263-aa28-48b6-ae75-8a0721103b06" + }, + { + "__type__": "cc.Node", + "_name": "Canvas", + "_objFlags": 512, + "_parent": { + "__id__": 1 + }, + "_children": [ + { + "__id__": 3 + } + ], + "_active": true, + "_components": [ + { + "__id__": 5 + }, + { + "__id__": 6 + }, + { + "__id__": 7 + } + ], + "_prefab": null, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 1334, + "height": 750 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + 667, + 375, + 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": "a5esZu+45LA5mBpvttspPD" + }, + { + "__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": 960, + "height": 640 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + 0, + 0, + 452.93128617926146, + 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": "e1WoFrQ79G7r4ZuQE3HlNb" + }, + { + "__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": "81GN3uXINKVLeW4+iKSlim" + }, + { + "__type__": "cc.Canvas", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 2 + }, + "_enabled": true, + "_designResolution": { + "__type__": "cc.Size", + "width": 1334, + "height": 750 + }, + "_fitWidth": false, + "_fitHeight": true, + "_id": "59Cd0ovbdF4byw5sbjJDx7" + }, + { + "__type__": "cc.Widget", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 2 + }, + "_enabled": true, + "alignMode": 1, + "_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": 0, + "_originalHeight": 0, + "_id": "29zXboiXFBKoIV4PQ2liTe" + }, + { + "__type__": "de7b0bzLFVNZL9kgmLxYXHO", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 2 + }, + "_enabled": true, + "separator": { + "__id__": 8 + }, + "spriteFrame1": { + "__uuid__": "5c7f62b2-44b3-4ef2-b133-825e35b654ec" + }, + "spriteFrame2": { + "__uuid__": "145047e6-73a5-4a19-bd7c-9dee1e5bc19f" + }, + "bgSprite": { + "__id__": 10 + }, + "material": { + "__uuid__": "94d8d991-9e84-4d88-89f7-33d14f1bc9bf" + }, + "_id": "bcrHoyt8lHbpmm6ciYSB5M" + }, + { + "__type__": "cc.Node", + "_name": "Separator", + "_objFlags": 0, + "_parent": { + "__id__": 1 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 9 + } + ], + "_prefab": null, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 171, + "b": 23, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 10, + "height": 750 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + 333, + 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": "00zwOFnw9A9Y2jJcAfpxGt" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 8 + }, + "_enabled": true, + "_materials": [ + { + "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432" + } + ], + "_srcBlendFactor": 770, + "_dstBlendFactor": 771, + "_spriteFrame": { + "__uuid__": "5c3bb932-6c3c-468f-88a9-c8c61d458641" + }, + "_type": 0, + "_sizeMode": 0, + "_fillType": 0, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": true, + "_atlas": null, + "_id": "bfovdQprtLZrbQA9328iTr" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 11 + }, + "_enabled": true, + "_materials": [ + { + "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432" + } + ], + "_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": "b70P96s8FD1LitaZ7aobMA" + }, + { + "__type__": "cc.Node", + "_name": "Bg", + "_objFlags": 0, + "_parent": { + "__id__": 1 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 10 + }, + { + "__id__": 12 + } + ], + "_prefab": null, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 1334, + "height": 750 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + 667, + 375, + 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": "34YKVYdF5MoYlFN+Zfb6wk" + }, + { + "__type__": "cc.Widget", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 11 + }, + "_enabled": true, + "alignMode": 1, + "_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": 1024, + "_originalHeight": 445, + "_id": "711M5JfuBPs5F7P5bDVb/1" + }, + { + "__type__": "cc.Node", + "_name": "Btn", + "_objFlags": 0, + "_parent": { + "__id__": 1 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 14 + }, + { + "__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": 1477, + "height": 118 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + 667, + 528.7, + 0, + 0, + 0, + 0, + 1, + 0.7, + 0.7, + 1 + ] + }, + "_eulerAngles": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_skewX": 0, + "_skewY": 0, + "_is3DNode": false, + "_groupIndex": 0, + "groupIndex": 0, + "_id": "bcVNNAEfFEJL7tftaCUB7n" + }, + { + "__type__": "cc.Button", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 13 + }, + "_enabled": true, + "_normalMaterial": null, + "_grayMaterial": null, + "duration": 0.1, + "zoomScale": 1.2, + "clickEvents": [ + { + "__id__": 15 + } + ], + "_N$interactable": true, + "_N$enableAutoGrayEffect": false, + "_N$transition": 0, + "transition": 0, + "_N$normalColor": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_N$pressedColor": { + "__type__": "cc.Color", + "r": 211, + "g": 211, + "b": 211, + "a": 255 + }, + "pressedColor": { + "__type__": "cc.Color", + "r": 211, + "g": 211, + "b": 211, + "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": 124, + "g": 124, + "b": 124, + "a": 255 + }, + "_N$normalSprite": null, + "_N$pressedSprite": null, + "pressedSprite": null, + "_N$hoverSprite": null, + "hoverSprite": null, + "_N$disabledSprite": null, + "_N$target": { + "__id__": 13 + }, + "_id": "fdJg28i7pE6pi4D1ovRRp0" + }, + { + "__type__": "cc.ClickEvent", + "target": { + "__id__": 2 + }, + "component": "", + "_componentId": "de7b0bzLFVNZL9kgmLxYXHO", + "handler": "switchSceneByTransition", + "customEventData": "0" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 13 + }, + "_enabled": true, + "_materials": [ + { + "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432" + } + ], + "_srcBlendFactor": 770, + "_dstBlendFactor": 771, + "_spriteFrame": { + "__uuid__": "86714285-13db-44f6-86aa-11838e0d4831" + }, + "_type": 0, + "_sizeMode": 1, + "_fillType": 0, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": true, + "_atlas": null, + "_id": "c1sR5klVZHraEr68/UTkLE" + }, + { + "__type__": "cc.Widget", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 13 + }, + "_enabled": true, + "alignMode": 1, + "_target": null, + "_alignFlags": 17, + "_left": 0, + "_right": 0, + "_top": 180, + "_bottom": 0, + "_verticalCenter": 157.942, + "_horizontalCenter": 0, + "_isAbsLeft": true, + "_isAbsRight": true, + "_isAbsTop": true, + "_isAbsBottom": true, + "_isAbsHorizontalCenter": true, + "_isAbsVerticalCenter": true, + "_originalWidth": 0, + "_originalHeight": 0, + "_id": "a6rm0uXY9DlbNNnoWq9hN0" + } +] \ No newline at end of file diff --git a/assets/Scene/SwitchScene__DoomScreen/SwitchScene__DoomScreen.fire.meta b/assets/Scene/SwitchScene__DoomScreen/SwitchScene__DoomScreen.fire.meta new file mode 100644 index 0000000..da496a8 --- /dev/null +++ b/assets/Scene/SwitchScene__DoomScreen/SwitchScene__DoomScreen.fire.meta @@ -0,0 +1,7 @@ +{ + "ver": "1.2.6", + "uuid": "832db263-aa28-48b6-ae75-8a0721103b06", + "asyncLoadAssets": false, + "autoReleaseAssets": false, + "subMetas": {} +} \ No newline at end of file diff --git a/assets/Scene/SwitchScene__DoomScreen/Texture.meta b/assets/Scene/SwitchScene__DoomScreen/Texture.meta new file mode 100644 index 0000000..705dc09 --- /dev/null +++ b/assets/Scene/SwitchScene__DoomScreen/Texture.meta @@ -0,0 +1,7 @@ +{ + "ver": "1.0.1", + "uuid": "b8632817-6ac9-4af9-a8dc-8c391dd859e6", + "isSubpackage": false, + "subpackageName": "", + "subMetas": {} +} \ No newline at end of file diff --git a/assets/Scene/SwitchScene__DoomScreen/Texture/bg1.jpeg b/assets/Scene/SwitchScene__DoomScreen/Texture/bg1.jpeg new file mode 100644 index 0000000..f905b16 Binary files /dev/null and b/assets/Scene/SwitchScene__DoomScreen/Texture/bg1.jpeg differ diff --git a/assets/Scene/SwitchScene__DoomScreen/Texture/bg1.jpeg.meta b/assets/Scene/SwitchScene__DoomScreen/Texture/bg1.jpeg.meta new file mode 100644 index 0000000..b330da3 --- /dev/null +++ b/assets/Scene/SwitchScene__DoomScreen/Texture/bg1.jpeg.meta @@ -0,0 +1,36 @@ +{ + "ver": "2.3.4", + "uuid": "fba8ea3c-e39c-495c-a135-ccb2c418ca04", + "type": "sprite", + "wrapMode": "clamp", + "filterMode": "bilinear", + "premultiplyAlpha": false, + "genMipmaps": false, + "packable": true, + "width": 1600, + "height": 1200, + "platformSettings": {}, + "subMetas": { + "bg1": { + "ver": "1.0.4", + "uuid": "5c7f62b2-44b3-4ef2-b133-825e35b654ec", + "rawTextureUuid": "fba8ea3c-e39c-495c-a135-ccb2c418ca04", + "trimType": "auto", + "trimThreshold": 1, + "rotated": false, + "offsetX": 0, + "offsetY": 0, + "trimX": 0, + "trimY": 0, + "width": 1600, + "height": 1200, + "rawWidth": 1600, + "rawHeight": 1200, + "borderTop": 0, + "borderBottom": 0, + "borderLeft": 0, + "borderRight": 0, + "subMetas": {} + } + } +} \ No newline at end of file diff --git a/assets/Scene/SwitchScene__DoomScreen/Texture/bg2.jpeg b/assets/Scene/SwitchScene__DoomScreen/Texture/bg2.jpeg new file mode 100644 index 0000000..a5a3c9c Binary files /dev/null and b/assets/Scene/SwitchScene__DoomScreen/Texture/bg2.jpeg differ diff --git a/assets/Scene/SwitchScene__DoomScreen/Texture/bg2.jpeg.meta b/assets/Scene/SwitchScene__DoomScreen/Texture/bg2.jpeg.meta new file mode 100644 index 0000000..d06d017 --- /dev/null +++ b/assets/Scene/SwitchScene__DoomScreen/Texture/bg2.jpeg.meta @@ -0,0 +1,36 @@ +{ + "ver": "2.3.4", + "uuid": "508bd902-9298-4b07-a5a9-883e21c06a45", + "type": "sprite", + "wrapMode": "clamp", + "filterMode": "bilinear", + "premultiplyAlpha": false, + "genMipmaps": false, + "packable": true, + "width": 1600, + "height": 1200, + "platformSettings": {}, + "subMetas": { + "bg2": { + "ver": "1.0.4", + "uuid": "145047e6-73a5-4a19-bd7c-9dee1e5bc19f", + "rawTextureUuid": "508bd902-9298-4b07-a5a9-883e21c06a45", + "trimType": "auto", + "trimThreshold": 1, + "rotated": false, + "offsetX": 0, + "offsetY": 0, + "trimX": 0, + "trimY": 0, + "width": 1600, + "height": 1200, + "rawWidth": 1600, + "rawHeight": 1200, + "borderTop": 0, + "borderBottom": 0, + "borderLeft": 0, + "borderRight": 0, + "subMetas": {} + } + } +} \ No newline at end of file diff --git a/assets/Scene/SwitchScene__DoomScreen/Texture/btn.png b/assets/Scene/SwitchScene__DoomScreen/Texture/btn.png new file mode 100644 index 0000000..bc4283d Binary files /dev/null and b/assets/Scene/SwitchScene__DoomScreen/Texture/btn.png differ diff --git a/assets/Scene/SwitchScene__DoomScreen/Texture/btn.png.meta b/assets/Scene/SwitchScene__DoomScreen/Texture/btn.png.meta new file mode 100644 index 0000000..0f41d89 --- /dev/null +++ b/assets/Scene/SwitchScene__DoomScreen/Texture/btn.png.meta @@ -0,0 +1,36 @@ +{ + "ver": "2.3.4", + "uuid": "eb7a2ae2-9809-4852-adee-c3a96203ddd4", + "type": "sprite", + "wrapMode": "clamp", + "filterMode": "bilinear", + "premultiplyAlpha": false, + "genMipmaps": false, + "packable": true, + "width": 1477, + "height": 118, + "platformSettings": {}, + "subMetas": { + "btn": { + "ver": "1.0.4", + "uuid": "5c37c465-ad63-440a-a30a-7ce4938e0fb9", + "rawTextureUuid": "eb7a2ae2-9809-4852-adee-c3a96203ddd4", + "trimType": "auto", + "trimThreshold": 1, + "rotated": false, + "offsetX": 0, + "offsetY": 0, + "trimX": 0, + "trimY": 0, + "width": 1477, + "height": 118, + "rawWidth": 1477, + "rawHeight": 118, + "borderTop": 0, + "borderBottom": 0, + "borderLeft": 0, + "borderRight": 0, + "subMetas": {} + } + } +} \ No newline at end of file diff --git a/assets/Scene/SwitchScene__GlitchMemories.meta b/assets/Scene/SwitchScene__GlitchMemories.meta new file mode 100644 index 0000000..d0a55e3 --- /dev/null +++ b/assets/Scene/SwitchScene__GlitchMemories.meta @@ -0,0 +1,7 @@ +{ + "ver": "1.0.1", + "uuid": "10b61f45-6dcc-47e8-87cf-1859b81ee17b", + "isSubpackage": false, + "subpackageName": "", + "subMetas": {} +} \ No newline at end of file diff --git a/assets/Scene/SwitchScene__GlitchMemories/Materials.meta b/assets/Scene/SwitchScene__GlitchMemories/Materials.meta new file mode 100644 index 0000000..e1be054 --- /dev/null +++ b/assets/Scene/SwitchScene__GlitchMemories/Materials.meta @@ -0,0 +1,7 @@ +{ + "ver": "1.0.1", + "uuid": "04fc26da-4e75-425b-809a-430d8b20b029", + "isSubpackage": false, + "subpackageName": "", + "subMetas": {} +} \ No newline at end of file diff --git a/assets/Scene/SwitchScene__GlitchMemories/Materials/GlitchMemories.effect b/assets/Scene/SwitchScene__GlitchMemories/Materials/GlitchMemories.effect new file mode 100644 index 0000000..97f4c1e --- /dev/null +++ b/assets/Scene/SwitchScene__GlitchMemories/Materials/GlitchMemories.effect @@ -0,0 +1,94 @@ +// 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 } + time: {value: 0} +}% + +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; + uniform sampler2D texture; + uniform sampler2D texture2; + uniform Common { + float time; + }; + float progress = time; + in mediump vec2 v_uv0; + in vec4 v_color; + + vec4 getFromColor(vec2 uv) { + return texture(texture, uv); + } + vec4 getToColor(vec2 uv) { + return texture(texture2, uv); + } + + vec4 transition(vec2 p) { + // 计算块索引,每个块大小为16x16 + vec2 block = floor(p.xy / vec2(16)); + // 计算UV噪声,根据进度调整UV噪声 + vec2 uv_noise = block / vec2(64); + uv_noise += floor(vec2(progress) * vec2(1200.0, 3500.0)) / vec2(64); + // 计算扭曲距离,并算出各颜色通道的偏移值 + vec2 dist = progress > 0.0 ? (fract(uv_noise) - 0.5) * 0.3 * (1.0 - progress) : vec2(0.0); + vec2 red = p + dist * 0.2; + vec2 green = p + dist * 0.3; + vec2 blue = p + dist * 0.5; + + return vec4( + mix(getFromColor(red).r, getToColor(red).r, progress), + mix(getFromColor(green).g, getToColor(green).g, progress), + mix(getFromColor(blue).b, getToColor(blue).b, progress), + 1.0 + ); +} + + + void main () { + gl_FragColor = v_color * transition(v_uv0); + } +}% diff --git a/assets/Scene/SwitchScene__GlitchMemories/Materials/GlitchMemories.effect.meta b/assets/Scene/SwitchScene__GlitchMemories/Materials/GlitchMemories.effect.meta new file mode 100644 index 0000000..9243856 --- /dev/null +++ b/assets/Scene/SwitchScene__GlitchMemories/Materials/GlitchMemories.effect.meta @@ -0,0 +1,17 @@ +{ + "ver": "1.0.25", + "uuid": "478d6745-6406-4f03-84f4-194af9a5b89c", + "compiledShaders": [ + { + "glsl1": { + "vert": "\nprecision highp float;\nuniform mediump mat4 cc_matViewProj;\nuniform mat4 cc_matWorld;\nattribute vec3 a_position;\nattribute vec4 a_color;\nvarying vec4 v_color;\n#if USE_TEXTURE\nattribute vec2 a_uv0;\nvarying vec2 v_uv0;\n#endif\nvoid main () {\n vec4 pos = vec4(a_position, 1);\n #if CC_USE_MODEL\n pos = cc_matViewProj * cc_matWorld * pos;\n #else\n pos = cc_matViewProj * pos;\n #endif\n #if USE_TEXTURE\n v_uv0 = a_uv0;\n #endif\n v_color = a_color;\n gl_Position = pos;\n}", + "frag": "\n precision highp float;\n uniform sampler2D texture;\n uniform sampler2D texture2;\n uniform float time;\n float progress = time;\n varying mediump vec2 v_uv0;\n varying vec4 v_color;\n vec4 getFromColor(vec2 uv) {\n return texture2D(texture, uv);\n }\n vec4 getToColor(vec2 uv) {\n return texture2D(texture2, uv);\n }\n vec4 transition(vec2 p) {\n vec2 block = floor(p.xy / vec2(16));\n vec2 uv_noise = block / vec2(64);\n uv_noise += floor(vec2(progress) * vec2(1200.0, 3500.0)) / vec2(64);\n vec2 dist = progress > 0.0 ? (fract(uv_noise) - 0.5) * 0.3 * (1.0 - progress) : vec2(0.0);\n vec2 red = p + dist * 0.2;\n vec2 green = p + dist * 0.3;\n vec2 blue = p + dist * 0.5;\n return vec4(\n mix(getFromColor(red).r, getToColor(red).r, progress),\n mix(getFromColor(green).g, getToColor(green).g, progress),\n mix(getFromColor(blue).b, getToColor(blue).b, progress),\n 1.0\n );\n}\n void main () {\n gl_FragColor = v_color * transition(v_uv0);\n }" + }, + "glsl3": { + "vert": "\nprecision highp float;\nuniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_nativeSize;\n highp mat4 cc_matView;\n mediump mat4 cc_matViewInv;\n mediump mat4 cc_matProj;\n mediump mat4 cc_matProjInv;\n mediump mat4 cc_matViewProj;\n mediump mat4 cc_matViewProjInv;\n mediump vec4 cc_cameraPos;\n};\nuniform CCLocal {\n mat4 cc_matWorld;\n mat4 cc_matWorldIT;\n};\nin vec3 a_position;\nin vec4 a_color;\nout vec4 v_color;\n#if USE_TEXTURE\nin vec2 a_uv0;\nout vec2 v_uv0;\n#endif\nvoid main () {\n vec4 pos = vec4(a_position, 1);\n #if CC_USE_MODEL\n pos = cc_matViewProj * cc_matWorld * pos;\n #else\n pos = cc_matViewProj * pos;\n #endif\n #if USE_TEXTURE\n v_uv0 = a_uv0;\n #endif\n v_color = a_color;\n gl_Position = pos;\n}", + "frag": "\n precision highp float;\n uniform sampler2D texture;\n uniform sampler2D texture2;\n uniform Common {\n float time;\n };\n float progress = time;\n in mediump vec2 v_uv0;\n in vec4 v_color;\n vec4 getFromColor(vec2 uv) {\n return texture(texture, uv);\n }\n vec4 getToColor(vec2 uv) {\n return texture(texture2, uv);\n }\n vec4 transition(vec2 p) {\n vec2 block = floor(p.xy / vec2(16));\n vec2 uv_noise = block / vec2(64);\n uv_noise += floor(vec2(progress) * vec2(1200.0, 3500.0)) / vec2(64);\n vec2 dist = progress > 0.0 ? (fract(uv_noise) - 0.5) * 0.3 * (1.0 - progress) : vec2(0.0);\n vec2 red = p + dist * 0.2;\n vec2 green = p + dist * 0.3;\n vec2 blue = p + dist * 0.5;\n return vec4(\n mix(getFromColor(red).r, getToColor(red).r, progress),\n mix(getFromColor(green).g, getToColor(green).g, progress),\n mix(getFromColor(blue).b, getToColor(blue).b, progress),\n 1.0\n );\n}\n void main () {\n gl_FragColor = v_color * transition(v_uv0);\n }" + } + } + ], + "subMetas": {} +} \ No newline at end of file diff --git a/assets/Scene/SwitchScene__GlitchMemories/Materials/GlitchMemories.mtl b/assets/Scene/SwitchScene__GlitchMemories/Materials/GlitchMemories.mtl new file mode 100644 index 0000000..0b104da --- /dev/null +++ b/assets/Scene/SwitchScene__GlitchMemories/Materials/GlitchMemories.mtl @@ -0,0 +1,17 @@ +{ + "__type__": "cc.Material", + "_name": "GlitchMemories", + "_objFlags": 0, + "_native": "", + "_effectAsset": { + "__uuid__": "478d6745-6406-4f03-84f4-194af9a5b89c" + }, + "_techniqueIndex": 0, + "_techniqueData": { + "0": { + "defines": { + "USE_TEXTURE": true + } + } + } +} \ No newline at end of file diff --git a/assets/Scene/SwitchScene__GlitchMemories/Materials/GlitchMemories.mtl.meta b/assets/Scene/SwitchScene__GlitchMemories/Materials/GlitchMemories.mtl.meta new file mode 100644 index 0000000..3161e46 --- /dev/null +++ b/assets/Scene/SwitchScene__GlitchMemories/Materials/GlitchMemories.mtl.meta @@ -0,0 +1,6 @@ +{ + "ver": "1.0.3", + "uuid": "c27b1317-6f94-4d6c-9760-adee279b2ad4", + "dataAsSubAsset": null, + "subMetas": {} +} \ No newline at end of file diff --git a/assets/Scene/SwitchScene__GlitchMemories/SwitchScene__GlitchMemories.fire b/assets/Scene/SwitchScene__GlitchMemories/SwitchScene__GlitchMemories.fire new file mode 100644 index 0000000..bbf2f1b --- /dev/null +++ b/assets/Scene/SwitchScene__GlitchMemories/SwitchScene__GlitchMemories.fire @@ -0,0 +1,740 @@ +[ + { + "__type__": "cc.SceneAsset", + "_name": "", + "_objFlags": 0, + "_native": "", + "scene": { + "__id__": 1 + } + }, + { + "__type__": "cc.Scene", + "_objFlags": 0, + "_parent": null, + "_children": [ + { + "__id__": 2 + }, + { + "__id__": 11 + }, + { + "__id__": 13 + }, + { + "__id__": 8 + } + ], + "_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": "41a713ba-b1bd-4205-a42a-b1376223ce28" + }, + { + "__type__": "cc.Node", + "_name": "Canvas", + "_objFlags": 512, + "_parent": { + "__id__": 1 + }, + "_children": [ + { + "__id__": 3 + } + ], + "_active": true, + "_components": [ + { + "__id__": 5 + }, + { + "__id__": 6 + }, + { + "__id__": 7 + } + ], + "_prefab": null, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 1334, + "height": 750 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + 667, + 375, + 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": "a5esZu+45LA5mBpvttspPD" + }, + { + "__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": 960, + "height": 640 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + 0, + 0, + 452.93128617926146, + 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": "e1WoFrQ79G7r4ZuQE3HlNb" + }, + { + "__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": "81GN3uXINKVLeW4+iKSlim" + }, + { + "__type__": "cc.Canvas", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 2 + }, + "_enabled": true, + "_designResolution": { + "__type__": "cc.Size", + "width": 1334, + "height": 750 + }, + "_fitWidth": false, + "_fitHeight": true, + "_id": "59Cd0ovbdF4byw5sbjJDx7" + }, + { + "__type__": "cc.Widget", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 2 + }, + "_enabled": true, + "alignMode": 1, + "_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": 0, + "_originalHeight": 0, + "_id": "29zXboiXFBKoIV4PQ2liTe" + }, + { + "__type__": "293d9TMqSxFybRwQO1/AgoY", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 2 + }, + "_enabled": true, + "separator": { + "__id__": 8 + }, + "spriteFrame1": { + "__uuid__": "a448d81c-fa36-426d-affc-78eedc0b3118" + }, + "spriteFrame2": { + "__uuid__": "50328db8-b67b-4c51-a2b3-92fbc75407ad" + }, + "bgSprite": { + "__id__": 10 + }, + "material": { + "__uuid__": "c27b1317-6f94-4d6c-9760-adee279b2ad4" + }, + "_id": "eb4Wz3kaFGxZqO55QRBDxx" + }, + { + "__type__": "cc.Node", + "_name": "Separator", + "_objFlags": 0, + "_parent": { + "__id__": 1 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 9 + } + ], + "_prefab": null, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 171, + "b": 23, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 10, + "height": 750 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + 333, + 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": "00zwOFnw9A9Y2jJcAfpxGt" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 8 + }, + "_enabled": true, + "_materials": [ + { + "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432" + } + ], + "_srcBlendFactor": 770, + "_dstBlendFactor": 771, + "_spriteFrame": { + "__uuid__": "5c3bb932-6c3c-468f-88a9-c8c61d458641" + }, + "_type": 0, + "_sizeMode": 0, + "_fillType": 0, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": true, + "_atlas": null, + "_id": "bfovdQprtLZrbQA9328iTr" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 11 + }, + "_enabled": true, + "_materials": [ + { + "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432" + } + ], + "_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": "b70P96s8FD1LitaZ7aobMA" + }, + { + "__type__": "cc.Node", + "_name": "Bg", + "_objFlags": 0, + "_parent": { + "__id__": 1 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 10 + }, + { + "__id__": 12 + } + ], + "_prefab": null, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 1334, + "height": 750 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + 667, + 375, + 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": "34YKVYdF5MoYlFN+Zfb6wk" + }, + { + "__type__": "cc.Widget", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 11 + }, + "_enabled": true, + "alignMode": 1, + "_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": 1024, + "_originalHeight": 445, + "_id": "711M5JfuBPs5F7P5bDVb/1" + }, + { + "__type__": "cc.Node", + "_name": "Btn", + "_objFlags": 0, + "_parent": { + "__id__": 1 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 14 + }, + { + "__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": 1477, + "height": 118 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + 667, + 528.7, + 0, + 0, + 0, + 0, + 1, + 0.7, + 0.7, + 1 + ] + }, + "_eulerAngles": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_skewX": 0, + "_skewY": 0, + "_is3DNode": false, + "_groupIndex": 0, + "groupIndex": 0, + "_id": "bcVNNAEfFEJL7tftaCUB7n" + }, + { + "__type__": "cc.Button", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 13 + }, + "_enabled": true, + "_normalMaterial": null, + "_grayMaterial": null, + "duration": 0.1, + "zoomScale": 1.2, + "clickEvents": [ + { + "__id__": 15 + } + ], + "_N$interactable": true, + "_N$enableAutoGrayEffect": false, + "_N$transition": 0, + "transition": 0, + "_N$normalColor": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_N$pressedColor": { + "__type__": "cc.Color", + "r": 211, + "g": 211, + "b": 211, + "a": 255 + }, + "pressedColor": { + "__type__": "cc.Color", + "r": 211, + "g": 211, + "b": 211, + "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": 124, + "g": 124, + "b": 124, + "a": 255 + }, + "_N$normalSprite": null, + "_N$pressedSprite": null, + "pressedSprite": null, + "_N$hoverSprite": null, + "hoverSprite": null, + "_N$disabledSprite": null, + "_N$target": { + "__id__": 13 + }, + "_id": "fdJg28i7pE6pi4D1ovRRp0" + }, + { + "__type__": "cc.ClickEvent", + "target": { + "__id__": 2 + }, + "component": "", + "_componentId": "293d9TMqSxFybRwQO1/AgoY", + "handler": "switchSceneByTransition", + "customEventData": "1" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 13 + }, + "_enabled": true, + "_materials": [ + { + "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432" + } + ], + "_srcBlendFactor": 770, + "_dstBlendFactor": 771, + "_spriteFrame": { + "__uuid__": "86714285-13db-44f6-86aa-11838e0d4831" + }, + "_type": 0, + "_sizeMode": 1, + "_fillType": 0, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": true, + "_atlas": null, + "_id": "c1sR5klVZHraEr68/UTkLE" + }, + { + "__type__": "cc.Widget", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 13 + }, + "_enabled": true, + "alignMode": 1, + "_target": null, + "_alignFlags": 17, + "_left": 0, + "_right": 0, + "_top": 180, + "_bottom": 0, + "_verticalCenter": 157.942, + "_horizontalCenter": 0, + "_isAbsLeft": true, + "_isAbsRight": true, + "_isAbsTop": true, + "_isAbsBottom": true, + "_isAbsHorizontalCenter": true, + "_isAbsVerticalCenter": true, + "_originalWidth": 0, + "_originalHeight": 0, + "_id": "a6rm0uXY9DlbNNnoWq9hN0" + } +] \ No newline at end of file diff --git a/assets/Scene/SwitchScene__GlitchMemories/SwitchScene__GlitchMemories.fire.meta b/assets/Scene/SwitchScene__GlitchMemories/SwitchScene__GlitchMemories.fire.meta new file mode 100644 index 0000000..67b591f --- /dev/null +++ b/assets/Scene/SwitchScene__GlitchMemories/SwitchScene__GlitchMemories.fire.meta @@ -0,0 +1,7 @@ +{ + "ver": "1.2.6", + "uuid": "41a713ba-b1bd-4205-a42a-b1376223ce28", + "asyncLoadAssets": false, + "autoReleaseAssets": false, + "subMetas": {} +} \ No newline at end of file diff --git a/assets/Scene/SwitchScene__GlitchMemories/SwitchScene__GlitchMemories.ts b/assets/Scene/SwitchScene__GlitchMemories/SwitchScene__GlitchMemories.ts new file mode 100644 index 0000000..baa8cf3 --- /dev/null +++ b/assets/Scene/SwitchScene__GlitchMemories/SwitchScene__GlitchMemories.ts @@ -0,0 +1,88 @@ +const { ccclass, property } = cc._decorator; + +@ccclass +export default class SwitchScene extends cc.Component { + @property(cc.Node) separator = null; + + @property(cc.SpriteFrame) spriteFrame1 = null; + @property(cc.SpriteFrame) spriteFrame2 = null; + @property(cc.Sprite) bgSprite = null; + @property(cc.Material) material = null; + private _spriteMaterial: cc.Material; + + touchStartPos = cc.Vec2.ZERO; + separatorStartPos = cc.Vec2.ZERO; + + start() { + this.bgSprite.spriteFrame.setTexture(this.spriteFrame1._texture); + this.initSpriteMaterial(); + this.playTransitionAnimation(); + } + + onLoad() { + this.separatorStartPos = this.separator.getPosition(); + this.node.on(cc.Node.EventType.TOUCH_START, this.onTouchStart, this); + this.node.on(cc.Node.EventType.TOUCH_MOVE, this.onTouchMove, this); + } + + switchSceneByTransition(event, value) { + cc.director.emit('setBackBtnVisibility', false); + cc.director.emit('switchSceneByTransition', value); + } + + playTransitionAnimation() { + let progress = 0; + let targetProgress = cc.winSize.width; + let totalTime = 3; + let startTime = Date.now(); + + const loop = () => { + if (!this._spriteMaterial || !this.touchStartPos) return; + if (!this.touchStartPos.equals(cc.Vec2.ZERO)) return; + + let currentTime = Date.now(); + let elapsedTime = (currentTime - startTime) / 1000; + let _progress = (elapsedTime / totalTime) * targetProgress; + progress = Math.min(_progress, targetProgress); + + this._spriteMaterial.setProperty('time', progress / cc.winSize.width); + this.separator.setPosition({ x: progress, y: 0 }); + + if (progress < targetProgress) { + requestAnimationFrame(loop.bind(this)); + } + }; + loop(); + } + + onTouchStart(event) { + this.separatorStartPos = this.separator.getPosition(); + this.touchStartPos = this.node.convertToNodeSpaceAR(event.getLocation()); + } + + private onTouchMove(event) { + // 获取当前触摸点的位置 + let touchPos = this.node.convertToNodeSpaceAR(event.getLocation()); + // 计算触摸点相对于起始位置的偏移量 + let offset = touchPos.sub(this.touchStartPos); + let targetPos = this.separatorStartPos.add(offset); + let targetX = Math.max(0, Math.min(targetPos.x, cc.winSize.width)); + this.separator.setPosition({ + x: targetX, + y: 0 + }); + this._spriteMaterial.setProperty('time', targetX / cc.winSize.width); + } + + initSpriteMaterial() { + let newMaterial = cc.MaterialVariant.create(this.material, this.bgSprite); + newMaterial.setProperty('texture', this.spriteFrame1._texture); + newMaterial.setProperty('texture2', this.spriteFrame2._texture); + newMaterial.setProperty('time', 0.25); + + this.spriteFrame1._texture.setFlipY(true); + this.spriteFrame2._texture.setFlipY(true); + this.bgSprite.setMaterial(0, newMaterial); + this._spriteMaterial = newMaterial; + } +} diff --git a/assets/Scene/SwitchScene__GlitchMemories/SwitchScene__GlitchMemories.ts.meta b/assets/Scene/SwitchScene__GlitchMemories/SwitchScene__GlitchMemories.ts.meta new file mode 100644 index 0000000..06e612f --- /dev/null +++ b/assets/Scene/SwitchScene__GlitchMemories/SwitchScene__GlitchMemories.ts.meta @@ -0,0 +1,9 @@ +{ + "ver": "1.0.5", + "uuid": "293d94cc-a92c-45c9-b470-40ed7f020a18", + "isPlugin": false, + "loadPluginInWeb": true, + "loadPluginInNative": true, + "loadPluginInEditor": false, + "subMetas": {} +} \ No newline at end of file diff --git a/assets/Scene/SwitchScene__GlitchMemories/Texture.meta b/assets/Scene/SwitchScene__GlitchMemories/Texture.meta new file mode 100644 index 0000000..4e9f152 --- /dev/null +++ b/assets/Scene/SwitchScene__GlitchMemories/Texture.meta @@ -0,0 +1,7 @@ +{ + "ver": "1.0.1", + "uuid": "8b5c5f36-f86b-4518-9b61-3484183b20b4", + "isSubpackage": false, + "subpackageName": "", + "subMetas": {} +} \ No newline at end of file diff --git a/assets/Scene/SwitchScene__GlitchMemories/Texture/bg1.jpeg b/assets/Scene/SwitchScene__GlitchMemories/Texture/bg1.jpeg new file mode 100644 index 0000000..f905b16 Binary files /dev/null and b/assets/Scene/SwitchScene__GlitchMemories/Texture/bg1.jpeg differ diff --git a/assets/Scene/SwitchScene__GlitchMemories/Texture/bg1.jpeg.meta b/assets/Scene/SwitchScene__GlitchMemories/Texture/bg1.jpeg.meta new file mode 100644 index 0000000..50d0fb1 --- /dev/null +++ b/assets/Scene/SwitchScene__GlitchMemories/Texture/bg1.jpeg.meta @@ -0,0 +1,36 @@ +{ + "ver": "2.3.4", + "uuid": "ee75dca6-9cb2-4f08-b996-5e990ded448d", + "type": "sprite", + "wrapMode": "clamp", + "filterMode": "bilinear", + "premultiplyAlpha": false, + "genMipmaps": false, + "packable": true, + "width": 1600, + "height": 1200, + "platformSettings": {}, + "subMetas": { + "bg1": { + "ver": "1.0.4", + "uuid": "a448d81c-fa36-426d-affc-78eedc0b3118", + "rawTextureUuid": "ee75dca6-9cb2-4f08-b996-5e990ded448d", + "trimType": "auto", + "trimThreshold": 1, + "rotated": false, + "offsetX": 0, + "offsetY": 0, + "trimX": 0, + "trimY": 0, + "width": 1600, + "height": 1200, + "rawWidth": 1600, + "rawHeight": 1200, + "borderTop": 0, + "borderBottom": 0, + "borderLeft": 0, + "borderRight": 0, + "subMetas": {} + } + } +} \ No newline at end of file diff --git a/assets/Scene/SwitchScene__GlitchMemories/Texture/bg2.jpeg b/assets/Scene/SwitchScene__GlitchMemories/Texture/bg2.jpeg new file mode 100644 index 0000000..a5a3c9c Binary files /dev/null and b/assets/Scene/SwitchScene__GlitchMemories/Texture/bg2.jpeg differ diff --git a/assets/Scene/SwitchScene__GlitchMemories/Texture/bg2.jpeg.meta b/assets/Scene/SwitchScene__GlitchMemories/Texture/bg2.jpeg.meta new file mode 100644 index 0000000..73f6508 --- /dev/null +++ b/assets/Scene/SwitchScene__GlitchMemories/Texture/bg2.jpeg.meta @@ -0,0 +1,36 @@ +{ + "ver": "2.3.4", + "uuid": "d6c1cbd3-3ac4-4297-b2ac-b833bc5fed54", + "type": "sprite", + "wrapMode": "clamp", + "filterMode": "bilinear", + "premultiplyAlpha": false, + "genMipmaps": false, + "packable": true, + "width": 1600, + "height": 1200, + "platformSettings": {}, + "subMetas": { + "bg2": { + "ver": "1.0.4", + "uuid": "50328db8-b67b-4c51-a2b3-92fbc75407ad", + "rawTextureUuid": "d6c1cbd3-3ac4-4297-b2ac-b833bc5fed54", + "trimType": "auto", + "trimThreshold": 1, + "rotated": false, + "offsetX": 0, + "offsetY": 0, + "trimX": 0, + "trimY": 0, + "width": 1600, + "height": 1200, + "rawWidth": 1600, + "rawHeight": 1200, + "borderTop": 0, + "borderBottom": 0, + "borderLeft": 0, + "borderRight": 0, + "subMetas": {} + } + } +} \ No newline at end of file diff --git a/assets/Scene/SwitchScene__GlitchMemories/Texture/btn.png b/assets/Scene/SwitchScene__GlitchMemories/Texture/btn.png new file mode 100644 index 0000000..bc4283d Binary files /dev/null and b/assets/Scene/SwitchScene__GlitchMemories/Texture/btn.png differ diff --git a/assets/Scene/SwitchScene__GlitchMemories/Texture/btn.png.meta b/assets/Scene/SwitchScene__GlitchMemories/Texture/btn.png.meta new file mode 100644 index 0000000..248a798 --- /dev/null +++ b/assets/Scene/SwitchScene__GlitchMemories/Texture/btn.png.meta @@ -0,0 +1,36 @@ +{ + "ver": "2.3.4", + "uuid": "623adef2-9f2d-4d56-848d-380fca791f90", + "type": "sprite", + "wrapMode": "clamp", + "filterMode": "bilinear", + "premultiplyAlpha": false, + "genMipmaps": false, + "packable": true, + "width": 1477, + "height": 118, + "platformSettings": {}, + "subMetas": { + "btn": { + "ver": "1.0.4", + "uuid": "9d65fe06-9a25-453d-a008-fcc096b3fc2b", + "rawTextureUuid": "623adef2-9f2d-4d56-848d-380fca791f90", + "trimType": "auto", + "trimThreshold": 1, + "rotated": false, + "offsetX": 0, + "offsetY": 0, + "trimX": 0, + "trimY": 0, + "width": 1477, + "height": 118, + "rawWidth": 1477, + "rawHeight": 118, + "borderTop": 0, + "borderBottom": 0, + "borderLeft": 0, + "borderRight": 0, + "subMetas": {} + } + } +} \ No newline at end of file diff --git a/assets/Scene/SwitchScene__Morph.meta b/assets/Scene/SwitchScene__Morph.meta new file mode 100644 index 0000000..d64b772 --- /dev/null +++ b/assets/Scene/SwitchScene__Morph.meta @@ -0,0 +1,7 @@ +{ + "ver": "1.0.1", + "uuid": "e3428f3b-5920-446c-a9ca-f7a303952872", + "isSubpackage": false, + "subpackageName": "", + "subMetas": {} +} \ No newline at end of file diff --git a/assets/Scene/SwitchScene__Morph/Materials.meta b/assets/Scene/SwitchScene__Morph/Materials.meta new file mode 100644 index 0000000..99c4359 --- /dev/null +++ b/assets/Scene/SwitchScene__Morph/Materials.meta @@ -0,0 +1,7 @@ +{ + "ver": "1.0.1", + "uuid": "242c1c65-a965-450a-8df4-364aa907e5ad", + "isSubpackage": false, + "subpackageName": "", + "subMetas": {} +} \ No newline at end of file diff --git a/assets/Scene/SwitchScene__Morph/Materials/Morph.effect b/assets/Scene/SwitchScene__Morph/Materials/Morph.effect new file mode 100644 index 0000000..c4f61ac --- /dev/null +++ b/assets/Scene/SwitchScene__Morph/Materials/Morph.effect @@ -0,0 +1,93 @@ +// 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 } + strength: {value: 0.1} + time: {value: 0} +}% + +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; + uniform sampler2D texture; + uniform sampler2D texture2; + uniform Common { + float strength; + float time; + }; + float progress = time; + in mediump vec2 v_uv0; + in vec4 v_color; + + vec4 getFromColor(vec2 uv) { + return texture(texture, uv); + } + vec4 getToColor(vec2 uv) { + return texture(texture2, uv); + } + + vec4 transition(vec2 p) { + // 获取起始颜色和目标颜色 + vec4 ca = getFromColor(p); + vec4 cb = getToColor(p); + + // 计算起始和目标颜色的偏移向量 + vec2 oa = (((ca.rg + ca.b) * 0.5) * 2.0 - 1.0); + vec2 ob = (((cb.rg + cb.b) * 0.5) * 2.0 - 1.0); + // 在起始和目标偏移向量之间进行插值,并乘以强度 + vec2 oc = mix(oa, ob, 0.5) * strength; + + // 根据进度计算权重 + float w0 = progress; + float w1 = 1.0 - w0; + // 使用混合函数混合起始颜色和目标颜色,根据进度进行插值 + return mix(getFromColor(p + oc * w0), getToColor(p - oc * w1), progress); + } + + void main () { + gl_FragColor = v_color * transition(v_uv0); + } +}% diff --git a/assets/Scene/SwitchScene__Morph/Materials/Morph.effect.meta b/assets/Scene/SwitchScene__Morph/Materials/Morph.effect.meta new file mode 100644 index 0000000..fdaa4d5 --- /dev/null +++ b/assets/Scene/SwitchScene__Morph/Materials/Morph.effect.meta @@ -0,0 +1,17 @@ +{ + "ver": "1.0.25", + "uuid": "fde88b10-e301-436f-8d79-5093c0a12f12", + "compiledShaders": [ + { + "glsl1": { + "vert": "\nprecision highp float;\nuniform mediump mat4 cc_matViewProj;\nuniform mat4 cc_matWorld;\nattribute vec3 a_position;\nattribute vec4 a_color;\nvarying vec4 v_color;\n#if USE_TEXTURE\nattribute vec2 a_uv0;\nvarying vec2 v_uv0;\n#endif\nvoid main () {\n vec4 pos = vec4(a_position, 1);\n #if CC_USE_MODEL\n pos = cc_matViewProj * cc_matWorld * pos;\n #else\n pos = cc_matViewProj * pos;\n #endif\n #if USE_TEXTURE\n v_uv0 = a_uv0;\n #endif\n v_color = a_color;\n gl_Position = pos;\n}", + "frag": "\nprecision highp float;\nuniform sampler2D texture;\nuniform sampler2D texture2;\nuniform float strength;\nuniform float time;\nfloat progress = time;\nvarying mediump vec2 v_uv0;\nvarying vec4 v_color;\nvec4 getFromColor(vec2 uv) {\n return texture2D(texture, uv);\n}\nvec4 getToColor(vec2 uv) {\n return texture2D(texture2, uv);\n}\nvec4 transition(vec2 p) {\n vec4 ca = getFromColor(p);\n vec4 cb = getToColor(p);\n vec2 oa = (((ca.rg + ca.b) * 0.5) * 2.0 - 1.0);\n vec2 ob = (((cb.rg + cb.b) * 0.5) * 2.0 - 1.0);\n vec2 oc = mix(oa, ob, 0.5) * strength;\n float w0 = progress;\n float w1 = 1.0 - w0;\n return mix(getFromColor(p + oc * w0), getToColor(p - oc * w1), progress);\n}\nvoid main () {\n gl_FragColor = v_color * transition(v_uv0);\n}" + }, + "glsl3": { + "vert": "\nprecision highp float;\nuniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_nativeSize;\n highp mat4 cc_matView;\n mediump mat4 cc_matViewInv;\n mediump mat4 cc_matProj;\n mediump mat4 cc_matProjInv;\n mediump mat4 cc_matViewProj;\n mediump mat4 cc_matViewProjInv;\n mediump vec4 cc_cameraPos;\n};\nuniform CCLocal {\n mat4 cc_matWorld;\n mat4 cc_matWorldIT;\n};\nin vec3 a_position;\nin vec4 a_color;\nout vec4 v_color;\n#if USE_TEXTURE\nin vec2 a_uv0;\nout vec2 v_uv0;\n#endif\nvoid main () {\n vec4 pos = vec4(a_position, 1);\n #if CC_USE_MODEL\n pos = cc_matViewProj * cc_matWorld * pos;\n #else\n pos = cc_matViewProj * pos;\n #endif\n #if USE_TEXTURE\n v_uv0 = a_uv0;\n #endif\n v_color = a_color;\n gl_Position = pos;\n}", + "frag": "\nprecision highp float;\nuniform sampler2D texture;\nuniform sampler2D texture2;\nuniform Common {\n float strength;\n float time;\n};\nfloat progress = time;\nin mediump vec2 v_uv0;\nin vec4 v_color;\nvec4 getFromColor(vec2 uv) {\n return texture(texture, uv);\n}\nvec4 getToColor(vec2 uv) {\n return texture(texture2, uv);\n}\nvec4 transition(vec2 p) {\n vec4 ca = getFromColor(p);\n vec4 cb = getToColor(p);\n vec2 oa = (((ca.rg + ca.b) * 0.5) * 2.0 - 1.0);\n vec2 ob = (((cb.rg + cb.b) * 0.5) * 2.0 - 1.0);\n vec2 oc = mix(oa, ob, 0.5) * strength;\n float w0 = progress;\n float w1 = 1.0 - w0;\n return mix(getFromColor(p + oc * w0), getToColor(p - oc * w1), progress);\n}\nvoid main () {\n gl_FragColor = v_color * transition(v_uv0);\n}" + } + } + ], + "subMetas": {} +} \ No newline at end of file diff --git a/assets/Scene/SwitchScene__Morph/Materials/Morph.mtl b/assets/Scene/SwitchScene__Morph/Materials/Morph.mtl new file mode 100644 index 0000000..06e6a65 --- /dev/null +++ b/assets/Scene/SwitchScene__Morph/Materials/Morph.mtl @@ -0,0 +1,17 @@ +{ + "__type__": "cc.Material", + "_name": "Morph", + "_objFlags": 0, + "_native": "", + "_effectAsset": { + "__uuid__": "fde88b10-e301-436f-8d79-5093c0a12f12" + }, + "_techniqueIndex": 0, + "_techniqueData": { + "0": { + "defines": { + "USE_TEXTURE": true + } + } + } +} \ No newline at end of file diff --git a/assets/Scene/SwitchScene__Morph/Materials/Morph.mtl.meta b/assets/Scene/SwitchScene__Morph/Materials/Morph.mtl.meta new file mode 100644 index 0000000..812bb43 --- /dev/null +++ b/assets/Scene/SwitchScene__Morph/Materials/Morph.mtl.meta @@ -0,0 +1,6 @@ +{ + "ver": "1.0.3", + "uuid": "acd92272-4481-49c6-81ef-5ae28e699ecf", + "dataAsSubAsset": null, + "subMetas": {} +} \ No newline at end of file diff --git a/assets/Scene/SwitchScene__Morph/SwitchScene__Morph.fire b/assets/Scene/SwitchScene__Morph/SwitchScene__Morph.fire new file mode 100644 index 0000000..9eb91d1 --- /dev/null +++ b/assets/Scene/SwitchScene__Morph/SwitchScene__Morph.fire @@ -0,0 +1,768 @@ +[ + { + "__type__": "cc.SceneAsset", + "_name": "", + "_objFlags": 0, + "_native": "", + "scene": { + "__id__": 1 + } + }, + { + "__type__": "cc.Scene", + "_objFlags": 0, + "_parent": null, + "_children": [ + { + "__id__": 2 + }, + { + "__id__": 11 + }, + { + "__id__": 14 + }, + { + "__id__": 8 + } + ], + "_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": "2989fa08-f84b-4f08-83b3-a45fb8eb333c" + }, + { + "__type__": "cc.Node", + "_name": "Canvas", + "_objFlags": 512, + "_parent": { + "__id__": 1 + }, + "_children": [ + { + "__id__": 3 + } + ], + "_active": true, + "_components": [ + { + "__id__": 5 + }, + { + "__id__": 6 + }, + { + "__id__": 7 + }, + { + "__id__": 13 + } + ], + "_prefab": null, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 1334, + "height": 750 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + 667, + 375, + 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": "a5esZu+45LA5mBpvttspPD" + }, + { + "__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": 960, + "height": 640 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + 0, + 0, + 452.93128617926146, + 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": "e1WoFrQ79G7r4ZuQE3HlNb" + }, + { + "__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": "81GN3uXINKVLeW4+iKSlim" + }, + { + "__type__": "cc.Canvas", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 2 + }, + "_enabled": true, + "_designResolution": { + "__type__": "cc.Size", + "width": 1334, + "height": 750 + }, + "_fitWidth": false, + "_fitHeight": true, + "_id": "59Cd0ovbdF4byw5sbjJDx7" + }, + { + "__type__": "cc.Widget", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 2 + }, + "_enabled": true, + "alignMode": 1, + "_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": 0, + "_originalHeight": 0, + "_id": "29zXboiXFBKoIV4PQ2liTe" + }, + { + "__type__": "75ff9DV6TxDfp7lelS5SRve", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 2 + }, + "_enabled": true, + "separator": { + "__id__": 8 + }, + "spriteFrame1": { + "__uuid__": "86051da6-3207-4804-9640-0e749a937e66" + }, + "spriteFrame2": { + "__uuid__": "4b6b758b-cb14-48cf-8228-328c894f8ff3" + }, + "bgSprite": { + "__id__": 10 + }, + "material": { + "__uuid__": "acd92272-4481-49c6-81ef-5ae28e699ecf" + }, + "_id": "7e2sjBAfpNUZIZdLWeJ9Kv" + }, + { + "__type__": "cc.Node", + "_name": "Separator", + "_objFlags": 0, + "_parent": { + "__id__": 1 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 9 + } + ], + "_prefab": null, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 171, + "b": 23, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 10, + "height": 750 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + 333, + 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": "00zwOFnw9A9Y2jJcAfpxGt" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 8 + }, + "_enabled": true, + "_materials": [ + { + "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432" + } + ], + "_srcBlendFactor": 770, + "_dstBlendFactor": 771, + "_spriteFrame": { + "__uuid__": "5c3bb932-6c3c-468f-88a9-c8c61d458641" + }, + "_type": 0, + "_sizeMode": 0, + "_fillType": 0, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": true, + "_atlas": null, + "_id": "bfovdQprtLZrbQA9328iTr" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 11 + }, + "_enabled": true, + "_materials": [ + { + "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432" + } + ], + "_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": "b70P96s8FD1LitaZ7aobMA" + }, + { + "__type__": "cc.Node", + "_name": "Bg", + "_objFlags": 0, + "_parent": { + "__id__": 1 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 10 + }, + { + "__id__": 12 + } + ], + "_prefab": null, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 1334, + "height": 750 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + 667, + 375, + 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": "34YKVYdF5MoYlFN+Zfb6wk" + }, + { + "__type__": "cc.Widget", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 11 + }, + "_enabled": true, + "alignMode": 1, + "_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": 1024, + "_originalHeight": 445, + "_id": "711M5JfuBPs5F7P5bDVb/1" + }, + { + "__type__": "75ff9DV6TxDfp7lelS5SRve", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 2 + }, + "_enabled": true, + "separator": { + "__id__": 8 + }, + "spriteFrame1": { + "__uuid__": "86051da6-3207-4804-9640-0e749a937e66" + }, + "spriteFrame2": { + "__uuid__": "4b6b758b-cb14-48cf-8228-328c894f8ff3" + }, + "bgSprite": { + "__id__": 10 + }, + "material": { + "__uuid__": "acd92272-4481-49c6-81ef-5ae28e699ecf" + }, + "_id": "dePdhkKnZN/pBfcawhApa9" + }, + { + "__type__": "cc.Node", + "_name": "Btn", + "_objFlags": 0, + "_parent": { + "__id__": 1 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 15 + }, + { + "__id__": 17 + }, + { + "__id__": 18 + } + ], + "_prefab": null, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 1477, + "height": 118 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + 667, + 528.7, + 0, + 0, + 0, + 0, + 1, + 0.7, + 0.7, + 1 + ] + }, + "_eulerAngles": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_skewX": 0, + "_skewY": 0, + "_is3DNode": false, + "_groupIndex": 0, + "groupIndex": 0, + "_id": "bcVNNAEfFEJL7tftaCUB7n" + }, + { + "__type__": "cc.Button", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 14 + }, + "_enabled": true, + "_normalMaterial": null, + "_grayMaterial": null, + "duration": 0.1, + "zoomScale": 1.2, + "clickEvents": [ + { + "__id__": 16 + } + ], + "_N$interactable": true, + "_N$enableAutoGrayEffect": false, + "_N$transition": 0, + "transition": 0, + "_N$normalColor": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_N$pressedColor": { + "__type__": "cc.Color", + "r": 211, + "g": 211, + "b": 211, + "a": 255 + }, + "pressedColor": { + "__type__": "cc.Color", + "r": 211, + "g": 211, + "b": 211, + "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": 124, + "g": 124, + "b": 124, + "a": 255 + }, + "_N$normalSprite": null, + "_N$pressedSprite": null, + "pressedSprite": null, + "_N$hoverSprite": null, + "hoverSprite": null, + "_N$disabledSprite": null, + "_N$target": { + "__id__": 14 + }, + "_id": "fdJg28i7pE6pi4D1ovRRp0" + }, + { + "__type__": "cc.ClickEvent", + "target": { + "__id__": 2 + }, + "component": "", + "_componentId": "75ff9DV6TxDfp7lelS5SRve", + "handler": "switchSceneByTransition", + "customEventData": "2" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 14 + }, + "_enabled": true, + "_materials": [ + { + "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432" + } + ], + "_srcBlendFactor": 770, + "_dstBlendFactor": 771, + "_spriteFrame": { + "__uuid__": "86714285-13db-44f6-86aa-11838e0d4831" + }, + "_type": 0, + "_sizeMode": 1, + "_fillType": 0, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": true, + "_atlas": null, + "_id": "c1sR5klVZHraEr68/UTkLE" + }, + { + "__type__": "cc.Widget", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 14 + }, + "_enabled": true, + "alignMode": 1, + "_target": null, + "_alignFlags": 17, + "_left": 0, + "_right": 0, + "_top": 180, + "_bottom": 0, + "_verticalCenter": 157.942, + "_horizontalCenter": 0, + "_isAbsLeft": true, + "_isAbsRight": true, + "_isAbsTop": true, + "_isAbsBottom": true, + "_isAbsHorizontalCenter": true, + "_isAbsVerticalCenter": true, + "_originalWidth": 0, + "_originalHeight": 0, + "_id": "a6rm0uXY9DlbNNnoWq9hN0" + } +] \ No newline at end of file diff --git a/assets/Scene/SwitchScene__Morph/SwitchScene__Morph.fire.meta b/assets/Scene/SwitchScene__Morph/SwitchScene__Morph.fire.meta new file mode 100644 index 0000000..6b775c7 --- /dev/null +++ b/assets/Scene/SwitchScene__Morph/SwitchScene__Morph.fire.meta @@ -0,0 +1,7 @@ +{ + "ver": "1.2.6", + "uuid": "2989fa08-f84b-4f08-83b3-a45fb8eb333c", + "asyncLoadAssets": false, + "autoReleaseAssets": false, + "subMetas": {} +} \ No newline at end of file diff --git a/assets/Scene/SwitchScene__Morph/SwitchScene__Morph.ts b/assets/Scene/SwitchScene__Morph/SwitchScene__Morph.ts new file mode 100644 index 0000000..baa8cf3 --- /dev/null +++ b/assets/Scene/SwitchScene__Morph/SwitchScene__Morph.ts @@ -0,0 +1,88 @@ +const { ccclass, property } = cc._decorator; + +@ccclass +export default class SwitchScene extends cc.Component { + @property(cc.Node) separator = null; + + @property(cc.SpriteFrame) spriteFrame1 = null; + @property(cc.SpriteFrame) spriteFrame2 = null; + @property(cc.Sprite) bgSprite = null; + @property(cc.Material) material = null; + private _spriteMaterial: cc.Material; + + touchStartPos = cc.Vec2.ZERO; + separatorStartPos = cc.Vec2.ZERO; + + start() { + this.bgSprite.spriteFrame.setTexture(this.spriteFrame1._texture); + this.initSpriteMaterial(); + this.playTransitionAnimation(); + } + + onLoad() { + this.separatorStartPos = this.separator.getPosition(); + this.node.on(cc.Node.EventType.TOUCH_START, this.onTouchStart, this); + this.node.on(cc.Node.EventType.TOUCH_MOVE, this.onTouchMove, this); + } + + switchSceneByTransition(event, value) { + cc.director.emit('setBackBtnVisibility', false); + cc.director.emit('switchSceneByTransition', value); + } + + playTransitionAnimation() { + let progress = 0; + let targetProgress = cc.winSize.width; + let totalTime = 3; + let startTime = Date.now(); + + const loop = () => { + if (!this._spriteMaterial || !this.touchStartPos) return; + if (!this.touchStartPos.equals(cc.Vec2.ZERO)) return; + + let currentTime = Date.now(); + let elapsedTime = (currentTime - startTime) / 1000; + let _progress = (elapsedTime / totalTime) * targetProgress; + progress = Math.min(_progress, targetProgress); + + this._spriteMaterial.setProperty('time', progress / cc.winSize.width); + this.separator.setPosition({ x: progress, y: 0 }); + + if (progress < targetProgress) { + requestAnimationFrame(loop.bind(this)); + } + }; + loop(); + } + + onTouchStart(event) { + this.separatorStartPos = this.separator.getPosition(); + this.touchStartPos = this.node.convertToNodeSpaceAR(event.getLocation()); + } + + private onTouchMove(event) { + // 获取当前触摸点的位置 + let touchPos = this.node.convertToNodeSpaceAR(event.getLocation()); + // 计算触摸点相对于起始位置的偏移量 + let offset = touchPos.sub(this.touchStartPos); + let targetPos = this.separatorStartPos.add(offset); + let targetX = Math.max(0, Math.min(targetPos.x, cc.winSize.width)); + this.separator.setPosition({ + x: targetX, + y: 0 + }); + this._spriteMaterial.setProperty('time', targetX / cc.winSize.width); + } + + initSpriteMaterial() { + let newMaterial = cc.MaterialVariant.create(this.material, this.bgSprite); + newMaterial.setProperty('texture', this.spriteFrame1._texture); + newMaterial.setProperty('texture2', this.spriteFrame2._texture); + newMaterial.setProperty('time', 0.25); + + this.spriteFrame1._texture.setFlipY(true); + this.spriteFrame2._texture.setFlipY(true); + this.bgSprite.setMaterial(0, newMaterial); + this._spriteMaterial = newMaterial; + } +} diff --git a/assets/Scene/SwitchScene__Morph/SwitchScene__Morph.ts.meta b/assets/Scene/SwitchScene__Morph/SwitchScene__Morph.ts.meta new file mode 100644 index 0000000..7f98caf --- /dev/null +++ b/assets/Scene/SwitchScene__Morph/SwitchScene__Morph.ts.meta @@ -0,0 +1,9 @@ +{ + "ver": "1.0.5", + "uuid": "75ff90d5-e93c-437e-9ee5-7a54b9491bde", + "isPlugin": false, + "loadPluginInWeb": true, + "loadPluginInNative": true, + "loadPluginInEditor": false, + "subMetas": {} +} \ No newline at end of file diff --git a/assets/Scene/SwitchScene__Morph/Texture.meta b/assets/Scene/SwitchScene__Morph/Texture.meta new file mode 100644 index 0000000..3778522 --- /dev/null +++ b/assets/Scene/SwitchScene__Morph/Texture.meta @@ -0,0 +1,7 @@ +{ + "ver": "1.0.1", + "uuid": "4c74a3e0-f277-4f9f-90c9-7dbe2f1404ee", + "isSubpackage": false, + "subpackageName": "", + "subMetas": {} +} \ No newline at end of file diff --git a/assets/Scene/SwitchScene__Morph/Texture/bg1.jpeg b/assets/Scene/SwitchScene__Morph/Texture/bg1.jpeg new file mode 100644 index 0000000..f905b16 Binary files /dev/null and b/assets/Scene/SwitchScene__Morph/Texture/bg1.jpeg differ diff --git a/assets/Scene/SwitchScene__Morph/Texture/bg1.jpeg.meta b/assets/Scene/SwitchScene__Morph/Texture/bg1.jpeg.meta new file mode 100644 index 0000000..002ce96 --- /dev/null +++ b/assets/Scene/SwitchScene__Morph/Texture/bg1.jpeg.meta @@ -0,0 +1,36 @@ +{ + "ver": "2.3.4", + "uuid": "629244c4-e709-4d5e-a4ac-e250b052ebe3", + "type": "sprite", + "wrapMode": "clamp", + "filterMode": "bilinear", + "premultiplyAlpha": false, + "genMipmaps": false, + "packable": true, + "width": 1600, + "height": 1200, + "platformSettings": {}, + "subMetas": { + "bg1": { + "ver": "1.0.4", + "uuid": "86051da6-3207-4804-9640-0e749a937e66", + "rawTextureUuid": "629244c4-e709-4d5e-a4ac-e250b052ebe3", + "trimType": "auto", + "trimThreshold": 1, + "rotated": false, + "offsetX": 0, + "offsetY": 0, + "trimX": 0, + "trimY": 0, + "width": 1600, + "height": 1200, + "rawWidth": 1600, + "rawHeight": 1200, + "borderTop": 0, + "borderBottom": 0, + "borderLeft": 0, + "borderRight": 0, + "subMetas": {} + } + } +} \ No newline at end of file diff --git a/assets/Scene/SwitchScene__Morph/Texture/bg2.jpeg b/assets/Scene/SwitchScene__Morph/Texture/bg2.jpeg new file mode 100644 index 0000000..a5a3c9c Binary files /dev/null and b/assets/Scene/SwitchScene__Morph/Texture/bg2.jpeg differ diff --git a/assets/Scene/SwitchScene__Morph/Texture/bg2.jpeg.meta b/assets/Scene/SwitchScene__Morph/Texture/bg2.jpeg.meta new file mode 100644 index 0000000..e3aa5e2 --- /dev/null +++ b/assets/Scene/SwitchScene__Morph/Texture/bg2.jpeg.meta @@ -0,0 +1,36 @@ +{ + "ver": "2.3.4", + "uuid": "6739472e-4b5d-4f1b-8dc1-2915cd7493d1", + "type": "sprite", + "wrapMode": "clamp", + "filterMode": "bilinear", + "premultiplyAlpha": false, + "genMipmaps": false, + "packable": true, + "width": 1600, + "height": 1200, + "platformSettings": {}, + "subMetas": { + "bg2": { + "ver": "1.0.4", + "uuid": "4b6b758b-cb14-48cf-8228-328c894f8ff3", + "rawTextureUuid": "6739472e-4b5d-4f1b-8dc1-2915cd7493d1", + "trimType": "auto", + "trimThreshold": 1, + "rotated": false, + "offsetX": 0, + "offsetY": 0, + "trimX": 0, + "trimY": 0, + "width": 1600, + "height": 1200, + "rawWidth": 1600, + "rawHeight": 1200, + "borderTop": 0, + "borderBottom": 0, + "borderLeft": 0, + "borderRight": 0, + "subMetas": {} + } + } +} \ No newline at end of file diff --git a/assets/Scene/SwitchScene__Morph/Texture/btn.png b/assets/Scene/SwitchScene__Morph/Texture/btn.png new file mode 100644 index 0000000..bc4283d Binary files /dev/null and b/assets/Scene/SwitchScene__Morph/Texture/btn.png differ diff --git a/assets/Scene/SwitchScene__Morph/Texture/btn.png.meta b/assets/Scene/SwitchScene__Morph/Texture/btn.png.meta new file mode 100644 index 0000000..d4cf706 --- /dev/null +++ b/assets/Scene/SwitchScene__Morph/Texture/btn.png.meta @@ -0,0 +1,36 @@ +{ + "ver": "2.3.4", + "uuid": "b2490222-2b5e-4601-b231-c840bffbdd5d", + "type": "sprite", + "wrapMode": "clamp", + "filterMode": "bilinear", + "premultiplyAlpha": false, + "genMipmaps": false, + "packable": true, + "width": 1477, + "height": 118, + "platformSettings": {}, + "subMetas": { + "btn": { + "ver": "1.0.4", + "uuid": "2a30f7f5-bdfb-4809-8a01-a50b2e5bee20", + "rawTextureUuid": "b2490222-2b5e-4601-b231-c840bffbdd5d", + "trimType": "auto", + "trimThreshold": 1, + "rotated": false, + "offsetX": 0, + "offsetY": 0, + "trimX": 0, + "trimY": 0, + "width": 1477, + "height": 118, + "rawWidth": 1477, + "rawHeight": 118, + "borderTop": 0, + "borderBottom": 0, + "borderLeft": 0, + "borderRight": 0, + "subMetas": {} + } + } +} \ No newline at end of file diff --git a/assets/Scene/SwitchScene__Perlin.meta b/assets/Scene/SwitchScene__Perlin.meta new file mode 100644 index 0000000..bb56975 --- /dev/null +++ b/assets/Scene/SwitchScene__Perlin.meta @@ -0,0 +1,7 @@ +{ + "ver": "1.0.1", + "uuid": "a7d9aabc-6e90-4f18-b820-fec5e5691896", + "isSubpackage": false, + "subpackageName": "", + "subMetas": {} +} \ No newline at end of file diff --git a/assets/Scene/SwitchScene__Perlin/Materials.meta b/assets/Scene/SwitchScene__Perlin/Materials.meta new file mode 100644 index 0000000..18418e0 --- /dev/null +++ b/assets/Scene/SwitchScene__Perlin/Materials.meta @@ -0,0 +1,7 @@ +{ + "ver": "1.0.1", + "uuid": "6b282196-e05b-44c8-8305-5bcbc06916fd", + "isSubpackage": false, + "subpackageName": "", + "subMetas": {} +} \ No newline at end of file diff --git a/assets/Scene/SwitchScene__Perlin/Materials/Perlin.effect b/assets/Scene/SwitchScene__Perlin/Materials/Perlin.effect new file mode 100644 index 0000000..941f319 --- /dev/null +++ b/assets/Scene/SwitchScene__Perlin/Materials/Perlin.effect @@ -0,0 +1,130 @@ +// Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + +CCEffect %{ + techniques: + - passes: + - vert: vs + frag: fs + blendState: + targets: + - blend: true + rasterizerState: + cullMode: none + properties: + scale: { value: 20 } + smoothness: { value: 0.1 } + seed: { value: 12.9898 } + time: { value: 0 } +}% + + +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; + uniform sampler2D texture; + uniform sampler2D texture2; + uniform Perlin { + float scale; + float smoothness; + float seed; + float time; + }; + float progress = time; + in mediump vec2 v_uv0; + in vec4 v_color; + + // http://byteblacksmith.com/improvements-to-the-canonical-one-liner-glsl-rand-for-opengl-es-2-0/ + float random(vec2 co) { + highp float a = seed; + highp float b = 78.233; + highp float c = 43758.5453; + highp float dt= dot(co.xy ,vec2(a,b)); + highp float sn= mod(dt,3.14); + return fract(sin(sn) * c); + } + + // 2D Noise based on Morgan McGuire @morgan3d + // https://www.shadertoy.com/view/4dS3Wd + float noise (in vec2 st) { + vec2 i = floor(st); + vec2 f = fract(st); + + // Four corners in 2D of a tile + float a = random(i); + float b = random(i + vec2(1.0, 0.0)); + float c = random(i + vec2(0.0, 1.0)); + float d = random(i + vec2(1.0, 1.0)); + + // Cubic Hermine Curve. Same as SmoothStep + vec2 u = f*f*(3.0-2.0*f); + + // Mix 4 coorners porcentages + return mix(a, b, u.x) + + (c - a)* u.y * (1.0 - u.x) + + (d - b) * u.x * u.y; + } + + vec4 getFromColor(vec2 uv) { + return texture(texture, uv); + } + vec4 getToColor(vec2 uv) { + return texture(texture2, uv); + } + + vec4 transition (vec2 uv) { + vec4 from = getFromColor(uv); + vec4 to = getToColor(uv); + float n = noise(uv * scale); + + float p = mix(-smoothness, 1.0 + smoothness, progress); + float lower = p - smoothness; + float higher = p + smoothness; + + // 根据噪声值进行平滑插值 + float q = smoothstep(lower, higher, n); + + return mix( + from, + to, + 1.0 - q + ); + } + + void main () { + gl_FragColor = v_color * transition(v_uv0); + } +}% diff --git a/assets/Scene/SwitchScene__Perlin/Materials/Perlin.effect.meta b/assets/Scene/SwitchScene__Perlin/Materials/Perlin.effect.meta new file mode 100644 index 0000000..74e312b --- /dev/null +++ b/assets/Scene/SwitchScene__Perlin/Materials/Perlin.effect.meta @@ -0,0 +1,17 @@ +{ + "ver": "1.0.25", + "uuid": "3715350e-c25d-4afa-a06b-e4b480a6edef", + "compiledShaders": [ + { + "glsl1": { + "vert": "\nprecision highp float;\nuniform mediump mat4 cc_matViewProj;\nuniform mat4 cc_matWorld;\nattribute vec3 a_position;\nattribute vec4 a_color;\nvarying vec4 v_color;\n#if USE_TEXTURE\nattribute vec2 a_uv0;\nvarying vec2 v_uv0;\n#endif\nvoid main () {\n vec4 pos = vec4(a_position, 1);\n #if CC_USE_MODEL\n pos = cc_matViewProj * cc_matWorld * pos;\n #else\n pos = cc_matViewProj * pos;\n #endif\n #if USE_TEXTURE\n v_uv0 = a_uv0;\n #endif\n v_color = a_color;\n gl_Position = pos;\n}", + "frag": "\nprecision highp float;\nuniform sampler2D texture;\nuniform sampler2D texture2;\nuniform float scale;\nuniform float smoothness;\nuniform float seed;\nuniform float time;\nfloat progress = time;\nvarying mediump vec2 v_uv0;\nvarying vec4 v_color;\nfloat random(vec2 co) {\n highp float a = seed;\n highp float b = 78.233;\n highp float c = 43758.5453;\n highp float dt= dot(co.xy ,vec2(a,b));\n highp float sn= mod(dt,3.14);\n return fract(sin(sn) * c);\n}\nfloat noise (in vec2 st) {\n vec2 i = floor(st);\n vec2 f = fract(st);\n float a = random(i);\n float b = random(i + vec2(1.0, 0.0));\n float c = random(i + vec2(0.0, 1.0));\n float d = random(i + vec2(1.0, 1.0));\n vec2 u = f*f*(3.0-2.0*f);\n return mix(a, b, u.x) +\n (c - a)* u.y * (1.0 - u.x) +\n (d - b) * u.x * u.y;\n}\nvec4 getFromColor(vec2 uv) {\n return texture2D(texture, uv);\n}\nvec4 getToColor(vec2 uv) {\n return texture2D(texture2, uv);\n}\nvec4 transition (vec2 uv) {\n vec4 from = getFromColor(uv);\n vec4 to = getToColor(uv);\n float n = noise(uv * scale);\n float p = mix(-smoothness, 1.0 + smoothness, progress);\n float lower = p - smoothness;\n float higher = p + smoothness;\n float q = smoothstep(lower, higher, n);\n return mix(\n from,\n to,\n 1.0 - q\n );\n}\nvoid main () {\n gl_FragColor = v_color * transition(v_uv0);\n}" + }, + "glsl3": { + "vert": "\nprecision highp float;\nuniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_nativeSize;\n highp mat4 cc_matView;\n mediump mat4 cc_matViewInv;\n mediump mat4 cc_matProj;\n mediump mat4 cc_matProjInv;\n mediump mat4 cc_matViewProj;\n mediump mat4 cc_matViewProjInv;\n mediump vec4 cc_cameraPos;\n};\nuniform CCLocal {\n mat4 cc_matWorld;\n mat4 cc_matWorldIT;\n};\nin vec3 a_position;\nin vec4 a_color;\nout vec4 v_color;\n#if USE_TEXTURE\nin vec2 a_uv0;\nout vec2 v_uv0;\n#endif\nvoid main () {\n vec4 pos = vec4(a_position, 1);\n #if CC_USE_MODEL\n pos = cc_matViewProj * cc_matWorld * pos;\n #else\n pos = cc_matViewProj * pos;\n #endif\n #if USE_TEXTURE\n v_uv0 = a_uv0;\n #endif\n v_color = a_color;\n gl_Position = pos;\n}", + "frag": "\nprecision highp float;\nuniform sampler2D texture;\nuniform sampler2D texture2;\nuniform Perlin {\n float scale;\n float smoothness;\n float seed;\n float time;\n};\nfloat progress = time;\nin mediump vec2 v_uv0;\nin vec4 v_color;\nfloat random(vec2 co) {\n highp float a = seed;\n highp float b = 78.233;\n highp float c = 43758.5453;\n highp float dt= dot(co.xy ,vec2(a,b));\n highp float sn= mod(dt,3.14);\n return fract(sin(sn) * c);\n}\nfloat noise (in vec2 st) {\n vec2 i = floor(st);\n vec2 f = fract(st);\n float a = random(i);\n float b = random(i + vec2(1.0, 0.0));\n float c = random(i + vec2(0.0, 1.0));\n float d = random(i + vec2(1.0, 1.0));\n vec2 u = f*f*(3.0-2.0*f);\n return mix(a, b, u.x) +\n (c - a)* u.y * (1.0 - u.x) +\n (d - b) * u.x * u.y;\n}\nvec4 getFromColor(vec2 uv) {\n return texture(texture, uv);\n}\nvec4 getToColor(vec2 uv) {\n return texture(texture2, uv);\n}\nvec4 transition (vec2 uv) {\n vec4 from = getFromColor(uv);\n vec4 to = getToColor(uv);\n float n = noise(uv * scale);\n float p = mix(-smoothness, 1.0 + smoothness, progress);\n float lower = p - smoothness;\n float higher = p + smoothness;\n float q = smoothstep(lower, higher, n);\n return mix(\n from,\n to,\n 1.0 - q\n );\n}\nvoid main () {\n gl_FragColor = v_color * transition(v_uv0);\n}" + } + } + ], + "subMetas": {} +} \ No newline at end of file diff --git a/assets/Scene/SwitchScene__Perlin/Materials/Perlin.mtl b/assets/Scene/SwitchScene__Perlin/Materials/Perlin.mtl new file mode 100644 index 0000000..ff2993b --- /dev/null +++ b/assets/Scene/SwitchScene__Perlin/Materials/Perlin.mtl @@ -0,0 +1,22 @@ +{ + "__type__": "cc.Material", + "_name": "Perlin", + "_objFlags": 0, + "_native": "", + "_effectAsset": { + "__uuid__": "3715350e-c25d-4afa-a06b-e4b480a6edef" + }, + "_techniqueIndex": 0, + "_techniqueData": { + "0": { + "props": { + "seed": 12.9898, + "scale": 30, + "smoothness": 0.05 + }, + "defines": { + "USE_TEXTURE": true + } + } + } +} \ No newline at end of file diff --git a/assets/Scene/SwitchScene__Perlin/Materials/Perlin.mtl.meta b/assets/Scene/SwitchScene__Perlin/Materials/Perlin.mtl.meta new file mode 100644 index 0000000..916ba4e --- /dev/null +++ b/assets/Scene/SwitchScene__Perlin/Materials/Perlin.mtl.meta @@ -0,0 +1,6 @@ +{ + "ver": "1.0.3", + "uuid": "dbf06bcd-8024-4f08-a535-08f7383edf00", + "dataAsSubAsset": null, + "subMetas": {} +} \ No newline at end of file diff --git a/assets/Scene/SwitchScene__Perlin/SwitchScene__Perlin.fire b/assets/Scene/SwitchScene__Perlin/SwitchScene__Perlin.fire new file mode 100644 index 0000000..8ec900d --- /dev/null +++ b/assets/Scene/SwitchScene__Perlin/SwitchScene__Perlin.fire @@ -0,0 +1,740 @@ +[ + { + "__type__": "cc.SceneAsset", + "_name": "", + "_objFlags": 0, + "_native": "", + "scene": { + "__id__": 1 + } + }, + { + "__type__": "cc.Scene", + "_objFlags": 0, + "_parent": null, + "_children": [ + { + "__id__": 2 + }, + { + "__id__": 11 + }, + { + "__id__": 13 + }, + { + "__id__": 8 + } + ], + "_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": "c255828f-28b6-421d-ab95-e56d8319a07c" + }, + { + "__type__": "cc.Node", + "_name": "Canvas", + "_objFlags": 512, + "_parent": { + "__id__": 1 + }, + "_children": [ + { + "__id__": 3 + } + ], + "_active": true, + "_components": [ + { + "__id__": 5 + }, + { + "__id__": 6 + }, + { + "__id__": 7 + } + ], + "_prefab": null, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 1334, + "height": 750 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + 667, + 375, + 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": "a5esZu+45LA5mBpvttspPD" + }, + { + "__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": 960, + "height": 640 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + 0, + 0, + 452.93128617926146, + 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": "e1WoFrQ79G7r4ZuQE3HlNb" + }, + { + "__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": "81GN3uXINKVLeW4+iKSlim" + }, + { + "__type__": "cc.Canvas", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 2 + }, + "_enabled": true, + "_designResolution": { + "__type__": "cc.Size", + "width": 1334, + "height": 750 + }, + "_fitWidth": false, + "_fitHeight": true, + "_id": "59Cd0ovbdF4byw5sbjJDx7" + }, + { + "__type__": "cc.Widget", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 2 + }, + "_enabled": true, + "alignMode": 1, + "_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": 0, + "_originalHeight": 0, + "_id": "29zXboiXFBKoIV4PQ2liTe" + }, + { + "__type__": "f73a82LpAxBmZwDm8dJO3Q+", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 2 + }, + "_enabled": true, + "separator": { + "__id__": 8 + }, + "spriteFrame1": { + "__uuid__": "8ef474f4-5038-4363-8a35-cd2c2df2d8d6" + }, + "spriteFrame2": { + "__uuid__": "5ff63ec2-5294-40af-9a60-4f837d09d814" + }, + "bgSprite": { + "__id__": 10 + }, + "material": { + "__uuid__": "dbf06bcd-8024-4f08-a535-08f7383edf00" + }, + "_id": "b62auiatFL/Lu4KD6wNz14" + }, + { + "__type__": "cc.Node", + "_name": "Separator", + "_objFlags": 0, + "_parent": { + "__id__": 1 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 9 + } + ], + "_prefab": null, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 171, + "b": 23, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 10, + "height": 750 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + 333, + 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": "00zwOFnw9A9Y2jJcAfpxGt" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 8 + }, + "_enabled": true, + "_materials": [ + { + "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432" + } + ], + "_srcBlendFactor": 770, + "_dstBlendFactor": 771, + "_spriteFrame": { + "__uuid__": "5c3bb932-6c3c-468f-88a9-c8c61d458641" + }, + "_type": 0, + "_sizeMode": 0, + "_fillType": 0, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": true, + "_atlas": null, + "_id": "bfovdQprtLZrbQA9328iTr" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 11 + }, + "_enabled": true, + "_materials": [ + { + "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432" + } + ], + "_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": "b70P96s8FD1LitaZ7aobMA" + }, + { + "__type__": "cc.Node", + "_name": "Bg", + "_objFlags": 0, + "_parent": { + "__id__": 1 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 10 + }, + { + "__id__": 12 + } + ], + "_prefab": null, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 1334, + "height": 750 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + 667, + 375, + 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": "34YKVYdF5MoYlFN+Zfb6wk" + }, + { + "__type__": "cc.Widget", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 11 + }, + "_enabled": true, + "alignMode": 1, + "_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": 1024, + "_originalHeight": 445, + "_id": "711M5JfuBPs5F7P5bDVb/1" + }, + { + "__type__": "cc.Node", + "_name": "Btn", + "_objFlags": 0, + "_parent": { + "__id__": 1 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 14 + }, + { + "__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": 1477, + "height": 118 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + 667, + 528.7, + 0, + 0, + 0, + 0, + 1, + 0.7, + 0.7, + 1 + ] + }, + "_eulerAngles": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_skewX": 0, + "_skewY": 0, + "_is3DNode": false, + "_groupIndex": 0, + "groupIndex": 0, + "_id": "bcVNNAEfFEJL7tftaCUB7n" + }, + { + "__type__": "cc.Button", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 13 + }, + "_enabled": true, + "_normalMaterial": null, + "_grayMaterial": null, + "duration": 0.1, + "zoomScale": 1.2, + "clickEvents": [ + { + "__id__": 15 + } + ], + "_N$interactable": true, + "_N$enableAutoGrayEffect": false, + "_N$transition": 0, + "transition": 0, + "_N$normalColor": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_N$pressedColor": { + "__type__": "cc.Color", + "r": 211, + "g": 211, + "b": 211, + "a": 255 + }, + "pressedColor": { + "__type__": "cc.Color", + "r": 211, + "g": 211, + "b": 211, + "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": 124, + "g": 124, + "b": 124, + "a": 255 + }, + "_N$normalSprite": null, + "_N$pressedSprite": null, + "pressedSprite": null, + "_N$hoverSprite": null, + "hoverSprite": null, + "_N$disabledSprite": null, + "_N$target": { + "__id__": 13 + }, + "_id": "fdJg28i7pE6pi4D1ovRRp0" + }, + { + "__type__": "cc.ClickEvent", + "target": { + "__id__": 2 + }, + "component": "", + "_componentId": "f73a82LpAxBmZwDm8dJO3Q+", + "handler": "switchSceneByTransition", + "customEventData": "3" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 13 + }, + "_enabled": true, + "_materials": [ + { + "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432" + } + ], + "_srcBlendFactor": 770, + "_dstBlendFactor": 771, + "_spriteFrame": { + "__uuid__": "86714285-13db-44f6-86aa-11838e0d4831" + }, + "_type": 0, + "_sizeMode": 1, + "_fillType": 0, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": true, + "_atlas": null, + "_id": "c1sR5klVZHraEr68/UTkLE" + }, + { + "__type__": "cc.Widget", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 13 + }, + "_enabled": true, + "alignMode": 1, + "_target": null, + "_alignFlags": 17, + "_left": 0, + "_right": 0, + "_top": 180, + "_bottom": 0, + "_verticalCenter": 157.942, + "_horizontalCenter": 0, + "_isAbsLeft": true, + "_isAbsRight": true, + "_isAbsTop": true, + "_isAbsBottom": true, + "_isAbsHorizontalCenter": true, + "_isAbsVerticalCenter": true, + "_originalWidth": 0, + "_originalHeight": 0, + "_id": "a6rm0uXY9DlbNNnoWq9hN0" + } +] \ No newline at end of file diff --git a/assets/Scene/SwitchScene__Perlin/SwitchScene__Perlin.fire.meta b/assets/Scene/SwitchScene__Perlin/SwitchScene__Perlin.fire.meta new file mode 100644 index 0000000..fbf5927 --- /dev/null +++ b/assets/Scene/SwitchScene__Perlin/SwitchScene__Perlin.fire.meta @@ -0,0 +1,7 @@ +{ + "ver": "1.2.6", + "uuid": "c255828f-28b6-421d-ab95-e56d8319a07c", + "asyncLoadAssets": false, + "autoReleaseAssets": false, + "subMetas": {} +} \ No newline at end of file diff --git a/assets/Scene/SwitchScene__Perlin/SwitchScene__Perlin.ts b/assets/Scene/SwitchScene__Perlin/SwitchScene__Perlin.ts new file mode 100644 index 0000000..baa8cf3 --- /dev/null +++ b/assets/Scene/SwitchScene__Perlin/SwitchScene__Perlin.ts @@ -0,0 +1,88 @@ +const { ccclass, property } = cc._decorator; + +@ccclass +export default class SwitchScene extends cc.Component { + @property(cc.Node) separator = null; + + @property(cc.SpriteFrame) spriteFrame1 = null; + @property(cc.SpriteFrame) spriteFrame2 = null; + @property(cc.Sprite) bgSprite = null; + @property(cc.Material) material = null; + private _spriteMaterial: cc.Material; + + touchStartPos = cc.Vec2.ZERO; + separatorStartPos = cc.Vec2.ZERO; + + start() { + this.bgSprite.spriteFrame.setTexture(this.spriteFrame1._texture); + this.initSpriteMaterial(); + this.playTransitionAnimation(); + } + + onLoad() { + this.separatorStartPos = this.separator.getPosition(); + this.node.on(cc.Node.EventType.TOUCH_START, this.onTouchStart, this); + this.node.on(cc.Node.EventType.TOUCH_MOVE, this.onTouchMove, this); + } + + switchSceneByTransition(event, value) { + cc.director.emit('setBackBtnVisibility', false); + cc.director.emit('switchSceneByTransition', value); + } + + playTransitionAnimation() { + let progress = 0; + let targetProgress = cc.winSize.width; + let totalTime = 3; + let startTime = Date.now(); + + const loop = () => { + if (!this._spriteMaterial || !this.touchStartPos) return; + if (!this.touchStartPos.equals(cc.Vec2.ZERO)) return; + + let currentTime = Date.now(); + let elapsedTime = (currentTime - startTime) / 1000; + let _progress = (elapsedTime / totalTime) * targetProgress; + progress = Math.min(_progress, targetProgress); + + this._spriteMaterial.setProperty('time', progress / cc.winSize.width); + this.separator.setPosition({ x: progress, y: 0 }); + + if (progress < targetProgress) { + requestAnimationFrame(loop.bind(this)); + } + }; + loop(); + } + + onTouchStart(event) { + this.separatorStartPos = this.separator.getPosition(); + this.touchStartPos = this.node.convertToNodeSpaceAR(event.getLocation()); + } + + private onTouchMove(event) { + // 获取当前触摸点的位置 + let touchPos = this.node.convertToNodeSpaceAR(event.getLocation()); + // 计算触摸点相对于起始位置的偏移量 + let offset = touchPos.sub(this.touchStartPos); + let targetPos = this.separatorStartPos.add(offset); + let targetX = Math.max(0, Math.min(targetPos.x, cc.winSize.width)); + this.separator.setPosition({ + x: targetX, + y: 0 + }); + this._spriteMaterial.setProperty('time', targetX / cc.winSize.width); + } + + initSpriteMaterial() { + let newMaterial = cc.MaterialVariant.create(this.material, this.bgSprite); + newMaterial.setProperty('texture', this.spriteFrame1._texture); + newMaterial.setProperty('texture2', this.spriteFrame2._texture); + newMaterial.setProperty('time', 0.25); + + this.spriteFrame1._texture.setFlipY(true); + this.spriteFrame2._texture.setFlipY(true); + this.bgSprite.setMaterial(0, newMaterial); + this._spriteMaterial = newMaterial; + } +} diff --git a/assets/Scene/SwitchScene__Perlin/SwitchScene__Perlin.ts.meta b/assets/Scene/SwitchScene__Perlin/SwitchScene__Perlin.ts.meta new file mode 100644 index 0000000..70f9475 --- /dev/null +++ b/assets/Scene/SwitchScene__Perlin/SwitchScene__Perlin.ts.meta @@ -0,0 +1,9 @@ +{ + "ver": "1.0.5", + "uuid": "f73a8d8b-a40c-4199-9c03-9bc7493b743e", + "isPlugin": false, + "loadPluginInWeb": true, + "loadPluginInNative": true, + "loadPluginInEditor": false, + "subMetas": {} +} \ No newline at end of file diff --git a/assets/Scene/SwitchScene__Perlin/Texture.meta b/assets/Scene/SwitchScene__Perlin/Texture.meta new file mode 100644 index 0000000..30db9d7 --- /dev/null +++ b/assets/Scene/SwitchScene__Perlin/Texture.meta @@ -0,0 +1,7 @@ +{ + "ver": "1.0.1", + "uuid": "2ed3b822-f01e-4df0-b9b7-9913abcd8a74", + "isSubpackage": false, + "subpackageName": "", + "subMetas": {} +} \ No newline at end of file diff --git a/assets/Scene/SwitchScene__Perlin/Texture/bg1.jpeg b/assets/Scene/SwitchScene__Perlin/Texture/bg1.jpeg new file mode 100644 index 0000000..f905b16 Binary files /dev/null and b/assets/Scene/SwitchScene__Perlin/Texture/bg1.jpeg differ diff --git a/assets/Scene/SwitchScene__Perlin/Texture/bg1.jpeg.meta b/assets/Scene/SwitchScene__Perlin/Texture/bg1.jpeg.meta new file mode 100644 index 0000000..c31d50c --- /dev/null +++ b/assets/Scene/SwitchScene__Perlin/Texture/bg1.jpeg.meta @@ -0,0 +1,36 @@ +{ + "ver": "2.3.4", + "uuid": "7f5e5fa1-b48c-44e3-80f4-324d5286ac51", + "type": "sprite", + "wrapMode": "clamp", + "filterMode": "bilinear", + "premultiplyAlpha": false, + "genMipmaps": false, + "packable": true, + "width": 1600, + "height": 1200, + "platformSettings": {}, + "subMetas": { + "bg1": { + "ver": "1.0.4", + "uuid": "8ef474f4-5038-4363-8a35-cd2c2df2d8d6", + "rawTextureUuid": "7f5e5fa1-b48c-44e3-80f4-324d5286ac51", + "trimType": "auto", + "trimThreshold": 1, + "rotated": false, + "offsetX": 0, + "offsetY": 0, + "trimX": 0, + "trimY": 0, + "width": 1600, + "height": 1200, + "rawWidth": 1600, + "rawHeight": 1200, + "borderTop": 0, + "borderBottom": 0, + "borderLeft": 0, + "borderRight": 0, + "subMetas": {} + } + } +} \ No newline at end of file diff --git a/assets/Scene/SwitchScene__Perlin/Texture/bg2.jpeg b/assets/Scene/SwitchScene__Perlin/Texture/bg2.jpeg new file mode 100644 index 0000000..a5a3c9c Binary files /dev/null and b/assets/Scene/SwitchScene__Perlin/Texture/bg2.jpeg differ diff --git a/assets/Scene/SwitchScene__Perlin/Texture/bg2.jpeg.meta b/assets/Scene/SwitchScene__Perlin/Texture/bg2.jpeg.meta new file mode 100644 index 0000000..d104e3d --- /dev/null +++ b/assets/Scene/SwitchScene__Perlin/Texture/bg2.jpeg.meta @@ -0,0 +1,36 @@ +{ + "ver": "2.3.4", + "uuid": "ce5595f3-8df9-478a-9e41-4a165be77c71", + "type": "sprite", + "wrapMode": "clamp", + "filterMode": "bilinear", + "premultiplyAlpha": false, + "genMipmaps": false, + "packable": true, + "width": 1600, + "height": 1200, + "platformSettings": {}, + "subMetas": { + "bg2": { + "ver": "1.0.4", + "uuid": "5ff63ec2-5294-40af-9a60-4f837d09d814", + "rawTextureUuid": "ce5595f3-8df9-478a-9e41-4a165be77c71", + "trimType": "auto", + "trimThreshold": 1, + "rotated": false, + "offsetX": 0, + "offsetY": 0, + "trimX": 0, + "trimY": 0, + "width": 1600, + "height": 1200, + "rawWidth": 1600, + "rawHeight": 1200, + "borderTop": 0, + "borderBottom": 0, + "borderLeft": 0, + "borderRight": 0, + "subMetas": {} + } + } +} \ No newline at end of file diff --git a/assets/Scene/SwitchScene__Perlin/Texture/btn.png b/assets/Scene/SwitchScene__Perlin/Texture/btn.png new file mode 100644 index 0000000..bc4283d Binary files /dev/null and b/assets/Scene/SwitchScene__Perlin/Texture/btn.png differ diff --git a/assets/Scene/SwitchScene__Perlin/Texture/btn.png.meta b/assets/Scene/SwitchScene__Perlin/Texture/btn.png.meta new file mode 100644 index 0000000..22778fa --- /dev/null +++ b/assets/Scene/SwitchScene__Perlin/Texture/btn.png.meta @@ -0,0 +1,36 @@ +{ + "ver": "2.3.4", + "uuid": "7ef0dd99-bd4e-425f-ae16-e42c6f2c0a0b", + "type": "sprite", + "wrapMode": "clamp", + "filterMode": "bilinear", + "premultiplyAlpha": false, + "genMipmaps": false, + "packable": true, + "width": 1477, + "height": 118, + "platformSettings": {}, + "subMetas": { + "btn": { + "ver": "1.0.4", + "uuid": "2e5c2eba-5763-4675-9977-569657fff94e", + "rawTextureUuid": "7ef0dd99-bd4e-425f-ae16-e42c6f2c0a0b", + "trimType": "auto", + "trimThreshold": 1, + "rotated": false, + "offsetX": 0, + "offsetY": 0, + "trimX": 0, + "trimY": 0, + "width": 1477, + "height": 118, + "rawWidth": 1477, + "rawHeight": 118, + "borderTop": 0, + "borderBottom": 0, + "borderLeft": 0, + "borderRight": 0, + "subMetas": {} + } + } +} \ No newline at end of file diff --git a/assets/Scene/SwitchScene__PolkaDotsCurtain.meta b/assets/Scene/SwitchScene__PolkaDotsCurtain.meta new file mode 100644 index 0000000..d548358 --- /dev/null +++ b/assets/Scene/SwitchScene__PolkaDotsCurtain.meta @@ -0,0 +1,7 @@ +{ + "ver": "1.0.1", + "uuid": "5f5f749c-61be-48c1-b0fc-1a4df10190e9", + "isSubpackage": false, + "subpackageName": "", + "subMetas": {} +} \ No newline at end of file diff --git a/assets/Scene/SwitchScene__PolkaDotsCurtain/Materials.meta b/assets/Scene/SwitchScene__PolkaDotsCurtain/Materials.meta new file mode 100644 index 0000000..981716d --- /dev/null +++ b/assets/Scene/SwitchScene__PolkaDotsCurtain/Materials.meta @@ -0,0 +1,7 @@ +{ + "ver": "1.0.1", + "uuid": "274be50a-f5d7-4f56-a5db-a22261a4fa80", + "isSubpackage": false, + "subpackageName": "", + "subMetas": {} +} \ No newline at end of file diff --git a/assets/Scene/SwitchScene__PolkaDotsCurtain/Materials/PolkaDotsCurtain.effect b/assets/Scene/SwitchScene__PolkaDotsCurtain/Materials/PolkaDotsCurtain.effect new file mode 100644 index 0000000..8658d87 --- /dev/null +++ b/assets/Scene/SwitchScene__PolkaDotsCurtain/Materials/PolkaDotsCurtain.effect @@ -0,0 +1,89 @@ +// 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 } + dots: {value: 80.0} + center: {value: [0, 1]} + time: {value: 0} +}% + +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; + uniform sampler2D texture; + uniform sampler2D texture2; + uniform Common { + vec2 center; + float dots; + float time; + }; + float progress = time; + in mediump vec2 v_uv0; + in vec4 v_color; + + vec4 getFromColor(vec2 uv) { + return texture(texture, uv); + } + vec4 getToColor(vec2 uv) { + return texture(texture2, uv); + } + + vec4 transition(vec2 uv) { + // 计算当前UV坐标点到图像中心点的距离 + float distanceToCenter = distance(uv, center); + // 计算UV坐标点映射到dots纹理中的位置,并计算该位置与纹理中心点的距离 + float distanceToDotsCenter = distance(fract(uv * dots), vec2(0.5, 0.5)); + + // 比较UV坐标点到纹理中心点的距离与进度的比值,如果比值小于等于progress, + // 并且distanceToDotsCenter小于distanceToCenter,则认为需要切换到下一张图像 + bool nextImage = distanceToDotsCenter < (progress / distanceToCenter); + return nextImage ? getToColor(uv) : getFromColor(uv); + } + + void main () { + gl_FragColor = v_color * transition(v_uv0); + } +}% diff --git a/assets/Scene/SwitchScene__PolkaDotsCurtain/Materials/PolkaDotsCurtain.effect.meta b/assets/Scene/SwitchScene__PolkaDotsCurtain/Materials/PolkaDotsCurtain.effect.meta new file mode 100644 index 0000000..c2a14ca --- /dev/null +++ b/assets/Scene/SwitchScene__PolkaDotsCurtain/Materials/PolkaDotsCurtain.effect.meta @@ -0,0 +1,17 @@ +{ + "ver": "1.0.25", + "uuid": "b805e327-099f-4cb8-a66b-ebca7c96c0e7", + "compiledShaders": [ + { + "glsl1": { + "vert": "\nprecision highp float;\nuniform mediump mat4 cc_matViewProj;\nuniform mat4 cc_matWorld;\nattribute vec3 a_position;\nattribute vec4 a_color;\nvarying vec4 v_color;\n#if USE_TEXTURE\nattribute vec2 a_uv0;\nvarying vec2 v_uv0;\n#endif\nvoid main () {\n vec4 pos = vec4(a_position, 1);\n #if CC_USE_MODEL\n pos = cc_matViewProj * cc_matWorld * pos;\n #else\n pos = cc_matViewProj * pos;\n #endif\n #if USE_TEXTURE\n v_uv0 = a_uv0;\n #endif\n v_color = a_color;\n gl_Position = pos;\n}", + "frag": "\nprecision highp float;\nuniform sampler2D texture;\nuniform sampler2D texture2;\nuniform vec2 center;\nuniform float dots;\nuniform float time;\nfloat progress = time;\nvarying mediump vec2 v_uv0;\nvarying vec4 v_color;\nvec4 getFromColor(vec2 uv) {\n return texture2D(texture, uv);\n}\nvec4 getToColor(vec2 uv) {\n return texture2D(texture2, uv);\n}\nvec4 transition(vec2 uv) {\n float distanceToCenter = distance(uv, center);\n float distanceToDotsCenter = distance(fract(uv * dots), vec2(0.5, 0.5));\n bool nextImage = distanceToDotsCenter < (progress / distanceToCenter);\n return nextImage ? getToColor(uv) : getFromColor(uv);\n}\nvoid main () {\n gl_FragColor = v_color * transition(v_uv0);\n}" + }, + "glsl3": { + "vert": "\nprecision highp float;\nuniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_nativeSize;\n highp mat4 cc_matView;\n mediump mat4 cc_matViewInv;\n mediump mat4 cc_matProj;\n mediump mat4 cc_matProjInv;\n mediump mat4 cc_matViewProj;\n mediump mat4 cc_matViewProjInv;\n mediump vec4 cc_cameraPos;\n};\nuniform CCLocal {\n mat4 cc_matWorld;\n mat4 cc_matWorldIT;\n};\nin vec3 a_position;\nin vec4 a_color;\nout vec4 v_color;\n#if USE_TEXTURE\nin vec2 a_uv0;\nout vec2 v_uv0;\n#endif\nvoid main () {\n vec4 pos = vec4(a_position, 1);\n #if CC_USE_MODEL\n pos = cc_matViewProj * cc_matWorld * pos;\n #else\n pos = cc_matViewProj * pos;\n #endif\n #if USE_TEXTURE\n v_uv0 = a_uv0;\n #endif\n v_color = a_color;\n gl_Position = pos;\n}", + "frag": "\nprecision highp float;\nuniform sampler2D texture;\nuniform sampler2D texture2;\nuniform Common {\n vec2 center;\n float dots;\n float time;\n};\nfloat progress = time;\nin mediump vec2 v_uv0;\nin vec4 v_color;\nvec4 getFromColor(vec2 uv) {\n return texture(texture, uv);\n}\nvec4 getToColor(vec2 uv) {\n return texture(texture2, uv);\n}\nvec4 transition(vec2 uv) {\n float distanceToCenter = distance(uv, center);\n float distanceToDotsCenter = distance(fract(uv * dots), vec2(0.5, 0.5));\n bool nextImage = distanceToDotsCenter < (progress / distanceToCenter);\n return nextImage ? getToColor(uv) : getFromColor(uv);\n}\nvoid main () {\n gl_FragColor = v_color * transition(v_uv0);\n}" + } + } + ], + "subMetas": {} +} \ No newline at end of file diff --git a/assets/Scene/SwitchScene__PolkaDotsCurtain/Materials/PolkaDotsCurtain.mtl b/assets/Scene/SwitchScene__PolkaDotsCurtain/Materials/PolkaDotsCurtain.mtl new file mode 100644 index 0000000..3b8c4ea --- /dev/null +++ b/assets/Scene/SwitchScene__PolkaDotsCurtain/Materials/PolkaDotsCurtain.mtl @@ -0,0 +1,25 @@ +{ + "__type__": "cc.Material", + "_name": "PolkaDotsCurtain", + "_objFlags": 0, + "_native": "", + "_effectAsset": { + "__uuid__": "b805e327-099f-4cb8-a66b-ebca7c96c0e7" + }, + "_techniqueIndex": 0, + "_techniqueData": { + "0": { + "defines": { + "USE_TEXTURE": true + }, + "props": { + "center": { + "__type__": "cc.Vec2", + "x": 0, + "y": 1 + }, + "dots": 80 + } + } + } +} \ No newline at end of file diff --git a/assets/Scene/SwitchScene__PolkaDotsCurtain/Materials/PolkaDotsCurtain.mtl.meta b/assets/Scene/SwitchScene__PolkaDotsCurtain/Materials/PolkaDotsCurtain.mtl.meta new file mode 100644 index 0000000..51725a3 --- /dev/null +++ b/assets/Scene/SwitchScene__PolkaDotsCurtain/Materials/PolkaDotsCurtain.mtl.meta @@ -0,0 +1,6 @@ +{ + "ver": "1.0.3", + "uuid": "985a2d90-fd09-4d07-9d94-a50d5af116d9", + "dataAsSubAsset": null, + "subMetas": {} +} \ No newline at end of file diff --git a/assets/Scene/SwitchScene__PolkaDotsCurtain/SwitchScene__PolkaDotsCurtain.fire b/assets/Scene/SwitchScene__PolkaDotsCurtain/SwitchScene__PolkaDotsCurtain.fire new file mode 100644 index 0000000..2302b1c --- /dev/null +++ b/assets/Scene/SwitchScene__PolkaDotsCurtain/SwitchScene__PolkaDotsCurtain.fire @@ -0,0 +1,740 @@ +[ + { + "__type__": "cc.SceneAsset", + "_name": "", + "_objFlags": 0, + "_native": "", + "scene": { + "__id__": 1 + } + }, + { + "__type__": "cc.Scene", + "_objFlags": 0, + "_parent": null, + "_children": [ + { + "__id__": 2 + }, + { + "__id__": 11 + }, + { + "__id__": 13 + }, + { + "__id__": 8 + } + ], + "_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": "582e4910-11a1-4f5c-9441-aa319156d8c4" + }, + { + "__type__": "cc.Node", + "_name": "Canvas", + "_objFlags": 512, + "_parent": { + "__id__": 1 + }, + "_children": [ + { + "__id__": 3 + } + ], + "_active": true, + "_components": [ + { + "__id__": 5 + }, + { + "__id__": 6 + }, + { + "__id__": 7 + } + ], + "_prefab": null, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 1334, + "height": 750 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + 667, + 375, + 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": "a5esZu+45LA5mBpvttspPD" + }, + { + "__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": 960, + "height": 640 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + 0, + 0, + 452.93128617926146, + 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": "e1WoFrQ79G7r4ZuQE3HlNb" + }, + { + "__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": "81GN3uXINKVLeW4+iKSlim" + }, + { + "__type__": "cc.Canvas", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 2 + }, + "_enabled": true, + "_designResolution": { + "__type__": "cc.Size", + "width": 1334, + "height": 750 + }, + "_fitWidth": false, + "_fitHeight": true, + "_id": "59Cd0ovbdF4byw5sbjJDx7" + }, + { + "__type__": "cc.Widget", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 2 + }, + "_enabled": true, + "alignMode": 1, + "_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": 0, + "_originalHeight": 0, + "_id": "29zXboiXFBKoIV4PQ2liTe" + }, + { + "__type__": "0445dlJQ9tLR7xapzM+CJSX", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 2 + }, + "_enabled": true, + "separator": { + "__id__": 8 + }, + "spriteFrame1": { + "__uuid__": "40bfcf63-95f8-4023-9b53-f46addfc260c" + }, + "spriteFrame2": { + "__uuid__": "d459a6d4-cd68-474a-bc44-33996165b2e7" + }, + "bgSprite": { + "__id__": 10 + }, + "material": { + "__uuid__": "985a2d90-fd09-4d07-9d94-a50d5af116d9" + }, + "_id": "ddjmI/yPpFzIp77M2Qbh6p" + }, + { + "__type__": "cc.Node", + "_name": "Separator", + "_objFlags": 0, + "_parent": { + "__id__": 1 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 9 + } + ], + "_prefab": null, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 171, + "b": 23, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 10, + "height": 750 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + 333, + 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": "00zwOFnw9A9Y2jJcAfpxGt" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 8 + }, + "_enabled": true, + "_materials": [ + { + "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432" + } + ], + "_srcBlendFactor": 770, + "_dstBlendFactor": 771, + "_spriteFrame": { + "__uuid__": "5c3bb932-6c3c-468f-88a9-c8c61d458641" + }, + "_type": 0, + "_sizeMode": 0, + "_fillType": 0, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": true, + "_atlas": null, + "_id": "bfovdQprtLZrbQA9328iTr" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 11 + }, + "_enabled": true, + "_materials": [ + { + "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432" + } + ], + "_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": "b70P96s8FD1LitaZ7aobMA" + }, + { + "__type__": "cc.Node", + "_name": "Bg", + "_objFlags": 0, + "_parent": { + "__id__": 1 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 10 + }, + { + "__id__": 12 + } + ], + "_prefab": null, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 1334, + "height": 750 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + 667, + 375, + 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": "34YKVYdF5MoYlFN+Zfb6wk" + }, + { + "__type__": "cc.Widget", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 11 + }, + "_enabled": true, + "alignMode": 1, + "_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": 1024, + "_originalHeight": 445, + "_id": "711M5JfuBPs5F7P5bDVb/1" + }, + { + "__type__": "cc.Node", + "_name": "Btn", + "_objFlags": 0, + "_parent": { + "__id__": 1 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 14 + }, + { + "__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": 1477, + "height": 118 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + 667, + 528.7, + 0, + 0, + 0, + 0, + 1, + 0.7, + 0.7, + 1 + ] + }, + "_eulerAngles": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_skewX": 0, + "_skewY": 0, + "_is3DNode": false, + "_groupIndex": 0, + "groupIndex": 0, + "_id": "bcVNNAEfFEJL7tftaCUB7n" + }, + { + "__type__": "cc.Button", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 13 + }, + "_enabled": true, + "_normalMaterial": null, + "_grayMaterial": null, + "duration": 0.1, + "zoomScale": 1.2, + "clickEvents": [ + { + "__id__": 15 + } + ], + "_N$interactable": true, + "_N$enableAutoGrayEffect": false, + "_N$transition": 0, + "transition": 0, + "_N$normalColor": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_N$pressedColor": { + "__type__": "cc.Color", + "r": 211, + "g": 211, + "b": 211, + "a": 255 + }, + "pressedColor": { + "__type__": "cc.Color", + "r": 211, + "g": 211, + "b": 211, + "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": 124, + "g": 124, + "b": 124, + "a": 255 + }, + "_N$normalSprite": null, + "_N$pressedSprite": null, + "pressedSprite": null, + "_N$hoverSprite": null, + "hoverSprite": null, + "_N$disabledSprite": null, + "_N$target": { + "__id__": 13 + }, + "_id": "fdJg28i7pE6pi4D1ovRRp0" + }, + { + "__type__": "cc.ClickEvent", + "target": { + "__id__": 2 + }, + "component": "", + "_componentId": "0445dlJQ9tLR7xapzM+CJSX", + "handler": "switchSceneByTransition", + "customEventData": "4" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 13 + }, + "_enabled": true, + "_materials": [ + { + "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432" + } + ], + "_srcBlendFactor": 770, + "_dstBlendFactor": 771, + "_spriteFrame": { + "__uuid__": "86714285-13db-44f6-86aa-11838e0d4831" + }, + "_type": 0, + "_sizeMode": 1, + "_fillType": 0, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": true, + "_atlas": null, + "_id": "c1sR5klVZHraEr68/UTkLE" + }, + { + "__type__": "cc.Widget", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 13 + }, + "_enabled": true, + "alignMode": 1, + "_target": null, + "_alignFlags": 17, + "_left": 0, + "_right": 0, + "_top": 180, + "_bottom": 0, + "_verticalCenter": 157.942, + "_horizontalCenter": 0, + "_isAbsLeft": true, + "_isAbsRight": true, + "_isAbsTop": true, + "_isAbsBottom": true, + "_isAbsHorizontalCenter": true, + "_isAbsVerticalCenter": true, + "_originalWidth": 0, + "_originalHeight": 0, + "_id": "a6rm0uXY9DlbNNnoWq9hN0" + } +] \ No newline at end of file diff --git a/assets/Scene/SwitchScene__PolkaDotsCurtain/SwitchScene__PolkaDotsCurtain.fire.meta b/assets/Scene/SwitchScene__PolkaDotsCurtain/SwitchScene__PolkaDotsCurtain.fire.meta new file mode 100644 index 0000000..10d323c --- /dev/null +++ b/assets/Scene/SwitchScene__PolkaDotsCurtain/SwitchScene__PolkaDotsCurtain.fire.meta @@ -0,0 +1,7 @@ +{ + "ver": "1.2.6", + "uuid": "582e4910-11a1-4f5c-9441-aa319156d8c4", + "asyncLoadAssets": false, + "autoReleaseAssets": false, + "subMetas": {} +} \ No newline at end of file diff --git a/assets/Scene/SwitchScene__PolkaDotsCurtain/SwitchScene__PolkaDotsCurtain.ts b/assets/Scene/SwitchScene__PolkaDotsCurtain/SwitchScene__PolkaDotsCurtain.ts new file mode 100644 index 0000000..baa8cf3 --- /dev/null +++ b/assets/Scene/SwitchScene__PolkaDotsCurtain/SwitchScene__PolkaDotsCurtain.ts @@ -0,0 +1,88 @@ +const { ccclass, property } = cc._decorator; + +@ccclass +export default class SwitchScene extends cc.Component { + @property(cc.Node) separator = null; + + @property(cc.SpriteFrame) spriteFrame1 = null; + @property(cc.SpriteFrame) spriteFrame2 = null; + @property(cc.Sprite) bgSprite = null; + @property(cc.Material) material = null; + private _spriteMaterial: cc.Material; + + touchStartPos = cc.Vec2.ZERO; + separatorStartPos = cc.Vec2.ZERO; + + start() { + this.bgSprite.spriteFrame.setTexture(this.spriteFrame1._texture); + this.initSpriteMaterial(); + this.playTransitionAnimation(); + } + + onLoad() { + this.separatorStartPos = this.separator.getPosition(); + this.node.on(cc.Node.EventType.TOUCH_START, this.onTouchStart, this); + this.node.on(cc.Node.EventType.TOUCH_MOVE, this.onTouchMove, this); + } + + switchSceneByTransition(event, value) { + cc.director.emit('setBackBtnVisibility', false); + cc.director.emit('switchSceneByTransition', value); + } + + playTransitionAnimation() { + let progress = 0; + let targetProgress = cc.winSize.width; + let totalTime = 3; + let startTime = Date.now(); + + const loop = () => { + if (!this._spriteMaterial || !this.touchStartPos) return; + if (!this.touchStartPos.equals(cc.Vec2.ZERO)) return; + + let currentTime = Date.now(); + let elapsedTime = (currentTime - startTime) / 1000; + let _progress = (elapsedTime / totalTime) * targetProgress; + progress = Math.min(_progress, targetProgress); + + this._spriteMaterial.setProperty('time', progress / cc.winSize.width); + this.separator.setPosition({ x: progress, y: 0 }); + + if (progress < targetProgress) { + requestAnimationFrame(loop.bind(this)); + } + }; + loop(); + } + + onTouchStart(event) { + this.separatorStartPos = this.separator.getPosition(); + this.touchStartPos = this.node.convertToNodeSpaceAR(event.getLocation()); + } + + private onTouchMove(event) { + // 获取当前触摸点的位置 + let touchPos = this.node.convertToNodeSpaceAR(event.getLocation()); + // 计算触摸点相对于起始位置的偏移量 + let offset = touchPos.sub(this.touchStartPos); + let targetPos = this.separatorStartPos.add(offset); + let targetX = Math.max(0, Math.min(targetPos.x, cc.winSize.width)); + this.separator.setPosition({ + x: targetX, + y: 0 + }); + this._spriteMaterial.setProperty('time', targetX / cc.winSize.width); + } + + initSpriteMaterial() { + let newMaterial = cc.MaterialVariant.create(this.material, this.bgSprite); + newMaterial.setProperty('texture', this.spriteFrame1._texture); + newMaterial.setProperty('texture2', this.spriteFrame2._texture); + newMaterial.setProperty('time', 0.25); + + this.spriteFrame1._texture.setFlipY(true); + this.spriteFrame2._texture.setFlipY(true); + this.bgSprite.setMaterial(0, newMaterial); + this._spriteMaterial = newMaterial; + } +} diff --git a/assets/Scene/SwitchScene__PolkaDotsCurtain/SwitchScene__PolkaDotsCurtain.ts.meta b/assets/Scene/SwitchScene__PolkaDotsCurtain/SwitchScene__PolkaDotsCurtain.ts.meta new file mode 100644 index 0000000..873b67c --- /dev/null +++ b/assets/Scene/SwitchScene__PolkaDotsCurtain/SwitchScene__PolkaDotsCurtain.ts.meta @@ -0,0 +1,9 @@ +{ + "ver": "1.0.5", + "uuid": "0445d949-43db-4b47-bc5a-a7333e089497", + "isPlugin": false, + "loadPluginInWeb": true, + "loadPluginInNative": true, + "loadPluginInEditor": false, + "subMetas": {} +} \ No newline at end of file diff --git a/assets/Scene/SwitchScene__PolkaDotsCurtain/Texture.meta b/assets/Scene/SwitchScene__PolkaDotsCurtain/Texture.meta new file mode 100644 index 0000000..1f3ea59 --- /dev/null +++ b/assets/Scene/SwitchScene__PolkaDotsCurtain/Texture.meta @@ -0,0 +1,7 @@ +{ + "ver": "1.0.1", + "uuid": "4c24576e-d3fd-45f9-ab3c-90b5dd2af491", + "isSubpackage": false, + "subpackageName": "", + "subMetas": {} +} \ No newline at end of file diff --git a/assets/Scene/SwitchScene__PolkaDotsCurtain/Texture/bg1.jpeg b/assets/Scene/SwitchScene__PolkaDotsCurtain/Texture/bg1.jpeg new file mode 100644 index 0000000..f905b16 Binary files /dev/null and b/assets/Scene/SwitchScene__PolkaDotsCurtain/Texture/bg1.jpeg differ diff --git a/assets/Scene/SwitchScene__PolkaDotsCurtain/Texture/bg1.jpeg.meta b/assets/Scene/SwitchScene__PolkaDotsCurtain/Texture/bg1.jpeg.meta new file mode 100644 index 0000000..9a1f70d --- /dev/null +++ b/assets/Scene/SwitchScene__PolkaDotsCurtain/Texture/bg1.jpeg.meta @@ -0,0 +1,36 @@ +{ + "ver": "2.3.4", + "uuid": "7b3ab555-1089-4fd4-9d54-7c8106aaf851", + "type": "sprite", + "wrapMode": "clamp", + "filterMode": "bilinear", + "premultiplyAlpha": false, + "genMipmaps": false, + "packable": true, + "width": 1600, + "height": 1200, + "platformSettings": {}, + "subMetas": { + "bg1": { + "ver": "1.0.4", + "uuid": "40bfcf63-95f8-4023-9b53-f46addfc260c", + "rawTextureUuid": "7b3ab555-1089-4fd4-9d54-7c8106aaf851", + "trimType": "auto", + "trimThreshold": 1, + "rotated": false, + "offsetX": 0, + "offsetY": 0, + "trimX": 0, + "trimY": 0, + "width": 1600, + "height": 1200, + "rawWidth": 1600, + "rawHeight": 1200, + "borderTop": 0, + "borderBottom": 0, + "borderLeft": 0, + "borderRight": 0, + "subMetas": {} + } + } +} \ No newline at end of file diff --git a/assets/Scene/SwitchScene__PolkaDotsCurtain/Texture/bg2.jpeg b/assets/Scene/SwitchScene__PolkaDotsCurtain/Texture/bg2.jpeg new file mode 100644 index 0000000..a5a3c9c Binary files /dev/null and b/assets/Scene/SwitchScene__PolkaDotsCurtain/Texture/bg2.jpeg differ diff --git a/assets/Scene/SwitchScene__PolkaDotsCurtain/Texture/bg2.jpeg.meta b/assets/Scene/SwitchScene__PolkaDotsCurtain/Texture/bg2.jpeg.meta new file mode 100644 index 0000000..e0abeab --- /dev/null +++ b/assets/Scene/SwitchScene__PolkaDotsCurtain/Texture/bg2.jpeg.meta @@ -0,0 +1,36 @@ +{ + "ver": "2.3.4", + "uuid": "fe4f9866-9815-41fe-b68f-db9ece82bd26", + "type": "sprite", + "wrapMode": "clamp", + "filterMode": "bilinear", + "premultiplyAlpha": false, + "genMipmaps": false, + "packable": true, + "width": 1600, + "height": 1200, + "platformSettings": {}, + "subMetas": { + "bg2": { + "ver": "1.0.4", + "uuid": "d459a6d4-cd68-474a-bc44-33996165b2e7", + "rawTextureUuid": "fe4f9866-9815-41fe-b68f-db9ece82bd26", + "trimType": "auto", + "trimThreshold": 1, + "rotated": false, + "offsetX": 0, + "offsetY": 0, + "trimX": 0, + "trimY": 0, + "width": 1600, + "height": 1200, + "rawWidth": 1600, + "rawHeight": 1200, + "borderTop": 0, + "borderBottom": 0, + "borderLeft": 0, + "borderRight": 0, + "subMetas": {} + } + } +} \ No newline at end of file diff --git a/assets/Scene/SwitchScene__PolkaDotsCurtain/Texture/btn.png b/assets/Scene/SwitchScene__PolkaDotsCurtain/Texture/btn.png new file mode 100644 index 0000000..bc4283d Binary files /dev/null and b/assets/Scene/SwitchScene__PolkaDotsCurtain/Texture/btn.png differ diff --git a/assets/Scene/SwitchScene__PolkaDotsCurtain/Texture/btn.png.meta b/assets/Scene/SwitchScene__PolkaDotsCurtain/Texture/btn.png.meta new file mode 100644 index 0000000..162377a --- /dev/null +++ b/assets/Scene/SwitchScene__PolkaDotsCurtain/Texture/btn.png.meta @@ -0,0 +1,36 @@ +{ + "ver": "2.3.4", + "uuid": "e94e39b2-ce34-4776-9419-4d2a7a6f1774", + "type": "sprite", + "wrapMode": "clamp", + "filterMode": "bilinear", + "premultiplyAlpha": false, + "genMipmaps": false, + "packable": true, + "width": 1477, + "height": 118, + "platformSettings": {}, + "subMetas": { + "btn": { + "ver": "1.0.4", + "uuid": "b2e58877-f147-40cc-bf19-b5eed5bb9590", + "rawTextureUuid": "e94e39b2-ce34-4776-9419-4d2a7a6f1774", + "trimType": "auto", + "trimThreshold": 1, + "rotated": false, + "offsetX": 0, + "offsetY": 0, + "trimX": 0, + "trimY": 0, + "width": 1477, + "height": 118, + "rawWidth": 1477, + "rawHeight": 118, + "borderTop": 0, + "borderBottom": 0, + "borderLeft": 0, + "borderRight": 0, + "subMetas": {} + } + } +} \ No newline at end of file diff --git a/assets/Scene/SwitchScene__SquaresWire/SwitchScene__SquaresWire.fire b/assets/Scene/SwitchScene__SquaresWire/SwitchScene__SquaresWire.fire index 18d7a32..e4bacc7 100644 --- a/assets/Scene/SwitchScene__SquaresWire/SwitchScene__SquaresWire.fire +++ b/assets/Scene/SwitchScene__SquaresWire/SwitchScene__SquaresWire.fire @@ -180,7 +180,7 @@ "array": [ 0, 0, - 769.0305585605815, + 452.93128617926146, 0, 0, 0, @@ -284,7 +284,7 @@ "_id": "29zXboiXFBKoIV4PQ2liTe" }, { - "__type__": "d3f4aqDF35LMbT4FoeX+msm", + "__type__": "9a422OgmqtKVbOR0Q+NC+Bk", "_name": "", "_objFlags": 0, "node": { @@ -306,7 +306,7 @@ "material": { "__uuid__": "a869ac13-ffed-4334-b5df-1251273f2b07" }, - "_id": "baVBIwAahNp5q/xqS/DqnM" + "_id": "d3mJxgwgVFOaVDy9/WXkqz" }, { "__type__": "cc.Node", @@ -674,9 +674,9 @@ "__id__": 2 }, "component": "", - "_componentId": "d3f4aqDF35LMbT4FoeX+msm", + "_componentId": "9a422OgmqtKVbOR0Q+NC+Bk", "handler": "switchSceneByTransition", - "customEventData": "" + "customEventData": "5" }, { "__type__": "cc.Sprite", diff --git a/assets/Scene/SwitchScene__SquaresWire/SwitchScene__SquaresWire.ts b/assets/Scene/SwitchScene__SquaresWire/SwitchScene__SquaresWire.ts new file mode 100644 index 0000000..baa8cf3 --- /dev/null +++ b/assets/Scene/SwitchScene__SquaresWire/SwitchScene__SquaresWire.ts @@ -0,0 +1,88 @@ +const { ccclass, property } = cc._decorator; + +@ccclass +export default class SwitchScene extends cc.Component { + @property(cc.Node) separator = null; + + @property(cc.SpriteFrame) spriteFrame1 = null; + @property(cc.SpriteFrame) spriteFrame2 = null; + @property(cc.Sprite) bgSprite = null; + @property(cc.Material) material = null; + private _spriteMaterial: cc.Material; + + touchStartPos = cc.Vec2.ZERO; + separatorStartPos = cc.Vec2.ZERO; + + start() { + this.bgSprite.spriteFrame.setTexture(this.spriteFrame1._texture); + this.initSpriteMaterial(); + this.playTransitionAnimation(); + } + + onLoad() { + this.separatorStartPos = this.separator.getPosition(); + this.node.on(cc.Node.EventType.TOUCH_START, this.onTouchStart, this); + this.node.on(cc.Node.EventType.TOUCH_MOVE, this.onTouchMove, this); + } + + switchSceneByTransition(event, value) { + cc.director.emit('setBackBtnVisibility', false); + cc.director.emit('switchSceneByTransition', value); + } + + playTransitionAnimation() { + let progress = 0; + let targetProgress = cc.winSize.width; + let totalTime = 3; + let startTime = Date.now(); + + const loop = () => { + if (!this._spriteMaterial || !this.touchStartPos) return; + if (!this.touchStartPos.equals(cc.Vec2.ZERO)) return; + + let currentTime = Date.now(); + let elapsedTime = (currentTime - startTime) / 1000; + let _progress = (elapsedTime / totalTime) * targetProgress; + progress = Math.min(_progress, targetProgress); + + this._spriteMaterial.setProperty('time', progress / cc.winSize.width); + this.separator.setPosition({ x: progress, y: 0 }); + + if (progress < targetProgress) { + requestAnimationFrame(loop.bind(this)); + } + }; + loop(); + } + + onTouchStart(event) { + this.separatorStartPos = this.separator.getPosition(); + this.touchStartPos = this.node.convertToNodeSpaceAR(event.getLocation()); + } + + private onTouchMove(event) { + // 获取当前触摸点的位置 + let touchPos = this.node.convertToNodeSpaceAR(event.getLocation()); + // 计算触摸点相对于起始位置的偏移量 + let offset = touchPos.sub(this.touchStartPos); + let targetPos = this.separatorStartPos.add(offset); + let targetX = Math.max(0, Math.min(targetPos.x, cc.winSize.width)); + this.separator.setPosition({ + x: targetX, + y: 0 + }); + this._spriteMaterial.setProperty('time', targetX / cc.winSize.width); + } + + initSpriteMaterial() { + let newMaterial = cc.MaterialVariant.create(this.material, this.bgSprite); + newMaterial.setProperty('texture', this.spriteFrame1._texture); + newMaterial.setProperty('texture2', this.spriteFrame2._texture); + newMaterial.setProperty('time', 0.25); + + this.spriteFrame1._texture.setFlipY(true); + this.spriteFrame2._texture.setFlipY(true); + this.bgSprite.setMaterial(0, newMaterial); + this._spriteMaterial = newMaterial; + } +} diff --git a/assets/Scene/SwitchScene__SquaresWire/SwitchScene__SquaresWire.ts.meta b/assets/Scene/SwitchScene__SquaresWire/SwitchScene__SquaresWire.ts.meta new file mode 100644 index 0000000..aea3cb5 --- /dev/null +++ b/assets/Scene/SwitchScene__SquaresWire/SwitchScene__SquaresWire.ts.meta @@ -0,0 +1,9 @@ +{ + "ver": "1.0.5", + "uuid": "9a4223a0-9aab-4a55-b391-d10f8d0be064", + "isPlugin": false, + "loadPluginInWeb": true, + "loadPluginInNative": true, + "loadPluginInEditor": false, + "subMetas": {} +} \ No newline at end of file diff --git a/assets/Scene/SwitchScene__Strip.meta b/assets/Scene/SwitchScene__Strip.meta new file mode 100644 index 0000000..5deb5ce --- /dev/null +++ b/assets/Scene/SwitchScene__Strip.meta @@ -0,0 +1,7 @@ +{ + "ver": "1.0.1", + "uuid": "912fa62d-24ff-43c2-bf85-e20e958aef64", + "isSubpackage": false, + "subpackageName": "", + "subMetas": {} +} \ No newline at end of file diff --git a/assets/Scene/SwitchScene__Strip/Materials.meta b/assets/Scene/SwitchScene__Strip/Materials.meta new file mode 100644 index 0000000..edb5c36 --- /dev/null +++ b/assets/Scene/SwitchScene__Strip/Materials.meta @@ -0,0 +1,7 @@ +{ + "ver": "1.0.1", + "uuid": "262f1940-d016-4f77-be84-7327c6b4596b", + "isSubpackage": false, + "subpackageName": "", + "subMetas": {} +} \ No newline at end of file diff --git a/assets/Scene/SwitchScene__Strip/Materials/strip-lt.mtl b/assets/Scene/SwitchScene__Strip/Materials/strip-lt.mtl new file mode 100644 index 0000000..6196e95 --- /dev/null +++ b/assets/Scene/SwitchScene__Strip/Materials/strip-lt.mtl @@ -0,0 +1,22 @@ +{ + "__type__": "cc.Material", + "_name": "strip-lt", + "_objFlags": 0, + "_native": "", + "_effectAsset": { + "__uuid__": "6b233ee2-ef6d-4ee5-9b24-999badfcff68" + }, + "_techniqueIndex": 0, + "_techniqueData": { + "0": { + "props": { + "direction": { + "__type__": "cc.Vec2", + "x": -1, + "y": 1 + } + }, + "defines": {} + } + } +} \ No newline at end of file diff --git a/assets/Scene/SwitchScene__Strip/Materials/strip-lt.mtl.meta b/assets/Scene/SwitchScene__Strip/Materials/strip-lt.mtl.meta new file mode 100644 index 0000000..8e6d6da --- /dev/null +++ b/assets/Scene/SwitchScene__Strip/Materials/strip-lt.mtl.meta @@ -0,0 +1,6 @@ +{ + "ver": "1.0.3", + "uuid": "ee73e8c0-5ff0-486a-bcdf-dec85b04755b", + "dataAsSubAsset": null, + "subMetas": {} +} \ No newline at end of file diff --git a/assets/Scene/SwitchScene__Strip/Materials/strip.effect b/assets/Scene/SwitchScene__Strip/Materials/strip.effect new file mode 100644 index 0000000..eda0e1d --- /dev/null +++ b/assets/Scene/SwitchScene__Strip/Materials/strip.effect @@ -0,0 +1,140 @@ +// 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 } + texture2: { value: white } + time: { value: 0 } + direction: { value: [1, 1]} +}% + +CCProgram transition %{ + +// https://www.shadertoy.com/view/ls3cDB + +const float PI = 3.141592653589793; +const float PI_2 = 3.141592653589793; + +#define radius .1 + +uniform Transition { + vec2 direction; // = [1, 1] +}; + +float aspect = 1.;//screenSize.x / screenSize.y; + +vec4 iMouse = vec4( + screenSize.x * (mod((1.0 + time * direction.x), 1.0) + 0.2 * sign(direction.x)), + screenSize.y * (mod((1.0 + time * direction.y), 1.0) + 0.2 * sign(direction.y)), + screenSize.x * (1.0 - step(0.0, direction.x)), + screenSize.y * (1.0 - step(0.0, direction.y)) +); + + +vec2 mouse = iMouse.xy * vec2(aspect, 1.) / screenSize.xy; +vec2 mouseDir = normalize(abs(iMouse.zw) - iMouse.xy); + +vec4 transition(vec2 uv) { + // vec2 uv = fragCoord * vec2(aspect, 1.) / screenSize.xy; + + float dist = dot(uv - mouse, mouseDir); + vec2 linePoint = uv - dist * mouseDir; + + vec4 fragColor = vec4(1.0); + if (dist > radius) { + fragColor = texture(texture2, uv); + // add shadow + // fragColor.rgb *= pow(clamp(dist - radius, 0., 1.) * 1.5, .2); + } + else if (dist >= 0.) { + // map to cylinder point + float theta = asin(dist / radius); + vec2 p2 = linePoint + mouseDir * (PI - theta) * radius; + vec2 p1 = linePoint + mouseDir * theta * radius; + uv = (p2.x <= aspect && p2.y <= 1. && p2.x > 0. && p2.y > 0.) ? p2 : p1; + fragColor = texture(texture, uv); + fragColor.rgb *= pow(clamp((radius - dist) / radius, 0., 1.), .2); + } + else { + vec2 p = linePoint + mouseDir * (abs(dist) + PI * radius); + uv = (p.x <= aspect && p.y <= 1. && p.x > 0. && p.y > 0.) ? p : uv; + fragColor = texture(texture, uv); + } + + return fragColor; +} + +}% + +CCProgram vs %{ + +precision highp float; + +#include +#include + +in vec3 a_position; +in lowp vec4 a_color; + +in mediump vec2 a_uv0; +out mediump vec2 v_uv0; + +out lowp vec4 v_color; + +uniform Time { + vec2 screenSize; + float time; +}; + +void main() { + mat4 mvp; + + mvp = cc_matViewProj; + + v_uv0 = a_uv0; + v_color = a_color; + + gl_Position = mvp * vec4(a_position, 1); +} + +}% + +CCProgram fs %{ + +precision highp float; + +uniform sampler2D texture; +uniform sampler2D texture2; +in mediump vec2 v_uv0; + +uniform Time { + vec2 screenSize; + float time; +}; + +in lowp vec4 v_color; + +vec4 getFromColor(vec2 uv) { + return texture(texture, uv); +} + +vec4 getToColor(vec2 uv) { + return texture(texture2, uv); +} + +#include + +void main () { + gl_FragColor = v_color * transition(v_uv0); +} + +}% diff --git a/assets/Scene/SwitchScene__Strip/Materials/strip.effect.meta b/assets/Scene/SwitchScene__Strip/Materials/strip.effect.meta new file mode 100644 index 0000000..7afbaa9 --- /dev/null +++ b/assets/Scene/SwitchScene__Strip/Materials/strip.effect.meta @@ -0,0 +1,17 @@ +{ + "ver": "1.0.25", + "uuid": "6b233ee2-ef6d-4ee5-9b24-999badfcff68", + "compiledShaders": [ + { + "glsl1": { + "vert": "\nprecision highp float;\nuniform mediump mat4 cc_matViewProj;\nattribute vec3 a_position;\nattribute lowp vec4 a_color;\nattribute mediump vec2 a_uv0;\nvarying mediump vec2 v_uv0;\nvarying lowp vec4 v_color;\nvoid main() {\n mat4 mvp;\n mvp = cc_matViewProj;\n v_uv0 = a_uv0;\n v_color = a_color;\n gl_Position = mvp * vec4(a_position, 1);\n}", + "frag": "\nprecision highp float;\nuniform sampler2D texture;\nuniform sampler2D texture2;\nvarying mediump vec2 v_uv0;\nuniform vec2 screenSize;\nuniform float time;\nvarying lowp vec4 v_color;\nconst float PI = 3.141592653589793;\nconst float PI_2 = 3.141592653589793;\nuniform vec2 direction;\nfloat aspect = 1.;\nvec4 iMouse = vec4(\n screenSize.x * (mod((1.0 + time * direction.x), 1.0) + 0.2 * sign(direction.x)),\n screenSize.y * (mod((1.0 + time * direction.y), 1.0) + 0.2 * sign(direction.y)),\n screenSize.x * (1.0 - step(0.0, direction.x)),\n screenSize.y * (1.0 - step(0.0, direction.y))\n);\nvec2 mouse = iMouse.xy * vec2(aspect, 1.) / screenSize.xy;\nvec2 mouseDir = normalize(abs(iMouse.zw) - iMouse.xy);\nvec4 transition(vec2 uv) {\n float dist = dot(uv - mouse, mouseDir);\n vec2 linePoint = uv - dist * mouseDir;\n vec4 fragColor = vec4(1.0);\n if (dist > .1) {\n fragColor = texture2D(texture2, uv);\n }\n else if (dist >= 0.) {\n float theta = asin(dist / .1);\n vec2 p2 = linePoint + mouseDir * (PI - theta) * .1;\n vec2 p1 = linePoint + mouseDir * theta * .1;\n uv = (p2.x <= aspect && p2.y <= 1. && p2.x > 0. && p2.y > 0.) ? p2 : p1;\n fragColor = texture2D(texture, uv);\n fragColor.rgb *= pow(clamp((.1 - dist) / .1, 0., 1.), .2);\n }\n else {\n vec2 p = linePoint + mouseDir * (abs(dist) + PI * .1);\n uv = (p.x <= aspect && p.y <= 1. && p.x > 0. && p.y > 0.) ? p : uv;\n fragColor = texture2D(texture, uv);\n }\n return fragColor;\n}\nvoid main () {\n gl_FragColor = v_color * transition(v_uv0);\n}" + }, + "glsl3": { + "vert": "\nprecision highp float;\nuniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_nativeSize;\n highp mat4 cc_matView;\n mediump mat4 cc_matViewInv;\n mediump mat4 cc_matProj;\n mediump mat4 cc_matProjInv;\n mediump mat4 cc_matViewProj;\n mediump mat4 cc_matViewProjInv;\n mediump vec4 cc_cameraPos;\n};\nuniform CCLocal {\n mat4 cc_matWorld;\n mat4 cc_matWorldIT;\n};\nin vec3 a_position;\nin lowp vec4 a_color;\nin mediump vec2 a_uv0;\nout mediump vec2 v_uv0;\nout lowp vec4 v_color;\nuniform Time {\n vec2 screenSize;\n float time;\n};\nvoid main() {\n mat4 mvp;\n mvp = cc_matViewProj;\n v_uv0 = a_uv0;\n v_color = a_color;\n gl_Position = mvp * vec4(a_position, 1);\n}", + "frag": "\nprecision highp float;\nuniform sampler2D texture;\nuniform sampler2D texture2;\nin mediump vec2 v_uv0;\nuniform Time {\n vec2 screenSize;\n float time;\n};\nin lowp vec4 v_color;\nconst float PI = 3.141592653589793;\nconst float PI_2 = 3.141592653589793;\nuniform Transition {\n vec2 direction;\n};\nfloat aspect = 1.;\nvec4 iMouse = vec4(\n screenSize.x * (mod((1.0 + time * direction.x), 1.0) + 0.2 * sign(direction.x)),\n screenSize.y * (mod((1.0 + time * direction.y), 1.0) + 0.2 * sign(direction.y)),\n screenSize.x * (1.0 - step(0.0, direction.x)),\n screenSize.y * (1.0 - step(0.0, direction.y))\n);\nvec2 mouse = iMouse.xy * vec2(aspect, 1.) / screenSize.xy;\nvec2 mouseDir = normalize(abs(iMouse.zw) - iMouse.xy);\nvec4 transition(vec2 uv) {\n float dist = dot(uv - mouse, mouseDir);\n vec2 linePoint = uv - dist * mouseDir;\n vec4 fragColor = vec4(1.0);\n if (dist > .1) {\n fragColor = texture(texture2, uv);\n }\n else if (dist >= 0.) {\n float theta = asin(dist / .1);\n vec2 p2 = linePoint + mouseDir * (PI - theta) * .1;\n vec2 p1 = linePoint + mouseDir * theta * .1;\n uv = (p2.x <= aspect && p2.y <= 1. && p2.x > 0. && p2.y > 0.) ? p2 : p1;\n fragColor = texture(texture, uv);\n fragColor.rgb *= pow(clamp((.1 - dist) / .1, 0., 1.), .2);\n }\n else {\n vec2 p = linePoint + mouseDir * (abs(dist) + PI * .1);\n uv = (p.x <= aspect && p.y <= 1. && p.x > 0. && p.y > 0.) ? p : uv;\n fragColor = texture(texture, uv);\n }\n return fragColor;\n}\nvoid main () {\n gl_FragColor = v_color * transition(v_uv0);\n}" + } + } + ], + "subMetas": {} +} \ No newline at end of file diff --git a/assets/Scene/SwitchScene__Strip/SwitchScene__Strip.fire b/assets/Scene/SwitchScene__Strip/SwitchScene__Strip.fire new file mode 100644 index 0000000..7b98e31 --- /dev/null +++ b/assets/Scene/SwitchScene__Strip/SwitchScene__Strip.fire @@ -0,0 +1,740 @@ +[ + { + "__type__": "cc.SceneAsset", + "_name": "", + "_objFlags": 0, + "_native": "", + "scene": { + "__id__": 1 + } + }, + { + "__type__": "cc.Scene", + "_objFlags": 0, + "_parent": null, + "_children": [ + { + "__id__": 2 + }, + { + "__id__": 11 + }, + { + "__id__": 13 + }, + { + "__id__": 8 + } + ], + "_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": "17ca8f16-26d6-4862-90da-cb338d55f704" + }, + { + "__type__": "cc.Node", + "_name": "Canvas", + "_objFlags": 512, + "_parent": { + "__id__": 1 + }, + "_children": [ + { + "__id__": 3 + } + ], + "_active": true, + "_components": [ + { + "__id__": 5 + }, + { + "__id__": 6 + }, + { + "__id__": 7 + } + ], + "_prefab": null, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 1334, + "height": 750 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + 667, + 375, + 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": "a5esZu+45LA5mBpvttspPD" + }, + { + "__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": 960, + "height": 640 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + 0, + 0, + 452.93128617926146, + 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": "e1WoFrQ79G7r4ZuQE3HlNb" + }, + { + "__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": "81GN3uXINKVLeW4+iKSlim" + }, + { + "__type__": "cc.Canvas", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 2 + }, + "_enabled": true, + "_designResolution": { + "__type__": "cc.Size", + "width": 1334, + "height": 750 + }, + "_fitWidth": false, + "_fitHeight": true, + "_id": "59Cd0ovbdF4byw5sbjJDx7" + }, + { + "__type__": "cc.Widget", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 2 + }, + "_enabled": true, + "alignMode": 1, + "_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": 0, + "_originalHeight": 0, + "_id": "29zXboiXFBKoIV4PQ2liTe" + }, + { + "__type__": "22c8cP1MQNB7Ka1h8g/gS0z", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 2 + }, + "_enabled": true, + "separator": { + "__id__": 8 + }, + "spriteFrame1": { + "__uuid__": "fadd364e-5cc6-4fe1-a458-93dc172c36af" + }, + "spriteFrame2": { + "__uuid__": "24e8b90f-3d1d-4078-90fa-567b5d3a78a8" + }, + "bgSprite": { + "__id__": 10 + }, + "material": { + "__uuid__": "ee73e8c0-5ff0-486a-bcdf-dec85b04755b" + }, + "_id": "02KUZjxDBPoIDETyoLgMk8" + }, + { + "__type__": "cc.Node", + "_name": "Separator", + "_objFlags": 0, + "_parent": { + "__id__": 1 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 9 + } + ], + "_prefab": null, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 171, + "b": 23, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 10, + "height": 750 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + 333, + 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": "00zwOFnw9A9Y2jJcAfpxGt" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 8 + }, + "_enabled": true, + "_materials": [ + { + "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432" + } + ], + "_srcBlendFactor": 770, + "_dstBlendFactor": 771, + "_spriteFrame": { + "__uuid__": "5c3bb932-6c3c-468f-88a9-c8c61d458641" + }, + "_type": 0, + "_sizeMode": 0, + "_fillType": 0, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": true, + "_atlas": null, + "_id": "bfovdQprtLZrbQA9328iTr" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 11 + }, + "_enabled": true, + "_materials": [ + { + "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432" + } + ], + "_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": "b70P96s8FD1LitaZ7aobMA" + }, + { + "__type__": "cc.Node", + "_name": "Bg", + "_objFlags": 0, + "_parent": { + "__id__": 1 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 10 + }, + { + "__id__": 12 + } + ], + "_prefab": null, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 1334, + "height": 750 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + 667, + 375, + 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": "34YKVYdF5MoYlFN+Zfb6wk" + }, + { + "__type__": "cc.Widget", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 11 + }, + "_enabled": true, + "alignMode": 1, + "_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": 1024, + "_originalHeight": 445, + "_id": "711M5JfuBPs5F7P5bDVb/1" + }, + { + "__type__": "cc.Node", + "_name": "Btn", + "_objFlags": 0, + "_parent": { + "__id__": 1 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 14 + }, + { + "__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": 1477, + "height": 118 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + 667, + 528.7, + 0, + 0, + 0, + 0, + 1, + 0.7, + 0.7, + 1 + ] + }, + "_eulerAngles": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_skewX": 0, + "_skewY": 0, + "_is3DNode": false, + "_groupIndex": 0, + "groupIndex": 0, + "_id": "bcVNNAEfFEJL7tftaCUB7n" + }, + { + "__type__": "cc.Button", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 13 + }, + "_enabled": true, + "_normalMaterial": null, + "_grayMaterial": null, + "duration": 0.1, + "zoomScale": 1.2, + "clickEvents": [ + { + "__id__": 15 + } + ], + "_N$interactable": true, + "_N$enableAutoGrayEffect": false, + "_N$transition": 0, + "transition": 0, + "_N$normalColor": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_N$pressedColor": { + "__type__": "cc.Color", + "r": 211, + "g": 211, + "b": 211, + "a": 255 + }, + "pressedColor": { + "__type__": "cc.Color", + "r": 211, + "g": 211, + "b": 211, + "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": 124, + "g": 124, + "b": 124, + "a": 255 + }, + "_N$normalSprite": null, + "_N$pressedSprite": null, + "pressedSprite": null, + "_N$hoverSprite": null, + "hoverSprite": null, + "_N$disabledSprite": null, + "_N$target": { + "__id__": 13 + }, + "_id": "fdJg28i7pE6pi4D1ovRRp0" + }, + { + "__type__": "cc.ClickEvent", + "target": { + "__id__": 2 + }, + "component": "", + "_componentId": "22c8cP1MQNB7Ka1h8g/gS0z", + "handler": "switchSceneByTransition", + "customEventData": "6" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 13 + }, + "_enabled": true, + "_materials": [ + { + "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432" + } + ], + "_srcBlendFactor": 770, + "_dstBlendFactor": 771, + "_spriteFrame": { + "__uuid__": "86714285-13db-44f6-86aa-11838e0d4831" + }, + "_type": 0, + "_sizeMode": 1, + "_fillType": 0, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": true, + "_atlas": null, + "_id": "c1sR5klVZHraEr68/UTkLE" + }, + { + "__type__": "cc.Widget", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 13 + }, + "_enabled": true, + "alignMode": 1, + "_target": null, + "_alignFlags": 17, + "_left": 0, + "_right": 0, + "_top": 180, + "_bottom": 0, + "_verticalCenter": 157.942, + "_horizontalCenter": 0, + "_isAbsLeft": true, + "_isAbsRight": true, + "_isAbsTop": true, + "_isAbsBottom": true, + "_isAbsHorizontalCenter": true, + "_isAbsVerticalCenter": true, + "_originalWidth": 0, + "_originalHeight": 0, + "_id": "a6rm0uXY9DlbNNnoWq9hN0" + } +] \ No newline at end of file diff --git a/assets/Scene/SwitchScene__Strip/SwitchScene__Strip.fire.meta b/assets/Scene/SwitchScene__Strip/SwitchScene__Strip.fire.meta new file mode 100644 index 0000000..0ec31b8 --- /dev/null +++ b/assets/Scene/SwitchScene__Strip/SwitchScene__Strip.fire.meta @@ -0,0 +1,7 @@ +{ + "ver": "1.2.6", + "uuid": "17ca8f16-26d6-4862-90da-cb338d55f704", + "asyncLoadAssets": false, + "autoReleaseAssets": false, + "subMetas": {} +} \ No newline at end of file diff --git a/assets/Scene/SwitchScene__Strip/SwitchScene__Strip.ts b/assets/Scene/SwitchScene__Strip/SwitchScene__Strip.ts new file mode 100644 index 0000000..db07a59 --- /dev/null +++ b/assets/Scene/SwitchScene__Strip/SwitchScene__Strip.ts @@ -0,0 +1,89 @@ +const { ccclass, property } = cc._decorator; + +@ccclass +export default class SwitchScene extends cc.Component { + @property(cc.Node) separator = null; + + @property(cc.SpriteFrame) spriteFrame1 = null; + @property(cc.SpriteFrame) spriteFrame2 = null; + @property(cc.Sprite) bgSprite = null; + @property(cc.Material) material = null; + private _spriteMaterial: cc.Material; + + touchStartPos = cc.Vec2.ZERO; + separatorStartPos = cc.Vec2.ZERO; + + start() { + this.bgSprite.spriteFrame.setTexture(this.spriteFrame1._texture); + this.initSpriteMaterial(); + this.playTransitionAnimation(); + } + + onLoad() { + this.separatorStartPos = this.separator.getPosition(); + this.node.on(cc.Node.EventType.TOUCH_START, this.onTouchStart, this); + this.node.on(cc.Node.EventType.TOUCH_MOVE, this.onTouchMove, this); + } + + switchSceneByTransition(event, value) { + cc.director.emit('setBackBtnVisibility', false); + cc.director.emit('switchSceneByTransition', value); + } + + playTransitionAnimation() { + let progress = 0; + let targetProgress = cc.winSize.width; + let totalTime = 3; + let startTime = Date.now(); + + const loop = () => { + if (!this._spriteMaterial || !this.touchStartPos) return; + if (!this.touchStartPos.equals(cc.Vec2.ZERO)) return; + + let currentTime = Date.now(); + let elapsedTime = (currentTime - startTime) / 1000; + let _progress = (elapsedTime / totalTime) * targetProgress; + progress = Math.min(_progress, targetProgress); + + this._spriteMaterial.setProperty('time', progress / cc.winSize.width); + this.separator.setPosition({ x: progress, y: 0 }); + + if (progress < targetProgress) { + requestAnimationFrame(loop.bind(this)); + } + }; + loop(); + } + + onTouchStart(event) { + this.separatorStartPos = this.separator.getPosition(); + this.touchStartPos = this.node.convertToNodeSpaceAR(event.getLocation()); + } + + private onTouchMove(event) { + // 获取当前触摸点的位置 + let touchPos = this.node.convertToNodeSpaceAR(event.getLocation()); + // 计算触摸点相对于起始位置的偏移量 + let offset = touchPos.sub(this.touchStartPos); + let targetPos = this.separatorStartPos.add(offset); + let targetX = Math.max(0, Math.min(targetPos.x, cc.winSize.width)); + this.separator.setPosition({ + x: targetX, + y: 0 + }); + this._spriteMaterial.setProperty('time', targetX / cc.winSize.width); + } + + initSpriteMaterial() { + let newMaterial = cc.MaterialVariant.create(this.material, this.bgSprite); + newMaterial.setProperty('texture', this.spriteFrame1._texture); + newMaterial.setProperty('texture2', this.spriteFrame2._texture); + newMaterial.setProperty('screenSize', new Float32Array([cc.winSize.width, cc.winSize.height])); + newMaterial.setProperty('time', 0.25); + + this.spriteFrame1._texture.setFlipY(true); + this.spriteFrame2._texture.setFlipY(true); + this.bgSprite.setMaterial(0, newMaterial); + this._spriteMaterial = newMaterial; + } +} diff --git a/assets/Scene/SwitchScene__Strip/SwitchScene__Strip.ts.meta b/assets/Scene/SwitchScene__Strip/SwitchScene__Strip.ts.meta new file mode 100644 index 0000000..96a8a8c --- /dev/null +++ b/assets/Scene/SwitchScene__Strip/SwitchScene__Strip.ts.meta @@ -0,0 +1,9 @@ +{ + "ver": "1.0.5", + "uuid": "22c8c3f5-3103-41ec-a6b5-87c83f812d33", + "isPlugin": false, + "loadPluginInWeb": true, + "loadPluginInNative": true, + "loadPluginInEditor": false, + "subMetas": {} +} \ No newline at end of file diff --git a/assets/Scene/SwitchScene__Strip/Texture.meta b/assets/Scene/SwitchScene__Strip/Texture.meta new file mode 100644 index 0000000..8956feb --- /dev/null +++ b/assets/Scene/SwitchScene__Strip/Texture.meta @@ -0,0 +1,7 @@ +{ + "ver": "1.0.1", + "uuid": "d13769a9-caa5-4374-8f1b-926afb820254", + "isSubpackage": false, + "subpackageName": "", + "subMetas": {} +} \ No newline at end of file diff --git a/assets/Scene/SwitchScene__Strip/Texture/bg1.jpeg b/assets/Scene/SwitchScene__Strip/Texture/bg1.jpeg new file mode 100644 index 0000000..f905b16 Binary files /dev/null and b/assets/Scene/SwitchScene__Strip/Texture/bg1.jpeg differ diff --git a/assets/Scene/SwitchScene__Strip/Texture/bg1.jpeg.meta b/assets/Scene/SwitchScene__Strip/Texture/bg1.jpeg.meta new file mode 100644 index 0000000..902b9fa --- /dev/null +++ b/assets/Scene/SwitchScene__Strip/Texture/bg1.jpeg.meta @@ -0,0 +1,36 @@ +{ + "ver": "2.3.4", + "uuid": "9038deed-cca8-46ff-9027-551eddadd35c", + "type": "sprite", + "wrapMode": "clamp", + "filterMode": "bilinear", + "premultiplyAlpha": false, + "genMipmaps": false, + "packable": true, + "width": 1600, + "height": 1200, + "platformSettings": {}, + "subMetas": { + "bg1": { + "ver": "1.0.4", + "uuid": "fadd364e-5cc6-4fe1-a458-93dc172c36af", + "rawTextureUuid": "9038deed-cca8-46ff-9027-551eddadd35c", + "trimType": "auto", + "trimThreshold": 1, + "rotated": false, + "offsetX": 0, + "offsetY": 0, + "trimX": 0, + "trimY": 0, + "width": 1600, + "height": 1200, + "rawWidth": 1600, + "rawHeight": 1200, + "borderTop": 0, + "borderBottom": 0, + "borderLeft": 0, + "borderRight": 0, + "subMetas": {} + } + } +} \ No newline at end of file diff --git a/assets/Scene/SwitchScene__Strip/Texture/bg2.jpeg b/assets/Scene/SwitchScene__Strip/Texture/bg2.jpeg new file mode 100644 index 0000000..a5a3c9c Binary files /dev/null and b/assets/Scene/SwitchScene__Strip/Texture/bg2.jpeg differ diff --git a/assets/Scene/SwitchScene__Strip/Texture/bg2.jpeg.meta b/assets/Scene/SwitchScene__Strip/Texture/bg2.jpeg.meta new file mode 100644 index 0000000..d81dd46 --- /dev/null +++ b/assets/Scene/SwitchScene__Strip/Texture/bg2.jpeg.meta @@ -0,0 +1,36 @@ +{ + "ver": "2.3.4", + "uuid": "c3bc747f-2cef-4c27-911d-37cb1f4ca5f2", + "type": "sprite", + "wrapMode": "clamp", + "filterMode": "bilinear", + "premultiplyAlpha": false, + "genMipmaps": false, + "packable": true, + "width": 1600, + "height": 1200, + "platformSettings": {}, + "subMetas": { + "bg2": { + "ver": "1.0.4", + "uuid": "24e8b90f-3d1d-4078-90fa-567b5d3a78a8", + "rawTextureUuid": "c3bc747f-2cef-4c27-911d-37cb1f4ca5f2", + "trimType": "auto", + "trimThreshold": 1, + "rotated": false, + "offsetX": 0, + "offsetY": 0, + "trimX": 0, + "trimY": 0, + "width": 1600, + "height": 1200, + "rawWidth": 1600, + "rawHeight": 1200, + "borderTop": 0, + "borderBottom": 0, + "borderLeft": 0, + "borderRight": 0, + "subMetas": {} + } + } +} \ No newline at end of file diff --git a/assets/Scene/SwitchScene__Strip/Texture/btn.png b/assets/Scene/SwitchScene__Strip/Texture/btn.png new file mode 100644 index 0000000..bc4283d Binary files /dev/null and b/assets/Scene/SwitchScene__Strip/Texture/btn.png differ diff --git a/assets/Scene/SwitchScene__Strip/Texture/btn.png.meta b/assets/Scene/SwitchScene__Strip/Texture/btn.png.meta new file mode 100644 index 0000000..d668abb --- /dev/null +++ b/assets/Scene/SwitchScene__Strip/Texture/btn.png.meta @@ -0,0 +1,36 @@ +{ + "ver": "2.3.4", + "uuid": "a73c17f0-79b7-4480-a172-508c49264fd8", + "type": "sprite", + "wrapMode": "clamp", + "filterMode": "bilinear", + "premultiplyAlpha": false, + "genMipmaps": false, + "packable": true, + "width": 1477, + "height": 118, + "platformSettings": {}, + "subMetas": { + "btn": { + "ver": "1.0.4", + "uuid": "8068bba9-2f44-4980-911c-2dd9bae35a9c", + "rawTextureUuid": "a73c17f0-79b7-4480-a172-508c49264fd8", + "trimType": "auto", + "trimThreshold": 1, + "rotated": false, + "offsetX": 0, + "offsetY": 0, + "trimX": 0, + "trimY": 0, + "width": 1477, + "height": 118, + "rawWidth": 1477, + "rawHeight": 118, + "borderTop": 0, + "borderBottom": 0, + "borderLeft": 0, + "borderRight": 0, + "subMetas": {} + } + } +} \ No newline at end of file diff --git a/assets/Scene/SwitchScene__Wind.meta b/assets/Scene/SwitchScene__Wind.meta new file mode 100644 index 0000000..f5416e6 --- /dev/null +++ b/assets/Scene/SwitchScene__Wind.meta @@ -0,0 +1,7 @@ +{ + "ver": "1.0.1", + "uuid": "12ffe48c-f5b1-4350-ba96-13aa53a90d2a", + "isSubpackage": false, + "subpackageName": "", + "subMetas": {} +} \ No newline at end of file diff --git a/assets/Scene/SwitchScene__Wind/Materials.meta b/assets/Scene/SwitchScene__Wind/Materials.meta new file mode 100644 index 0000000..5eff0d8 --- /dev/null +++ b/assets/Scene/SwitchScene__Wind/Materials.meta @@ -0,0 +1,7 @@ +{ + "ver": "1.0.1", + "uuid": "941c0802-e4a9-4b52-b99d-47a34d17e6b7", + "isSubpackage": false, + "subpackageName": "", + "subMetas": {} +} \ No newline at end of file diff --git a/assets/Scene/SwitchScene__Wind/Materials/Wind.effect b/assets/Scene/SwitchScene__Wind/Materials/Wind.effect new file mode 100644 index 0000000..c9bc320 --- /dev/null +++ b/assets/Scene/SwitchScene__Wind/Materials/Wind.effect @@ -0,0 +1,87 @@ +// 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 } + windWidth: {value: 0.2} + time: {value: 0} +}% + +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; + uniform sampler2D texture; + uniform sampler2D texture2; + uniform Common { + float windWidth; + float time; + }; + float progress = time; + in mediump vec2 v_uv0; + in vec4 v_color; + + vec4 getFromColor(vec2 uv) { + return texture(texture, uv); + } + vec4 getToColor(vec2 uv) { + return texture(texture2, uv); + } + float rand(vec2 co){ + return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453); + } + vec4 transition (vec2 uv) { + float r = rand(vec2(0, uv.y)); + float m = smoothstep(0.0, -windWidth, uv.x*(1.0-windWidth) + windWidth*r - (progress * (1.0 + windWidth))); + return mix( + getFromColor(uv), + getToColor(uv), + m + ); + } + + void main () { + gl_FragColor = v_color * transition(v_uv0); + } +}% diff --git a/assets/Scene/SwitchScene__Wind/Materials/Wind.effect.meta b/assets/Scene/SwitchScene__Wind/Materials/Wind.effect.meta new file mode 100644 index 0000000..f8938f8 --- /dev/null +++ b/assets/Scene/SwitchScene__Wind/Materials/Wind.effect.meta @@ -0,0 +1,17 @@ +{ + "ver": "1.0.25", + "uuid": "ab0d97f6-021e-4b1c-8210-a9c2e10155f7", + "compiledShaders": [ + { + "glsl1": { + "vert": "\nprecision highp float;\nuniform mediump mat4 cc_matViewProj;\nuniform mat4 cc_matWorld;\nattribute vec3 a_position;\nattribute vec4 a_color;\nvarying vec4 v_color;\n#if USE_TEXTURE\nattribute vec2 a_uv0;\nvarying vec2 v_uv0;\n#endif\nvoid main () {\n vec4 pos = vec4(a_position, 1);\n #if CC_USE_MODEL\n pos = cc_matViewProj * cc_matWorld * pos;\n #else\n pos = cc_matViewProj * pos;\n #endif\n #if USE_TEXTURE\n v_uv0 = a_uv0;\n #endif\n v_color = a_color;\n gl_Position = pos;\n}", + "frag": "\nprecision highp float;\nuniform sampler2D texture;\nuniform sampler2D texture2;\nuniform float windWidth;\nuniform float time;\nfloat progress = time;\nvarying mediump vec2 v_uv0;\nvarying vec4 v_color;\nvec4 getFromColor(vec2 uv) {\n return texture2D(texture, uv);\n}\nvec4 getToColor(vec2 uv) {\n return texture2D(texture2, uv);\n}\nfloat rand(vec2 co){\n return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);\n}\nvec4 transition (vec2 uv) {\n float r = rand(vec2(0, uv.y));\n float m = smoothstep(0.0, -windWidth, uv.x*(1.0-windWidth) + windWidth*r - (progress * (1.0 + windWidth)));\n return mix(\n getFromColor(uv),\n getToColor(uv),\n m\n );\n}\nvoid main () {\n gl_FragColor = v_color * transition(v_uv0);\n}" + }, + "glsl3": { + "vert": "\nprecision highp float;\nuniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_nativeSize;\n highp mat4 cc_matView;\n mediump mat4 cc_matViewInv;\n mediump mat4 cc_matProj;\n mediump mat4 cc_matProjInv;\n mediump mat4 cc_matViewProj;\n mediump mat4 cc_matViewProjInv;\n mediump vec4 cc_cameraPos;\n};\nuniform CCLocal {\n mat4 cc_matWorld;\n mat4 cc_matWorldIT;\n};\nin vec3 a_position;\nin vec4 a_color;\nout vec4 v_color;\n#if USE_TEXTURE\nin vec2 a_uv0;\nout vec2 v_uv0;\n#endif\nvoid main () {\n vec4 pos = vec4(a_position, 1);\n #if CC_USE_MODEL\n pos = cc_matViewProj * cc_matWorld * pos;\n #else\n pos = cc_matViewProj * pos;\n #endif\n #if USE_TEXTURE\n v_uv0 = a_uv0;\n #endif\n v_color = a_color;\n gl_Position = pos;\n}", + "frag": "\nprecision highp float;\nuniform sampler2D texture;\nuniform sampler2D texture2;\nuniform Common {\n float windWidth;\n float time;\n};\nfloat progress = time;\nin mediump vec2 v_uv0;\nin vec4 v_color;\nvec4 getFromColor(vec2 uv) {\n return texture(texture, uv);\n}\nvec4 getToColor(vec2 uv) {\n return texture(texture2, uv);\n}\nfloat rand(vec2 co){\n return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);\n}\nvec4 transition (vec2 uv) {\n float r = rand(vec2(0, uv.y));\n float m = smoothstep(0.0, -windWidth, uv.x*(1.0-windWidth) + windWidth*r - (progress * (1.0 + windWidth)));\n return mix(\n getFromColor(uv),\n getToColor(uv),\n m\n );\n}\nvoid main () {\n gl_FragColor = v_color * transition(v_uv0);\n}" + } + } + ], + "subMetas": {} +} \ No newline at end of file diff --git a/assets/Scene/SwitchScene__Wind/Materials/Wind.mtl b/assets/Scene/SwitchScene__Wind/Materials/Wind.mtl new file mode 100644 index 0000000..b0fe3f6 --- /dev/null +++ b/assets/Scene/SwitchScene__Wind/Materials/Wind.mtl @@ -0,0 +1,17 @@ +{ + "__type__": "cc.Material", + "_name": "Wind", + "_objFlags": 0, + "_native": "", + "_effectAsset": { + "__uuid__": "ab0d97f6-021e-4b1c-8210-a9c2e10155f7" + }, + "_techniqueIndex": 0, + "_techniqueData": { + "0": { + "defines": { + "USE_TEXTURE": true + } + } + } +} \ No newline at end of file diff --git a/assets/Scene/SwitchScene__Wind/Materials/Wind.mtl.meta b/assets/Scene/SwitchScene__Wind/Materials/Wind.mtl.meta new file mode 100644 index 0000000..e55bb12 --- /dev/null +++ b/assets/Scene/SwitchScene__Wind/Materials/Wind.mtl.meta @@ -0,0 +1,6 @@ +{ + "ver": "1.0.3", + "uuid": "6dd2566a-a5ef-48ff-a3a2-521163be1e1e", + "dataAsSubAsset": null, + "subMetas": {} +} \ No newline at end of file diff --git a/assets/Scene/SwitchScene__Wind/SwitchScene__Wind.fire b/assets/Scene/SwitchScene__Wind/SwitchScene__Wind.fire new file mode 100644 index 0000000..440a340 --- /dev/null +++ b/assets/Scene/SwitchScene__Wind/SwitchScene__Wind.fire @@ -0,0 +1,740 @@ +[ + { + "__type__": "cc.SceneAsset", + "_name": "", + "_objFlags": 0, + "_native": "", + "scene": { + "__id__": 1 + } + }, + { + "__type__": "cc.Scene", + "_objFlags": 0, + "_parent": null, + "_children": [ + { + "__id__": 2 + }, + { + "__id__": 11 + }, + { + "__id__": 13 + }, + { + "__id__": 8 + } + ], + "_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": "2231c097-653a-4a47-bebb-d391d9a0651b" + }, + { + "__type__": "cc.Node", + "_name": "Canvas", + "_objFlags": 0, + "_parent": { + "__id__": 1 + }, + "_children": [ + { + "__id__": 3 + } + ], + "_active": true, + "_components": [ + { + "__id__": 5 + }, + { + "__id__": 6 + }, + { + "__id__": 7 + } + ], + "_prefab": null, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 1334, + "height": 750 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + 667, + 375, + 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": "a5esZu+45LA5mBpvttspPD" + }, + { + "__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": 960, + "height": 640 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + 0, + 0, + 452.93128617926146, + 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": "e1WoFrQ79G7r4ZuQE3HlNb" + }, + { + "__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": "81GN3uXINKVLeW4+iKSlim" + }, + { + "__type__": "cc.Canvas", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 2 + }, + "_enabled": true, + "_designResolution": { + "__type__": "cc.Size", + "width": 1334, + "height": 750 + }, + "_fitWidth": false, + "_fitHeight": true, + "_id": "59Cd0ovbdF4byw5sbjJDx7" + }, + { + "__type__": "cc.Widget", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 2 + }, + "_enabled": true, + "alignMode": 1, + "_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": 0, + "_originalHeight": 0, + "_id": "29zXboiXFBKoIV4PQ2liTe" + }, + { + "__type__": "7e532YYQaNAB4q8myln4veS", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 2 + }, + "_enabled": true, + "separator": { + "__id__": 8 + }, + "spriteFrame1": { + "__uuid__": "6b5b98b4-55cb-4aae-a6aa-58b7edc91500" + }, + "spriteFrame2": { + "__uuid__": "2bd4baf2-cc8f-4a82-b8bf-c619a9a8d6d1" + }, + "bgSprite": { + "__id__": 10 + }, + "material": { + "__uuid__": "6dd2566a-a5ef-48ff-a3a2-521163be1e1e" + }, + "_id": "1fopLHdTZJJqDTnzGpZJgU" + }, + { + "__type__": "cc.Node", + "_name": "Separator", + "_objFlags": 0, + "_parent": { + "__id__": 1 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 9 + } + ], + "_prefab": null, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 171, + "b": 23, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 10, + "height": 750 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + 333, + 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": "00zwOFnw9A9Y2jJcAfpxGt" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 8 + }, + "_enabled": true, + "_materials": [ + { + "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432" + } + ], + "_srcBlendFactor": 770, + "_dstBlendFactor": 771, + "_spriteFrame": { + "__uuid__": "5c3bb932-6c3c-468f-88a9-c8c61d458641" + }, + "_type": 0, + "_sizeMode": 0, + "_fillType": 0, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": true, + "_atlas": null, + "_id": "bfovdQprtLZrbQA9328iTr" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 11 + }, + "_enabled": true, + "_materials": [ + { + "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432" + } + ], + "_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": "b70P96s8FD1LitaZ7aobMA" + }, + { + "__type__": "cc.Node", + "_name": "Bg", + "_objFlags": 0, + "_parent": { + "__id__": 1 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 10 + }, + { + "__id__": 12 + } + ], + "_prefab": null, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 1334, + "height": 750 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + 667, + 375, + 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": "34YKVYdF5MoYlFN+Zfb6wk" + }, + { + "__type__": "cc.Widget", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 11 + }, + "_enabled": true, + "alignMode": 1, + "_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": 1024, + "_originalHeight": 445, + "_id": "711M5JfuBPs5F7P5bDVb/1" + }, + { + "__type__": "cc.Node", + "_name": "Btn", + "_objFlags": 0, + "_parent": { + "__id__": 1 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 14 + }, + { + "__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": 1477, + "height": 118 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + 667, + 528.7, + 0, + 0, + 0, + 0, + 1, + 0.7, + 0.7, + 1 + ] + }, + "_eulerAngles": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_skewX": 0, + "_skewY": 0, + "_is3DNode": false, + "_groupIndex": 0, + "groupIndex": 0, + "_id": "bcVNNAEfFEJL7tftaCUB7n" + }, + { + "__type__": "cc.Button", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 13 + }, + "_enabled": true, + "_normalMaterial": null, + "_grayMaterial": null, + "duration": 0.1, + "zoomScale": 1.2, + "clickEvents": [ + { + "__id__": 15 + } + ], + "_N$interactable": true, + "_N$enableAutoGrayEffect": false, + "_N$transition": 0, + "transition": 0, + "_N$normalColor": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_N$pressedColor": { + "__type__": "cc.Color", + "r": 211, + "g": 211, + "b": 211, + "a": 255 + }, + "pressedColor": { + "__type__": "cc.Color", + "r": 211, + "g": 211, + "b": 211, + "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": 124, + "g": 124, + "b": 124, + "a": 255 + }, + "_N$normalSprite": null, + "_N$pressedSprite": null, + "pressedSprite": null, + "_N$hoverSprite": null, + "hoverSprite": null, + "_N$disabledSprite": null, + "_N$target": { + "__id__": 13 + }, + "_id": "fdJg28i7pE6pi4D1ovRRp0" + }, + { + "__type__": "cc.ClickEvent", + "target": { + "__id__": 2 + }, + "component": "", + "_componentId": "7e532YYQaNAB4q8myln4veS", + "handler": "switchSceneByTransition", + "customEventData": "7" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 13 + }, + "_enabled": true, + "_materials": [ + { + "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432" + } + ], + "_srcBlendFactor": 770, + "_dstBlendFactor": 771, + "_spriteFrame": { + "__uuid__": "86714285-13db-44f6-86aa-11838e0d4831" + }, + "_type": 0, + "_sizeMode": 1, + "_fillType": 0, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": true, + "_atlas": null, + "_id": "c1sR5klVZHraEr68/UTkLE" + }, + { + "__type__": "cc.Widget", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 13 + }, + "_enabled": true, + "alignMode": 1, + "_target": null, + "_alignFlags": 17, + "_left": 0, + "_right": 0, + "_top": 180, + "_bottom": 0, + "_verticalCenter": 157.942, + "_horizontalCenter": 0, + "_isAbsLeft": true, + "_isAbsRight": true, + "_isAbsTop": true, + "_isAbsBottom": true, + "_isAbsHorizontalCenter": true, + "_isAbsVerticalCenter": true, + "_originalWidth": 0, + "_originalHeight": 0, + "_id": "a6rm0uXY9DlbNNnoWq9hN0" + } +] \ No newline at end of file diff --git a/assets/Scene/SwitchScene__Wind/SwitchScene__Wind.fire.meta b/assets/Scene/SwitchScene__Wind/SwitchScene__Wind.fire.meta new file mode 100644 index 0000000..0fcddd1 --- /dev/null +++ b/assets/Scene/SwitchScene__Wind/SwitchScene__Wind.fire.meta @@ -0,0 +1,7 @@ +{ + "ver": "1.2.6", + "uuid": "2231c097-653a-4a47-bebb-d391d9a0651b", + "asyncLoadAssets": false, + "autoReleaseAssets": false, + "subMetas": {} +} \ No newline at end of file diff --git a/assets/Scene/SwitchScene__Wind/SwitchScene__Wind.ts b/assets/Scene/SwitchScene__Wind/SwitchScene__Wind.ts new file mode 100644 index 0000000..baa8cf3 --- /dev/null +++ b/assets/Scene/SwitchScene__Wind/SwitchScene__Wind.ts @@ -0,0 +1,88 @@ +const { ccclass, property } = cc._decorator; + +@ccclass +export default class SwitchScene extends cc.Component { + @property(cc.Node) separator = null; + + @property(cc.SpriteFrame) spriteFrame1 = null; + @property(cc.SpriteFrame) spriteFrame2 = null; + @property(cc.Sprite) bgSprite = null; + @property(cc.Material) material = null; + private _spriteMaterial: cc.Material; + + touchStartPos = cc.Vec2.ZERO; + separatorStartPos = cc.Vec2.ZERO; + + start() { + this.bgSprite.spriteFrame.setTexture(this.spriteFrame1._texture); + this.initSpriteMaterial(); + this.playTransitionAnimation(); + } + + onLoad() { + this.separatorStartPos = this.separator.getPosition(); + this.node.on(cc.Node.EventType.TOUCH_START, this.onTouchStart, this); + this.node.on(cc.Node.EventType.TOUCH_MOVE, this.onTouchMove, this); + } + + switchSceneByTransition(event, value) { + cc.director.emit('setBackBtnVisibility', false); + cc.director.emit('switchSceneByTransition', value); + } + + playTransitionAnimation() { + let progress = 0; + let targetProgress = cc.winSize.width; + let totalTime = 3; + let startTime = Date.now(); + + const loop = () => { + if (!this._spriteMaterial || !this.touchStartPos) return; + if (!this.touchStartPos.equals(cc.Vec2.ZERO)) return; + + let currentTime = Date.now(); + let elapsedTime = (currentTime - startTime) / 1000; + let _progress = (elapsedTime / totalTime) * targetProgress; + progress = Math.min(_progress, targetProgress); + + this._spriteMaterial.setProperty('time', progress / cc.winSize.width); + this.separator.setPosition({ x: progress, y: 0 }); + + if (progress < targetProgress) { + requestAnimationFrame(loop.bind(this)); + } + }; + loop(); + } + + onTouchStart(event) { + this.separatorStartPos = this.separator.getPosition(); + this.touchStartPos = this.node.convertToNodeSpaceAR(event.getLocation()); + } + + private onTouchMove(event) { + // 获取当前触摸点的位置 + let touchPos = this.node.convertToNodeSpaceAR(event.getLocation()); + // 计算触摸点相对于起始位置的偏移量 + let offset = touchPos.sub(this.touchStartPos); + let targetPos = this.separatorStartPos.add(offset); + let targetX = Math.max(0, Math.min(targetPos.x, cc.winSize.width)); + this.separator.setPosition({ + x: targetX, + y: 0 + }); + this._spriteMaterial.setProperty('time', targetX / cc.winSize.width); + } + + initSpriteMaterial() { + let newMaterial = cc.MaterialVariant.create(this.material, this.bgSprite); + newMaterial.setProperty('texture', this.spriteFrame1._texture); + newMaterial.setProperty('texture2', this.spriteFrame2._texture); + newMaterial.setProperty('time', 0.25); + + this.spriteFrame1._texture.setFlipY(true); + this.spriteFrame2._texture.setFlipY(true); + this.bgSprite.setMaterial(0, newMaterial); + this._spriteMaterial = newMaterial; + } +} diff --git a/assets/Scene/SwitchScene__Wind/SwitchScene__Wind.ts.meta b/assets/Scene/SwitchScene__Wind/SwitchScene__Wind.ts.meta new file mode 100644 index 0000000..c8c3664 --- /dev/null +++ b/assets/Scene/SwitchScene__Wind/SwitchScene__Wind.ts.meta @@ -0,0 +1,9 @@ +{ + "ver": "1.0.5", + "uuid": "7e532618-41a3-4007-8abc-9b2967e2f792", + "isPlugin": false, + "loadPluginInWeb": true, + "loadPluginInNative": true, + "loadPluginInEditor": false, + "subMetas": {} +} \ No newline at end of file diff --git a/assets/Scene/SwitchScene__Wind/Texture.meta b/assets/Scene/SwitchScene__Wind/Texture.meta new file mode 100644 index 0000000..157582c --- /dev/null +++ b/assets/Scene/SwitchScene__Wind/Texture.meta @@ -0,0 +1,7 @@ +{ + "ver": "1.0.1", + "uuid": "ab418fd4-06d6-4cdc-a99e-17cbc53d3924", + "isSubpackage": false, + "subpackageName": "", + "subMetas": {} +} \ No newline at end of file diff --git a/assets/Scene/SwitchScene__Wind/Texture/bg1.jpeg b/assets/Scene/SwitchScene__Wind/Texture/bg1.jpeg new file mode 100644 index 0000000..f905b16 Binary files /dev/null and b/assets/Scene/SwitchScene__Wind/Texture/bg1.jpeg differ diff --git a/assets/Scene/SwitchScene__Wind/Texture/bg1.jpeg.meta b/assets/Scene/SwitchScene__Wind/Texture/bg1.jpeg.meta new file mode 100644 index 0000000..08fc4eb --- /dev/null +++ b/assets/Scene/SwitchScene__Wind/Texture/bg1.jpeg.meta @@ -0,0 +1,36 @@ +{ + "ver": "2.3.4", + "uuid": "bf3864af-9883-4b6b-86f4-ce52935cc0b9", + "type": "sprite", + "wrapMode": "clamp", + "filterMode": "bilinear", + "premultiplyAlpha": false, + "genMipmaps": false, + "packable": true, + "width": 1600, + "height": 1200, + "platformSettings": {}, + "subMetas": { + "bg1": { + "ver": "1.0.4", + "uuid": "6b5b98b4-55cb-4aae-a6aa-58b7edc91500", + "rawTextureUuid": "bf3864af-9883-4b6b-86f4-ce52935cc0b9", + "trimType": "auto", + "trimThreshold": 1, + "rotated": false, + "offsetX": 0, + "offsetY": 0, + "trimX": 0, + "trimY": 0, + "width": 1600, + "height": 1200, + "rawWidth": 1600, + "rawHeight": 1200, + "borderTop": 0, + "borderBottom": 0, + "borderLeft": 0, + "borderRight": 0, + "subMetas": {} + } + } +} \ No newline at end of file diff --git a/assets/Scene/SwitchScene__Wind/Texture/bg2.jpeg b/assets/Scene/SwitchScene__Wind/Texture/bg2.jpeg new file mode 100644 index 0000000..a5a3c9c Binary files /dev/null and b/assets/Scene/SwitchScene__Wind/Texture/bg2.jpeg differ diff --git a/assets/Scene/SwitchScene__Wind/Texture/bg2.jpeg.meta b/assets/Scene/SwitchScene__Wind/Texture/bg2.jpeg.meta new file mode 100644 index 0000000..0dc9a52 --- /dev/null +++ b/assets/Scene/SwitchScene__Wind/Texture/bg2.jpeg.meta @@ -0,0 +1,36 @@ +{ + "ver": "2.3.4", + "uuid": "7da0567d-59bf-4c28-9df4-cfa55be5d55d", + "type": "sprite", + "wrapMode": "clamp", + "filterMode": "bilinear", + "premultiplyAlpha": false, + "genMipmaps": false, + "packable": true, + "width": 1600, + "height": 1200, + "platformSettings": {}, + "subMetas": { + "bg2": { + "ver": "1.0.4", + "uuid": "2bd4baf2-cc8f-4a82-b8bf-c619a9a8d6d1", + "rawTextureUuid": "7da0567d-59bf-4c28-9df4-cfa55be5d55d", + "trimType": "auto", + "trimThreshold": 1, + "rotated": false, + "offsetX": 0, + "offsetY": 0, + "trimX": 0, + "trimY": 0, + "width": 1600, + "height": 1200, + "rawWidth": 1600, + "rawHeight": 1200, + "borderTop": 0, + "borderBottom": 0, + "borderLeft": 0, + "borderRight": 0, + "subMetas": {} + } + } +} \ No newline at end of file diff --git a/assets/Scene/SwitchScene__Wind/Texture/btn.png b/assets/Scene/SwitchScene__Wind/Texture/btn.png new file mode 100644 index 0000000..bc4283d Binary files /dev/null and b/assets/Scene/SwitchScene__Wind/Texture/btn.png differ diff --git a/assets/Scene/SwitchScene__Wind/Texture/btn.png.meta b/assets/Scene/SwitchScene__Wind/Texture/btn.png.meta new file mode 100644 index 0000000..ce1d60f --- /dev/null +++ b/assets/Scene/SwitchScene__Wind/Texture/btn.png.meta @@ -0,0 +1,36 @@ +{ + "ver": "2.3.4", + "uuid": "ab13cad5-6b65-42e2-89de-aa9e34e4334f", + "type": "sprite", + "wrapMode": "clamp", + "filterMode": "bilinear", + "premultiplyAlpha": false, + "genMipmaps": false, + "packable": true, + "width": 1477, + "height": 118, + "platformSettings": {}, + "subMetas": { + "btn": { + "ver": "1.0.4", + "uuid": "c640e4b5-e09e-4ec6-9298-50b708258393", + "rawTextureUuid": "ab13cad5-6b65-42e2-89de-aa9e34e4334f", + "trimType": "auto", + "trimThreshold": 1, + "rotated": false, + "offsetX": 0, + "offsetY": 0, + "trimX": 0, + "trimY": 0, + "width": 1477, + "height": 118, + "rawWidth": 1477, + "rawHeight": 118, + "borderTop": 0, + "borderBottom": 0, + "borderLeft": 0, + "borderRight": 0, + "subMetas": {} + } + } +} \ No newline at end of file