@shijiu/jsview-vue-samples 2.2.426-test.0 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BakeViewDemo/AnimatePic.vue +1 -1
- package/Basic/components/text/TextDirection.vue +7 -1
- package/BasicFocusControl/components/BaseBlock.vue +65 -18
- package/BreakRender/assets/imageList.json +235 -235
- package/ColorSpace/App.vue +2 -2
- package/CoupletsTest/App.vue +1 -1
- package/CoupletsTest/widget/Banger/Banger.vue +3 -3
- package/CoupletsTest/widget/Banger/MaroonLoader.vue +5 -5
- package/CoupletsTest/widget/Couplets/Couplets.vue +4 -4
- package/CoupletsTest/widget/Fireworks/Fireworks.vue +13 -13
- package/CustomShader/App.vue +4 -4
- package/CustomShader/gaussianBlur.glsl +1 -1
- package/DashPath/App.vue +79 -0
- package/DashPath/AppForOperator.vue +35 -0
- package/DashPath/DashPath.vue +118 -0
- package/DemoForOperator/AnimPic/AnimPic.vue +47 -0
- package/DemoForOperator/AnimPic/App.vue +28 -0
- package/DemoForOperator/Banger/App.vue +26 -0
- package/DemoForOperator/Banger/Banger/Banger.vue +252 -0
- package/DemoForOperator/Banger/Banger/Maroon.vue +123 -0
- package/DemoForOperator/Banger/Banger/MaroonLoader.vue +78 -0
- package/DemoForOperator/Banger/Banger/SpriteDeal.js +30 -0
- package/DemoForOperator/Bounce/App.vue +43 -0
- package/DemoForOperator/Bounce/Bounce.vue +49 -0
- package/DemoForOperator/Bounce/FreeMoveBuilder.js +139 -0
- package/DemoForOperator/ChunLian/App.vue +47 -0
- package/DemoForOperator/ChunLian/Couplets.vue +248 -0
- package/DemoForOperator/EpisodeList/App.vue +80 -0
- package/DemoForOperator/EpisodeList/EpisodeList/Controller.vue +113 -0
- package/DemoForOperator/EpisodeList/EpisodeList/EpisodeList.vue +176 -0
- package/DemoForOperator/EpisodeList/GroupItem.vue +65 -0
- package/DemoForOperator/EpisodeList/ListItem.vue +48 -0
- package/DemoForOperator/Firework1/App.vue +25 -0
- package/DemoForOperator/Firework1/Fireworks.vue +358 -0
- package/DemoForOperator/Firework1/SpriteDeal.js +30 -0
- package/DemoForOperator/FlipPage/App.vue +75 -0
- package/DemoForOperator/FlipPage/FlipPage/FlipPage.vue +150 -0
- package/DemoForOperator/FlipPage/FlipPage/flipIn.glsl +41 -0
- package/DemoForOperator/FlipPage/FlipPage/flipOut.glsl +41 -0
- package/DemoForOperator/Focus/Alpha/AlphaFocusBox.vue +70 -0
- package/DemoForOperator/Focus/Alpha/AlphaPage.vue +40 -0
- package/DemoForOperator/Focus/Alpha/Item.vue +64 -0
- package/DemoForOperator/Focus/App.vue +124 -0
- package/DemoForOperator/Focus/CommonPageSetting.js +30 -0
- package/DemoForOperator/Focus/Item.vue +46 -0
- package/DemoForOperator/Focus/Light/Item.vue +67 -0
- package/DemoForOperator/Focus/Light/LightFocusBox.vue +46 -0
- package/DemoForOperator/Focus/Light/LightPage.vue +43 -0
- package/DemoForOperator/Focus/Light/utils/FrameCanvasStore.ts +68 -0
- package/DemoForOperator/Focus/Light/utils/RotateFrame.vue +146 -0
- package/DemoForOperator/Focus/Light/utils/circleHaloMask.png +0 -0
- package/DemoForOperator/Focus/Normal/Item.vue +64 -0
- package/DemoForOperator/Focus/Normal/NormalFocusBox.vue +53 -0
- package/DemoForOperator/Focus/Normal/NormalPage.vue +41 -0
- package/DemoForOperator/Focus/SwipeLight/Item.vue +73 -0
- package/DemoForOperator/Focus/SwipeLight/SwipeLightBox.vue +62 -0
- package/DemoForOperator/Focus/SwipeLight/SwipeLightPage.vue +44 -0
- package/DemoForOperator/FullscreenIn/App.vue +105 -0
- package/DemoForOperator/FullscreenIn/FullscreenPoster.vue +41 -0
- package/DemoForOperator/FullscreenIn/Item.vue +50 -0
- package/DemoForOperator/Genie/App.vue +78 -0
- package/DemoForOperator/Genie/geniePakcer/Genie.vue +699 -0
- package/DemoForOperator/Genie/geniePakcer/genieBottom.glsl +49 -0
- package/DemoForOperator/Genie/geniePakcer/genieLeft.glsl +50 -0
- package/DemoForOperator/Genie/geniePakcer/genieRight.glsl +57 -0
- package/DemoForOperator/Genie/geniePakcer/genieTop.glsl +50 -0
- package/DemoForOperator/GrayFilter/App.vue +51 -0
- package/DemoForOperator/GrayFilter/GrayFilter.vue +38 -0
- package/DemoForOperator/Jigsaw/App.vue +45 -0
- package/DemoForOperator/Jigsaw/JigsawFull.vue +100 -0
- package/DemoForOperator/Jigsaw/JigsawSingle.vue +86 -0
- package/DemoForOperator/Particle/App.vue +69 -0
- package/DemoForOperator/Particle/Drop/DropParticle.vue +176 -0
- package/DemoForOperator/Particle/Explode/ExplodeParticle.vue +99 -0
- package/DemoForOperator/PosterAnim/App.vue +125 -0
- package/DemoForOperator/PosterAnim/Bounce/BouncePage.vue +54 -0
- package/DemoForOperator/PosterAnim/Bounce/Item.vue +85 -0
- package/DemoForOperator/PosterAnim/Breath/BreathPage.vue +47 -0
- package/DemoForOperator/PosterAnim/Breath/Item.vue +58 -0
- package/DemoForOperator/PosterAnim/CommonPageSetting.js +30 -0
- package/DemoForOperator/PosterAnim/Item.vue +46 -0
- package/DemoForOperator/PosterAnim/PosterAnim.js +58 -0
- package/DemoForOperator/PosterAnim/Scale/Item.vue +72 -0
- package/DemoForOperator/PosterAnim/Scale/ScalePage.vue +48 -0
- package/DemoForOperator/PosterAnim/Shake/Item.vue +85 -0
- package/DemoForOperator/PosterAnim/Shake/ShakePage.vue +53 -0
- package/DemoForOperator/PosterOverflow/App.vue +116 -0
- package/DemoForOperator/PosterOverflow/Item.vue +67 -0
- package/DemoForOperator/PosterOverflow/PosterOverflow.vue +23 -0
- package/DemoForOperator/Ripple/App.vue +54 -0
- package/DemoForOperator/Ripple/Ripple.vue +50 -0
- package/DemoForOperator/ScalePoster/App.vue +4 -0
- package/DemoForOperator/ScalePoster/ScalePoster.vue +0 -0
- package/DemoForOperator/Sprite/App.vue +33 -0
- package/DemoForOperator/Sprite/Sprite.vue +90 -0
- package/DemoForOperator/Stretch/App.vue +103 -0
- package/DemoForOperator/Stretch/Stretch/Item.vue +192 -0
- package/DemoForOperator/Stretch/Stretch/Stretch.vue +168 -0
- package/DemoForOperator/TabContent/App.vue +89 -0
- package/DemoForOperator/TabContent/ContentPage.vue +66 -0
- package/DemoForOperator/TabContent/Item.vue +85 -0
- package/DemoForOperator/TabContent/PageItem.vue +40 -0
- package/DemoForOperator/TabContent/TabContent/CreepFocus.vue +160 -0
- package/DemoForOperator/TabContent/TabContent/Item.vue +63 -0
- package/DemoForOperator/TabContent/TabContent/TabContent.vue +146 -0
- package/DemoForOperator/TabContent/TabContent/TabItem.vue +368 -0
- package/DemoForOperator/TabContent/TabContent/TabWidget.vue +243 -0
- package/DemoForOperator/TabContent/TabContent/Util.js +3 -0
- package/DemoForOperator/TabContent/TabContent/ViewSwiper.vue +110 -0
- package/DemoForOperator/TabContent/testData.js +241 -0
- package/DemoForOperator/Vortex/App.vue +78 -0
- package/DemoForOperator/Vortex/Vortex/Vortex.vue +154 -0
- package/DemoForOperator/Vortex/Vortex/vortexIn.glsl +38 -0
- package/DemoForOperator/Vortex/Vortex/vortexOut.glsl +38 -0
- package/DemoForOperator/index.js +6 -0
- package/DemoForOperator/routeList.js +142 -0
- package/DemoHomepage/App.vue +50 -30
- package/DemoHomepage/components/Dialog.vue +1 -0
- package/DemoHomepage/components/TabFrame.vue +7 -0
- package/DemoHomepage/router.js +104 -81
- package/DemoHomepage/views/Homepage.vue +7 -2
- package/DivMetroPerformance/data.js +3 -3
- package/DriftScopeTest/App.vue +1 -1
- package/FilterDemo/AnimatePic.vue +1 -1
- package/FilterDemo/VideoLayer.vue +2 -2
- package/FullScreenFlex/TestFrame2.vue +1 -1
- package/GiftRain/App.vue +12 -12
- package/JsvPreDownloader/App.vue +4 -4
- package/MediaDemo/components/frames/AudioFrame.vue +1 -1
- package/MediaDemo/components/frames/VideoFrame.vue +1 -1
- package/MetroWidgetDemos/MassiveItems/ContentItem.vue +1 -1
- package/MetroWidgetDemos/MassiveItems/data.js +1 -1
- package/MetroWidgetDemos/PerformanceTest/data.js +3 -3
- package/MetroWidgetDemos/RefreshDemo/assets/imageList.json +235 -235
- package/MetroWidgetDemos/SkeletonDiagram/assets/imageList.json +235 -235
- package/MetroWidgetDemos/focusableItemMetroWidget/WidgetItem.vue +3 -1
- package/MetroWidgetDemos/routeList.js +17 -17
- package/Poster3d/App.vue +69 -0
- package/Poster3d/Poster3d.vue +92 -0
- package/PosterPacker/App.vue +3 -3
- package/PosterPacker/tools/vortexPacker/Vortex.vue +1 -1
- package/QrcodeDemo/App.vue +1 -1
- package/Ripple/App.vue +1 -1
- package/ScaleDownNeon/App.vue +4 -4
- package/SceneTransition/App.vue +2 -2
- package/SceneTransition/maskConfig/config2.js +12 -12
- package/SceneTransition/maskConfig/config3.js +14 -14
- package/SprayView/App.vue +96 -51
- package/SpringFestival/App.vue +73 -0
- package/SpringFestival/SpringFestivalScene/ChunLian.vue +211 -0
- package/SpringFestival/SpringFestivalScene/FreeMoveBuilder.js +139 -0
- package/SpringFestival/SpringFestivalScene/LanternAnim.js +60 -0
- package/SpringFestival/SpringFestivalScene/Rain.vue +137 -0
- package/SpringFestival/SpringFestivalScene/Scene.vue +218 -0
- package/SpringFestival/SpringFestivalScene/imageConfig.js +87 -0
- package/SpringFestival/SpringFestivalScene/index.js +1 -0
- package/Swiper/App.vue +28 -29
- package/Swiper/Item.vue +19 -0
- package/SwiperTest/App.vue +9 -9
- package/TestNativeSharedView/AckEventDefine.ts +82 -0
- package/TestNativeSharedView/App.vue +4 -6
- package/TestNativeSharedView/JsvDemoTester.js +131 -0
- package/TextureAnimation/App.vue +16 -6
- package/TextureAnimation/App3.vue +100 -0
- package/TextureAnimation/utils/FrameCanvasStore.ts +68 -0
- package/TextureAnimation/utils/RotateFrame.vue +146 -0
- package/TextureAnimation/utils/circleHaloMask.png +0 -0
- package/TombSweepingDayTest/Raining/RainScene.vue +4 -4
- package/ViewOpacity/App.vue +2 -2
- package/package.json +1 -1
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
:style="{
|
|
4
|
+
left: layout.left,
|
|
5
|
+
top: layout.top,
|
|
6
|
+
}"
|
|
7
|
+
>
|
|
8
|
+
<jsv-frag-shader-view
|
|
9
|
+
v-if="showFbo"
|
|
10
|
+
:key="keyCount"
|
|
11
|
+
ref="shaderViewRef"
|
|
12
|
+
:style="{
|
|
13
|
+
width: layout.width,
|
|
14
|
+
height: layout.height,
|
|
15
|
+
}"
|
|
16
|
+
:duration="shaderSetting.duration"
|
|
17
|
+
:shaderStr="shaderSetting.shader"
|
|
18
|
+
:autoplay="true"
|
|
19
|
+
:textures="shaderSetting.textures"
|
|
20
|
+
:onEnd="onAnimEnd"
|
|
21
|
+
></jsv-frag-shader-view>
|
|
22
|
+
|
|
23
|
+
<div
|
|
24
|
+
v-if="!showOrigin"
|
|
25
|
+
:style="{
|
|
26
|
+
width: 1,
|
|
27
|
+
height: 1,
|
|
28
|
+
overflow: 'hidden',
|
|
29
|
+
}"
|
|
30
|
+
>
|
|
31
|
+
<div
|
|
32
|
+
ref="slotRootRef"
|
|
33
|
+
:style="{
|
|
34
|
+
width: layout.width,
|
|
35
|
+
height: layout.height,
|
|
36
|
+
}"
|
|
37
|
+
>
|
|
38
|
+
<slot></slot>
|
|
39
|
+
</div>
|
|
40
|
+
</div>
|
|
41
|
+
<div
|
|
42
|
+
v-else
|
|
43
|
+
ref="slotRootRef"
|
|
44
|
+
:style="{
|
|
45
|
+
width: layout.width,
|
|
46
|
+
height: layout.height,
|
|
47
|
+
}"
|
|
48
|
+
>
|
|
49
|
+
<slot></slot>
|
|
50
|
+
</div>
|
|
51
|
+
</div>
|
|
52
|
+
</template>
|
|
53
|
+
|
|
54
|
+
<script setup>
|
|
55
|
+
import flipOutShader from "./flipOut.glsl?raw";
|
|
56
|
+
import flipInShader from "./flipIn.glsl?raw";
|
|
57
|
+
|
|
58
|
+
import { onMounted, onUnmounted, shallowRef, ref, computed } from "vue";
|
|
59
|
+
import {
|
|
60
|
+
JsvFragShaderView,
|
|
61
|
+
getKeyFramesGroup,
|
|
62
|
+
JsvTextureStoreApi,
|
|
63
|
+
} from "jsview";
|
|
64
|
+
|
|
65
|
+
const props = defineProps({
|
|
66
|
+
layout: {
|
|
67
|
+
type: Object,
|
|
68
|
+
required: true,
|
|
69
|
+
},
|
|
70
|
+
duration: {
|
|
71
|
+
type: Number,
|
|
72
|
+
default: 1,
|
|
73
|
+
},
|
|
74
|
+
initShow: {
|
|
75
|
+
type: Boolean,
|
|
76
|
+
default: true,
|
|
77
|
+
},
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
const showOrigin = shallowRef(props.initShow);
|
|
81
|
+
const showFbo = shallowRef(false);
|
|
82
|
+
const slotRootRef = shallowRef();
|
|
83
|
+
const keyCount = ref(0);
|
|
84
|
+
const shaderViewRef = ref();
|
|
85
|
+
let state = props.initShow ? 1 : 0;
|
|
86
|
+
|
|
87
|
+
let shaderSetting = {
|
|
88
|
+
name: "flipPage",
|
|
89
|
+
shader: "",
|
|
90
|
+
uniforms: [],
|
|
91
|
+
textures: [
|
|
92
|
+
{
|
|
93
|
+
name: "iChannel0",
|
|
94
|
+
resource: "",
|
|
95
|
+
},
|
|
96
|
+
],
|
|
97
|
+
duration: Math.round(props.duration * 1000),
|
|
98
|
+
};
|
|
99
|
+
let _onEnd = null;
|
|
100
|
+
|
|
101
|
+
function animOut() {
|
|
102
|
+
shaderSetting.shader = flipOutShader;
|
|
103
|
+
_onEnd = () => {
|
|
104
|
+
showOrigin.value = false;
|
|
105
|
+
};
|
|
106
|
+
capture();
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function animIn() {
|
|
110
|
+
shaderSetting.shader = flipInShader;
|
|
111
|
+
_onEnd = () => {
|
|
112
|
+
showOrigin.value = true;
|
|
113
|
+
};
|
|
114
|
+
capture();
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
function onAnimEnd() {
|
|
118
|
+
showFbo.value = false;
|
|
119
|
+
_onEnd();
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
function capture() {
|
|
123
|
+
JsvTextureStoreApi.capture2Texture(
|
|
124
|
+
slotRootRef.value,
|
|
125
|
+
(textureName, autoRecycle, w, h) => {
|
|
126
|
+
shaderSetting.textures[0].resource = `jsvtexturestore://${textureName}`;
|
|
127
|
+
|
|
128
|
+
if (autoRecycle) {
|
|
129
|
+
// 已经是设置了texture的自动回收,所以不再需要主动调用 JsvTextureStoreApi.deleteTexture 来释放内存
|
|
130
|
+
}
|
|
131
|
+
showOrigin.value = false;
|
|
132
|
+
++keyCount.value;
|
|
133
|
+
showFbo.value = true;
|
|
134
|
+
},
|
|
135
|
+
true // 自动回收, 不填也行,默认为true
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
defineExpose({
|
|
140
|
+
switch() {
|
|
141
|
+
if (state == 0) {
|
|
142
|
+
state = 1;
|
|
143
|
+
animIn();
|
|
144
|
+
} else {
|
|
145
|
+
state = 0;
|
|
146
|
+
animOut();
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
});
|
|
150
|
+
</script>
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
//https://andrewhungblog.wordpress.com/2018/04/29/page-curl-shader-breakdown/
|
|
2
|
+
#define pi 3.14159265359
|
|
3
|
+
#define radius .1
|
|
4
|
+
|
|
5
|
+
float fastAsin(float x) {
|
|
6
|
+
float x2 = x * x;
|
|
7
|
+
float x3 = x2 * x;
|
|
8
|
+
float x5 = x3 * x2;
|
|
9
|
+
float x7 = x5 * x2;
|
|
10
|
+
return x + (1.0 / 6.0) * x3 + (3.0 / 40.0) * x5 + (5.0 / 112.0) * x7;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
void mainImage(out vec4 fragColor, in vec2 fragCoord) {
|
|
14
|
+
vec2 aspect = iResolution.xy / iResolution.y;
|
|
15
|
+
vec2 uv = fragCoord * aspect / iResolution.xy;
|
|
16
|
+
vec2 anchor = aspect;
|
|
17
|
+
vec2 mouse = anchor - abs(1. - iTime / iDuration) * anchor;
|
|
18
|
+
vec2 mouseDir = normalize(anchor - mouse);
|
|
19
|
+
vec2 origin = mouse - mouseDir * mouse.x / abs(mouseDir.x);
|
|
20
|
+
float mouseDist = length(mouse - origin);
|
|
21
|
+
|
|
22
|
+
float proj = dot(uv - origin, mouseDir);
|
|
23
|
+
float dist = proj - mouseDist;
|
|
24
|
+
vec2 linePoint = uv - dist * mouseDir;
|
|
25
|
+
if(dist > radius) {
|
|
26
|
+
fragColor = vec4(0.0, 0.0, 0.0, 0.0);
|
|
27
|
+
fragColor.rgb *= pow(clamp(dist - radius, 0., 1.) * 1.5, .2);
|
|
28
|
+
} else if(dist >= 0.) {
|
|
29
|
+
// map to cylinder point
|
|
30
|
+
float theta = fastAsin(dist / radius);
|
|
31
|
+
vec2 p2 = linePoint + mouseDir * (pi - theta) * radius;
|
|
32
|
+
vec2 p1 = linePoint + mouseDir * theta * radius;
|
|
33
|
+
uv = (p2.x <= aspect.x && p2.y <= aspect.y && p2.x > 0. && p2.y > 0.) ? p2 : p1;
|
|
34
|
+
fragColor = jsvTexture2D(iChannel0, uv / aspect);
|
|
35
|
+
fragColor.rgb *= pow(clamp((radius - dist) / radius, 0., 1.), .2);
|
|
36
|
+
} else {
|
|
37
|
+
vec2 p = linePoint + mouseDir * (abs(dist) + pi * radius);
|
|
38
|
+
uv = (p.x <= aspect.x && p.y <= aspect.y && p.x > 0. && p.y > 0.) ? p : uv;
|
|
39
|
+
fragColor = jsvTexture2D(iChannel0, uv / aspect);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
//https://andrewhungblog.wordpress.com/2018/04/29/page-curl-shader-breakdown/
|
|
2
|
+
#define pi 3.14159265359
|
|
3
|
+
#define radius .1
|
|
4
|
+
|
|
5
|
+
float fastAsin(float x) {
|
|
6
|
+
float x2 = x * x;
|
|
7
|
+
float x3 = x2 * x;
|
|
8
|
+
float x5 = x3 * x2;
|
|
9
|
+
float x7 = x5 * x2;
|
|
10
|
+
return x + (1.0 / 6.0) * x3 + (3.0 / 40.0) * x5 + (5.0 / 112.0) * x7;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
void mainImage(out vec4 fragColor, in vec2 fragCoord) {
|
|
14
|
+
vec2 aspect = iResolution.xy / iResolution.y;
|
|
15
|
+
vec2 uv = fragCoord * aspect / iResolution.xy;
|
|
16
|
+
vec2 anchor = aspect;
|
|
17
|
+
vec2 mouse = anchor - abs(iTime / iDuration) * anchor;
|
|
18
|
+
vec2 mouseDir = normalize(anchor - mouse);
|
|
19
|
+
vec2 origin = mouse - mouseDir * mouse.x / abs(mouseDir.x);
|
|
20
|
+
float mouseDist = length(mouse - origin);
|
|
21
|
+
|
|
22
|
+
float proj = dot(uv - origin, mouseDir);
|
|
23
|
+
float dist = proj - mouseDist;
|
|
24
|
+
vec2 linePoint = uv - dist * mouseDir;
|
|
25
|
+
if(dist > radius) {
|
|
26
|
+
fragColor = vec4(0.0, 0.0, 0.0, 0.0);
|
|
27
|
+
fragColor.rgb *= pow(clamp(dist - radius, 0., 1.) * 1.5, .2);
|
|
28
|
+
} else if(dist >= 0.) {
|
|
29
|
+
// map to cylinder point
|
|
30
|
+
float theta = fastAsin(dist / radius);
|
|
31
|
+
vec2 p2 = linePoint + mouseDir * (pi - theta) * radius;
|
|
32
|
+
vec2 p1 = linePoint + mouseDir * theta * radius;
|
|
33
|
+
uv = (p2.x <= aspect.x && p2.y <= aspect.y && p2.x > 0. && p2.y > 0.) ? p2 : p1;
|
|
34
|
+
fragColor = jsvTexture2D(iChannel0, uv / aspect);
|
|
35
|
+
fragColor.rgb *= pow(clamp((radius - dist) / radius, 0., 1.), .2);
|
|
36
|
+
} else {
|
|
37
|
+
vec2 p = linePoint + mouseDir * (abs(dist) + pi * radius);
|
|
38
|
+
uv = (p.x <= aspect.x && p.y <= aspect.y && p.x > 0. && p.y > 0.) ? p : uv;
|
|
39
|
+
fragColor = jsvTexture2D(iChannel0, uv / aspect);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<JsvNinePatch
|
|
3
|
+
:style="layout"
|
|
4
|
+
:imageUrl="`jsvtexturestore://${sourceId}`"
|
|
5
|
+
:imageWidth="sampleImageWidth"
|
|
6
|
+
:centerWidth="2"
|
|
7
|
+
:imageDspWidth="sampleImageWidth"
|
|
8
|
+
:borderOutset="borderWidth"
|
|
9
|
+
animation="breath 2s infinite"
|
|
10
|
+
/>
|
|
11
|
+
</template>
|
|
12
|
+
<script setup>
|
|
13
|
+
import { JsvNinePatch, JsvTextureStoreApi } from "jsview";
|
|
14
|
+
import { onBeforeUnmount } from "vue";
|
|
15
|
+
|
|
16
|
+
const props = defineProps({
|
|
17
|
+
color: {
|
|
18
|
+
type: String,
|
|
19
|
+
},
|
|
20
|
+
layout: {
|
|
21
|
+
type: Object,
|
|
22
|
+
},
|
|
23
|
+
borderWidth: {
|
|
24
|
+
type: Number,
|
|
25
|
+
},
|
|
26
|
+
duration: {
|
|
27
|
+
type: Number
|
|
28
|
+
},
|
|
29
|
+
borderRadius: {
|
|
30
|
+
type: Number,
|
|
31
|
+
default: 10,
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
let canvasRef;
|
|
36
|
+
let circleRadius = props.borderRadius;
|
|
37
|
+
let sampleImageWidth = circleRadius * 2 + props.borderWidth + 2;
|
|
38
|
+
canvasRef = JsvTextureStoreApi.canvasTexture(
|
|
39
|
+
sampleImageWidth,
|
|
40
|
+
sampleImageWidth
|
|
41
|
+
); // 创建画布
|
|
42
|
+
|
|
43
|
+
let circleLineWidth = props.borderWidth;
|
|
44
|
+
let customPath = canvasRef.circlePath(
|
|
45
|
+
Math.floor(sampleImageWidth / 2),
|
|
46
|
+
Math.floor(sampleImageWidth / 2),
|
|
47
|
+
circleRadius
|
|
48
|
+
); // 创建圆环绘制路径,圆形在画布的中心点位置
|
|
49
|
+
canvasRef.drawColor("rgba(0,0,0,0)"); // 画布绘制半透明底色
|
|
50
|
+
customPath.stroke(circleLineWidth, props.color); // 以给定线宽绘制圆环
|
|
51
|
+
const sourceId = canvasRef.commit(); // texture和div的textureStore绑定
|
|
52
|
+
|
|
53
|
+
onBeforeUnmount(() => {
|
|
54
|
+
JsvTextureStoreApi.deleteTexture(sourceId);
|
|
55
|
+
});
|
|
56
|
+
</script>
|
|
57
|
+
|
|
58
|
+
<style scopped>
|
|
59
|
+
@keyframes breath {
|
|
60
|
+
0% {
|
|
61
|
+
opacity: 1;
|
|
62
|
+
}
|
|
63
|
+
50% {
|
|
64
|
+
opacity: 0.1;
|
|
65
|
+
}
|
|
66
|
+
100% {
|
|
67
|
+
opacity: 1;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
</style>
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<metro-widget
|
|
3
|
+
name="alpha"
|
|
4
|
+
:left="widgetLayout.left"
|
|
5
|
+
:top="widgetLayout.top"
|
|
6
|
+
:width="widgetLayout.width"
|
|
7
|
+
:height="widgetLayout.height"
|
|
8
|
+
:provideData="provideData"
|
|
9
|
+
:direction="HORIZONTAL"
|
|
10
|
+
:measures="measures"
|
|
11
|
+
:onEdge="onEdge"
|
|
12
|
+
:padding="padding"
|
|
13
|
+
>
|
|
14
|
+
<template #renderItem="{ data, onAction }">
|
|
15
|
+
<item :data="data" :onAction="onAction" />
|
|
16
|
+
</template>
|
|
17
|
+
</metro-widget>
|
|
18
|
+
</template>
|
|
19
|
+
|
|
20
|
+
<script setup>
|
|
21
|
+
import { MetroWidget, HORIZONTAL } from "jsview";
|
|
22
|
+
import Item from "./Item.vue";
|
|
23
|
+
import { widgetLayout, padding, data } from "../CommonPageSetting";
|
|
24
|
+
|
|
25
|
+
const props = defineProps({
|
|
26
|
+
onEdge: Function
|
|
27
|
+
})
|
|
28
|
+
const provideData = () => {
|
|
29
|
+
return data;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const measures = (data) => {
|
|
33
|
+
return {
|
|
34
|
+
width: data.width,
|
|
35
|
+
height: data.height,
|
|
36
|
+
marginRight: data.marginRight,
|
|
37
|
+
marginBottom: data.marginBottom,
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
</script>
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
* @Author: ChenChanghua
|
|
3
|
+
* @Date: 2023-03-08 14:52:17
|
|
4
|
+
* @Description: file content
|
|
5
|
+
-->
|
|
6
|
+
<script setup>
|
|
7
|
+
import { ref } from "vue";
|
|
8
|
+
import AlphaFocusBox from "./AlphaFocusBox.vue";
|
|
9
|
+
|
|
10
|
+
const props = defineProps({
|
|
11
|
+
data: Object,
|
|
12
|
+
onAction: Object,
|
|
13
|
+
});
|
|
14
|
+
const bgImage = "https://cdn.release.qcast.cn/JsViewFrameworkTester/JsViewVueSampleResources/DemoForOperator/Focus/Alpha/Item/background.png";
|
|
15
|
+
|
|
16
|
+
const focused = ref(false);
|
|
17
|
+
|
|
18
|
+
// 注册回调
|
|
19
|
+
const onFocus = () => {
|
|
20
|
+
focused.value = true;
|
|
21
|
+
};
|
|
22
|
+
const onBlur = () => {
|
|
23
|
+
focused.value = false;
|
|
24
|
+
};
|
|
25
|
+
const onClick = () => {};
|
|
26
|
+
props.onAction.register("onFocus", onFocus);
|
|
27
|
+
props.onAction.register("onBlur", onBlur);
|
|
28
|
+
props.onAction.register("onClick", onClick);
|
|
29
|
+
</script>
|
|
30
|
+
|
|
31
|
+
<template>
|
|
32
|
+
<div
|
|
33
|
+
:style="{
|
|
34
|
+
width: data.width,
|
|
35
|
+
height: data.height,
|
|
36
|
+
transition: 'transform 0.2s',
|
|
37
|
+
transform: focused ? 'scale3d(1.05, 1.05, 1)' : null,
|
|
38
|
+
}"
|
|
39
|
+
>
|
|
40
|
+
<div
|
|
41
|
+
:style="{
|
|
42
|
+
width: data.width,
|
|
43
|
+
height: data.height,
|
|
44
|
+
fontSize: 30,
|
|
45
|
+
color: '#FFFFFF',
|
|
46
|
+
backgroundImage: bgImage,
|
|
47
|
+
lineHeight: data.height,
|
|
48
|
+
textAlign: 'center',
|
|
49
|
+
}"
|
|
50
|
+
>
|
|
51
|
+
明暗
|
|
52
|
+
</div>
|
|
53
|
+
<alpha-focus-box
|
|
54
|
+
v-if="focused"
|
|
55
|
+
color="#ffffff"
|
|
56
|
+
:layout="{
|
|
57
|
+
width: data.width,
|
|
58
|
+
height: data.height,
|
|
59
|
+
}"
|
|
60
|
+
:borderWidth="5"
|
|
61
|
+
:borderRadius="10"
|
|
62
|
+
/>
|
|
63
|
+
</div>
|
|
64
|
+
</template>
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :style="{ width: 1280, height: 720, backgroundColor: '#007788' }"></div>
|
|
3
|
+
<div
|
|
4
|
+
:style="{
|
|
5
|
+
left: (1280 - 600) / 2,
|
|
6
|
+
}"
|
|
7
|
+
>
|
|
8
|
+
<normal-page v-if="pageId == 0" :onEdge="pageOnEdge" />
|
|
9
|
+
<light-page v-else-if="pageId == 1" :onEdge="pageOnEdge" />
|
|
10
|
+
<alpha-page v-else-if="pageId == 2" :onEdge="pageOnEdge" />
|
|
11
|
+
<swipe-light-page v-else-if="pageId == 3" :onEdge="pageOnEdge" />
|
|
12
|
+
</div>
|
|
13
|
+
|
|
14
|
+
<div
|
|
15
|
+
:style="{
|
|
16
|
+
left: (1280 - 240) / 2,
|
|
17
|
+
top: 400,
|
|
18
|
+
}"
|
|
19
|
+
>
|
|
20
|
+
<metro-widget
|
|
21
|
+
name="btn"
|
|
22
|
+
:width="widgetLayout.width"
|
|
23
|
+
:height="widgetLayout.height"
|
|
24
|
+
:provideData="provideData"
|
|
25
|
+
:direction="HORIZONTAL"
|
|
26
|
+
:measures="measures"
|
|
27
|
+
:onEdge="onEdge"
|
|
28
|
+
>
|
|
29
|
+
<template #renderItem="{ data, onAction, query }">
|
|
30
|
+
<item
|
|
31
|
+
:data="data"
|
|
32
|
+
:onAction="onAction"
|
|
33
|
+
:onItemFocus="onItemFocus"
|
|
34
|
+
:query="query"
|
|
35
|
+
/>
|
|
36
|
+
</template>
|
|
37
|
+
</metro-widget>
|
|
38
|
+
<div
|
|
39
|
+
:style="{
|
|
40
|
+
top: 60,
|
|
41
|
+
fontSize: 25,
|
|
42
|
+
color: '#000000',
|
|
43
|
+
}"
|
|
44
|
+
>
|
|
45
|
+
切换焦点样式
|
|
46
|
+
</div>
|
|
47
|
+
</div>
|
|
48
|
+
</template>
|
|
49
|
+
|
|
50
|
+
<script setup>
|
|
51
|
+
import NormalPage from "./Normal/NormalPage.vue";
|
|
52
|
+
import LightPage from "./Light/LightPage.vue";
|
|
53
|
+
import AlphaPage from "./Alpha/AlphaPage.vue";
|
|
54
|
+
import SwipeLightPage from "./SwipeLight/SwipeLightPage.vue";
|
|
55
|
+
import Item from "./Item.vue";
|
|
56
|
+
import { useFocusHub, MetroWidget, HORIZONTAL, EdgeDirection } from "jsview";
|
|
57
|
+
import { onMounted, ref } from "vue";
|
|
58
|
+
|
|
59
|
+
const focusHub = useFocusHub();
|
|
60
|
+
|
|
61
|
+
const pageId = ref(0);
|
|
62
|
+
|
|
63
|
+
const provideData = () => {
|
|
64
|
+
const data = [];
|
|
65
|
+
for (let i = 0; i < 4; ++i) {
|
|
66
|
+
data.push({
|
|
67
|
+
width: 50,
|
|
68
|
+
height: 50,
|
|
69
|
+
marginRight: 10,
|
|
70
|
+
content: i,
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
return data;
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
const measures = (data) => {
|
|
77
|
+
return {
|
|
78
|
+
width: data.width,
|
|
79
|
+
height: data.height,
|
|
80
|
+
marginRight: data.marginRight,
|
|
81
|
+
marginBottom: data.marginBottom,
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
const pageOnEdge = (edgeInfo) => {
|
|
86
|
+
if (edgeInfo.direction == EdgeDirection.bottom) {
|
|
87
|
+
focusHub.setFocus("btn");
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
// callbacks
|
|
91
|
+
const onEdge = (edgeInfo) => {
|
|
92
|
+
if (edgeInfo.direction == EdgeDirection.top) {
|
|
93
|
+
let name = null;
|
|
94
|
+
switch (pageId.value) {
|
|
95
|
+
case 0:
|
|
96
|
+
name = "normal";
|
|
97
|
+
break;
|
|
98
|
+
case 1:
|
|
99
|
+
name = "light";
|
|
100
|
+
break;
|
|
101
|
+
case 2:
|
|
102
|
+
name = "alpha";
|
|
103
|
+
break;
|
|
104
|
+
case 3:
|
|
105
|
+
name = "swipeLight";
|
|
106
|
+
break;
|
|
107
|
+
}
|
|
108
|
+
focusHub.setFocus(name);
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
const onItemFocus = (index) => {
|
|
112
|
+
pageId.value = index;
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
const widgetLayout = {
|
|
116
|
+
width: 500,
|
|
117
|
+
height: 50,
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
onMounted(() => {
|
|
121
|
+
//组件mount后设置焦点
|
|
122
|
+
focusHub.setFocus("btn");
|
|
123
|
+
});
|
|
124
|
+
</script>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
|
|
2
|
+
export const widgetLayout = {
|
|
3
|
+
left: 50,
|
|
4
|
+
top: 50,
|
|
5
|
+
width: 600,
|
|
6
|
+
height: 300,
|
|
7
|
+
};
|
|
8
|
+
export const padding = {
|
|
9
|
+
left: 50,
|
|
10
|
+
right: 50,
|
|
11
|
+
top: 50,
|
|
12
|
+
bottom: 50,
|
|
13
|
+
};
|
|
14
|
+
export const data = [
|
|
15
|
+
{
|
|
16
|
+
width: 100,
|
|
17
|
+
height: 200,
|
|
18
|
+
marginRight: 10,
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
width: 200,
|
|
22
|
+
height: 200,
|
|
23
|
+
marginRight: 10,
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
width: 100,
|
|
27
|
+
height: 200,
|
|
28
|
+
marginRight: 10,
|
|
29
|
+
},
|
|
30
|
+
];
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
* @Author: ChenChanghua
|
|
3
|
+
* @Date: 2023-03-08 14:52:17
|
|
4
|
+
* @Description: file content
|
|
5
|
+
-->
|
|
6
|
+
<script setup>
|
|
7
|
+
import { ref } from "vue";
|
|
8
|
+
|
|
9
|
+
const props = defineProps({
|
|
10
|
+
data: Object,
|
|
11
|
+
onAction: Object,
|
|
12
|
+
onItemFocus: Function,
|
|
13
|
+
query: Object,
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
const focused = ref(false);
|
|
17
|
+
|
|
18
|
+
// 注册回调
|
|
19
|
+
const onFocus = () => {
|
|
20
|
+
focused.value = true;
|
|
21
|
+
props.onItemFocus(props.query.index);
|
|
22
|
+
};
|
|
23
|
+
const onBlur = () => {
|
|
24
|
+
focused.value = false;
|
|
25
|
+
};
|
|
26
|
+
const onClick = () => {};
|
|
27
|
+
props.onAction.register("onFocus", onFocus);
|
|
28
|
+
props.onAction.register("onBlur", onBlur);
|
|
29
|
+
props.onAction.register("onClick", onClick);
|
|
30
|
+
</script>
|
|
31
|
+
|
|
32
|
+
<template>
|
|
33
|
+
<div
|
|
34
|
+
:style="{
|
|
35
|
+
width: data.width,
|
|
36
|
+
height: data.height,
|
|
37
|
+
fontSize: 30,
|
|
38
|
+
color: '#000000',
|
|
39
|
+
backgroundColor: focused ? '#00ff00' : '#ff000033',
|
|
40
|
+
lineHeight: data.height,
|
|
41
|
+
textAlign: 'center',
|
|
42
|
+
}"
|
|
43
|
+
>
|
|
44
|
+
{{ data.content }}
|
|
45
|
+
</div>
|
|
46
|
+
</template>
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
* @Author: ChenChanghua
|
|
3
|
+
* @Date: 2023-03-08 14:52:17
|
|
4
|
+
* @Description: file content
|
|
5
|
+
-->
|
|
6
|
+
<script setup>
|
|
7
|
+
import { ref } from "vue";
|
|
8
|
+
import LightFocusBox from "./LightFocusBox.vue";
|
|
9
|
+
|
|
10
|
+
const props = defineProps({
|
|
11
|
+
data: Object,
|
|
12
|
+
onAction: Object,
|
|
13
|
+
});
|
|
14
|
+
const bgImage = "https://cdn.release.qcast.cn/JsViewFrameworkTester/JsViewVueSampleResources/DemoForOperator/Focus/Light/Item/background.png";
|
|
15
|
+
const lightImage = "https://cdn.release.qcast.cn/JsViewFrameworkTester/JsViewVueSampleResources/DemoForOperator/Focus/Light/Item/blackWhiteTurntable.png";
|
|
16
|
+
|
|
17
|
+
const focused = ref(false);
|
|
18
|
+
|
|
19
|
+
// 注册回调
|
|
20
|
+
const onFocus = () => {
|
|
21
|
+
focused.value = true;
|
|
22
|
+
};
|
|
23
|
+
const onBlur = () => {
|
|
24
|
+
focused.value = false;
|
|
25
|
+
};
|
|
26
|
+
const onClick = () => {};
|
|
27
|
+
props.onAction.register("onFocus", onFocus);
|
|
28
|
+
props.onAction.register("onBlur", onBlur);
|
|
29
|
+
props.onAction.register("onClick", onClick);
|
|
30
|
+
</script>
|
|
31
|
+
|
|
32
|
+
<template>
|
|
33
|
+
<div
|
|
34
|
+
:style="{
|
|
35
|
+
width: data.width,
|
|
36
|
+
height: data.height,
|
|
37
|
+
transition: 'transform 0.2s',
|
|
38
|
+
transform: focused ? 'scale3d(1.05, 1.05, 1)' : null,
|
|
39
|
+
}"
|
|
40
|
+
>
|
|
41
|
+
<div
|
|
42
|
+
:style="{
|
|
43
|
+
width: data.width,
|
|
44
|
+
height: data.height,
|
|
45
|
+
fontSize: 30,
|
|
46
|
+
color: '#FFFFFF',
|
|
47
|
+
backgroundImage: bgImage,
|
|
48
|
+
lineHeight: data.height,
|
|
49
|
+
textAlign: 'center',
|
|
50
|
+
}"
|
|
51
|
+
>
|
|
52
|
+
旋转光
|
|
53
|
+
</div>
|
|
54
|
+
<light-focus-box
|
|
55
|
+
v-if="focused"
|
|
56
|
+
:src="lightImage"
|
|
57
|
+
:layout="{
|
|
58
|
+
width: data.width,
|
|
59
|
+
height: data.height,
|
|
60
|
+
}"
|
|
61
|
+
:borderWidth="2"
|
|
62
|
+
:borderRadius="10"
|
|
63
|
+
:withHalo="true"
|
|
64
|
+
:circleTime="2"
|
|
65
|
+
/>
|
|
66
|
+
</div>
|
|
67
|
+
</template>
|