@shijiu/jsview-vue-samples 2.1.200 → 2.1.340-test.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.
Files changed (59) hide show
  1. package/AnimPicture/App.vue +224 -120
  2. package/AnimPicture/Item.vue +44 -0
  3. package/ConnectLine/App.vue +173 -0
  4. package/CoupletsTest/App.vue +212 -0
  5. package/CoupletsTest/Common/SpriteDeal.js +30 -0
  6. package/CoupletsTest/LeadWire.vue +221 -0
  7. package/CoupletsTest/Maroon.vue +112 -0
  8. package/CoupletsTest/Salvo.vue +251 -0
  9. package/CoupletsTest/Sprite/firecracker.json +212 -0
  10. package/CoupletsTest/Sprite/firecracker.png +0 -0
  11. package/CoupletsTest/Sprite/fireworks.json +220 -0
  12. package/CoupletsTest/Sprite/fireworks.png +0 -0
  13. package/CoupletsTest/Sprite/scroll.json +76 -0
  14. package/CoupletsTest/Sprite/scroll.png +0 -0
  15. package/CoupletsTest/Sprite/spark.json +268 -0
  16. package/CoupletsTest/Sprite/spark.png +0 -0
  17. package/CoupletsTest/images/Couplets.png +0 -0
  18. package/CoupletsTest/images/goldencoin1.png +0 -0
  19. package/CoupletsTest/images/goldencoin2.png +0 -0
  20. package/CoupletsTest/images/leadWire.png +0 -0
  21. package/CoupletsTest/images/line.png +0 -0
  22. package/CoupletsTest/images/purpleStar.png +0 -0
  23. package/CoupletsTest/images/redStar.png +0 -0
  24. package/CoupletsTest/images/scroll1.png +0 -0
  25. package/CoupletsTest/images/star1.png +0 -0
  26. package/CoupletsTest/images/star2.png +0 -0
  27. package/CoupletsTest/images/star3.png +0 -0
  28. package/CoupletsTest/images/star4.png +0 -0
  29. package/CoupletsTest/images/yellowStar.png +0 -0
  30. package/DemoHomepage/components/BodyFrame.vue +27 -11
  31. package/DemoHomepage/router.js +35 -5
  32. package/DemoHomepage/views/Homepage.vue +1 -1
  33. package/DispersedItemSample/DispersedItemSample.vue +138 -0
  34. package/DispersedItemSample/DispersedItemWidget/DispersedItemWidget.vue +358 -0
  35. package/DispersedItemSample/DispersedItemWidget/MyRenderItem.ts +115 -0
  36. package/DispersedItemSample/Item.vue +55 -0
  37. package/FilterDemo/AnimatePic.vue +5 -6
  38. package/FocusMoveStyle/App.vue +126 -110
  39. package/FocusMoveStyle/CreepFocus.vue +128 -0
  40. package/FocusMoveStyle/FoldableItem.vue +279 -0
  41. package/FocusMoveStyle/Item.vue +32 -31
  42. package/FreeMove/App.vue +2 -2
  43. package/ImpactStop/App.vue +343 -384
  44. package/LatexDemo/App.vue +11 -0
  45. package/MetroWidgetDemos/RefreshDemo/App.vue +101 -0
  46. package/MetroWidgetDemos/RefreshDemo/Item.vue +116 -0
  47. package/MetroWidgetDemos/RefreshDemo/assets/imageList.json +237 -0
  48. package/MetroWidgetDemos/RefreshDemo/data.js +16 -0
  49. package/MetroWidgetDemos/TripleWidget/App.vue +81 -0
  50. package/MetroWidgetDemos/TripleWidget/Item.vue +64 -0
  51. package/MetroWidgetDemos/TripleWidget/SWidgetItem.vue +93 -0
  52. package/MetroWidgetDemos/TripleWidget/WidgetItem.vue +111 -0
  53. package/MetroWidgetDemos/routeList.js +12 -0
  54. package/ProgressBar/App.vue +128 -0
  55. package/QrcodeDemo/App.vue +2 -2
  56. package/SpriteImage/App.vue +113 -68
  57. package/SwiperTest/App.vue +105 -0
  58. package/ViewOpacity/App.vue +98 -0
  59. package/package.json +1 -1
@@ -0,0 +1,212 @@
1
+ <template>
2
+ <jsv-focus-block autoFocus :onKeyDown="onKeyDown">
3
+ <div class="bgStyle">
4
+ <!-- 春联效果 -->
5
+ <div v-if="myIndex == 1">
6
+ <div
7
+ :style="{
8
+ top: 100,
9
+ left: 200,
10
+ width: 150,
11
+ height: 500,
12
+ overflow: 'hidden',
13
+ animation: 'recovery-clip 1.5s linear',
14
+ }"
15
+ >
16
+ <div
17
+ :style="{
18
+ top: 0,
19
+ left: 0,
20
+ width: 150,
21
+ height: 500,
22
+ backgroundImage: Couplets,
23
+ animation: 'recovery-img 1.5s linear',
24
+ }"
25
+ ></div>
26
+ </div>
27
+ <!-- 滚轴动画 -->
28
+ <div
29
+ :style="{
30
+ left: 170,
31
+ top: 500 + 96,
32
+ transform: `scale3d(${210 / view_size.w},1,1)`,
33
+ }"
34
+ >
35
+ <div
36
+ :style="{
37
+ width: 280,
38
+ height: 118,
39
+ animation: 'recovery-clip 1.5s linear',
40
+ }"
41
+ >
42
+ <JsvSpriteAnim
43
+ :spriteInfo="sprite_info.info"
44
+ :loop="4"
45
+ autostart="true"
46
+ :duration="0.4"
47
+ :imageUrl="scrollPng"
48
+ >
49
+ </JsvSpriteAnim>
50
+ </div>
51
+ </div>
52
+ <!-- 滚轴图片 -->
53
+ <div
54
+ :style="{
55
+ top: 100,
56
+ left: 200 - 30,
57
+ width: 210,
58
+ height: 30,
59
+ backgroundImage: scroll,
60
+ }"
61
+ ></div>
62
+ <!-- 素材1 滚轴图片 -->
63
+ <div
64
+ :style="{
65
+ top: 100,
66
+ left: 800,
67
+ width: 210,
68
+ height: 30,
69
+ backgroundImage: scroll,
70
+ }"
71
+ ></div>
72
+ <!-- 素材2 精灵图 -->
73
+ <div
74
+ :style="{
75
+ top: 260,
76
+ left: 800,
77
+ width: 210,
78
+ height: 120,
79
+ backgroundImage: scrollPng,
80
+ }"
81
+ ></div>
82
+ <!-- 素材3 春联图 -->
83
+ <div
84
+ :style="{
85
+ top: 500,
86
+ left: 880,
87
+ width: 50,
88
+ height: 200,
89
+ backgroundImage: Couplets,
90
+ }"
91
+ ></div>
92
+ <!-- 提示 -->
93
+ <div
94
+ class="text"
95
+ :style="{ top: 40, left: 200, width: 150, height: 100 }"
96
+ >
97
+ {{ "春联效果" }}
98
+ </div>
99
+ <div
100
+ class="text"
101
+ :style="{ top: 40, left: 800, width: 210, height: 100 }"
102
+ >
103
+ {{ "素材1" }}
104
+ </div>
105
+ <div
106
+ class="text"
107
+ :style="{ top: 200, left: 800, width: 210, height: 100 }"
108
+ >
109
+ {{ "素材2" }}
110
+ </div>
111
+ <div
112
+ class="text"
113
+ :style="{ top: 440, left: 800, width: 210, height: 100 }"
114
+ >
115
+ {{ "素材3" }}
116
+ </div>
117
+ </div>
118
+ <!-- 鞭炮引线 第二页 -->
119
+ <div v-else-if="myIndex == 3">
120
+ <LeadWire :top="-580" :left="200"></LeadWire>
121
+ <div
122
+ class="text"
123
+ :style="{ top: 680, left: 980, width: 300, height: 60 }"
124
+ ></div>
125
+ </div>
126
+ <div v-else>
127
+ <Salvo></Salvo>
128
+ </div>
129
+ <!-- 翻页提示 -->
130
+ <div
131
+ class="text"
132
+ :style="{ top: 680, left: 980, width: 300, height: 60 }"
133
+ >
134
+ {{ `当前 ${myIndex}/3 页` }}
135
+ </div>
136
+ </div>
137
+ </jsv-focus-block>
138
+ </template>
139
+
140
+ <script setup>
141
+ import { JsvSpriteAnim } from "jsview";
142
+ import { shallowRef } from "vue";
143
+ import LeadWire from "./LeadWire.vue";
144
+ import Couplets from "./images/Couplets.png";
145
+ import scrollPng from "./Sprite/scroll.png";
146
+ import scrollJson from "./Sprite/scroll.json";
147
+ import { _formatInfo } from "./Common/SpriteDeal";
148
+ import scroll from "./images/scroll1.png";
149
+ import Salvo from "./Salvo.vue";
150
+ let sprite_info = shallowRef(_formatInfo(scrollJson));
151
+
152
+ const view_size = {
153
+ w: sprite_info.value.maxW,
154
+ h: sprite_info.value.maxH,
155
+ };
156
+
157
+ //页码
158
+ let myIndex = shallowRef(1);
159
+
160
+ //按键事件
161
+ const onKeyDown = (ev) => {
162
+ switch (ev.keyCode) {
163
+ case 37:
164
+ myIndex.value--;
165
+ if (myIndex.value <= 1) {
166
+ myIndex.value = 1;
167
+ }
168
+ break;
169
+ case 39:
170
+ myIndex.value++;
171
+ if (myIndex.value >= 3) {
172
+ myIndex.value = 3;
173
+ }
174
+ break;
175
+ default:
176
+ break;
177
+ }
178
+ };
179
+ </script>
180
+
181
+ <style scoped>
182
+ .bgStyle {
183
+ width: 1280;
184
+ height: 720;
185
+ background-color: #007788;
186
+ }
187
+ @keyframes recovery-clip {
188
+ 0% {
189
+ transform: translate3d(0, -500, 0);
190
+ }
191
+
192
+ 100% {
193
+ transform: translate3d(0, 0, 0);
194
+ }
195
+ }
196
+ @keyframes recovery-img {
197
+ 0% {
198
+ transform: translate3d(0, 500, 0);
199
+ }
200
+
201
+ 100% {
202
+ transform: translate3d(0, 0, 0);
203
+ }
204
+ }
205
+ .text {
206
+ font-size: 24;
207
+ color: #ffffff;
208
+ font-weight: bold;
209
+ text-align: center;
210
+ line-height: 32;
211
+ }
212
+ </style>
@@ -0,0 +1,30 @@
1
+ //精灵图信息函数
2
+ const _formatInfo = (action_json) => {
3
+ const info = {
4
+ frames: [],
5
+ meta: {
6
+ size: action_json.meta.size,
7
+ },
8
+ };
9
+ let frames_ref = info.frames;
10
+ let max_width = 0;
11
+ let max_height = 0;
12
+
13
+ for (let i = 0; i < action_json.frames.length; i++) {
14
+ const target = action_json.frames[i].spriteSourceSize;
15
+ frames_ref.push({
16
+ target,
17
+ source: action_json.frames[i].frame,
18
+ });
19
+ const sprite_with = target.x + target.w;
20
+ const sprite_height = target.y + target.h;
21
+ if (sprite_with > max_width) {
22
+ max_width = sprite_with;
23
+ }
24
+ if (sprite_height > max_height) {
25
+ max_height = sprite_height;
26
+ }
27
+ }
28
+ return { info, maxW: max_width, maxH: max_height };
29
+ };
30
+ export { _formatInfo }
@@ -0,0 +1,221 @@
1
+ <template>
2
+ <div
3
+ :style="{
4
+ top: props.top,
5
+ left: props.left,
6
+ width: 300,
7
+ height: 600,
8
+ overflow: 'hidden',
9
+ animation: 'recovery-clip 5s linear',
10
+ }"
11
+ >
12
+ <div
13
+ :style="{
14
+ top: 600,
15
+ left: 0,
16
+ width: 80,
17
+ height: 600,
18
+ backgroundImage: leadWire,
19
+ animation: 'recovery-img 5s linear',
20
+ }"
21
+ ></div>
22
+ </div>
23
+ <!-- 燃烧特效 -->
24
+ <div
25
+ v-if="isSpark"
26
+ :style="{
27
+ top: props.top + 590,
28
+ left: props.left + 31,
29
+ animation: 'recovery-clip 5s linear',
30
+ }"
31
+ @animationend="closeSpark"
32
+ >
33
+ <div :style="{
34
+ transform: `scale3d(${20 / view_size.w},${20 / view_size.h},1)`,}">
35
+ <JsvSpriteAnim
36
+ :spriteInfo="sprite_info.info"
37
+ :loop="'infinite'"
38
+ autostart="true"
39
+ :duration="0.1"
40
+ :imageUrl="sparkPng"
41
+ >
42
+ </JsvSpriteAnim>
43
+ </div>
44
+
45
+ </div>
46
+ <Maroon
47
+ v-for="(item, index) in spriteArray"
48
+ :top="index == spriteArray.length - 1 ? -10 : props.top + 1100 - index * 50"
49
+ :left="props.left + 10"
50
+ :deg="index % 2 == 0 ? 30 : -30"
51
+ :ref="(el) => (RefArray[index] = el)"
52
+ :myRef="spriteArray[index]"
53
+ ></Maroon>
54
+ <!-- 素材展示 -->
55
+ <!-- 素材1 火花精灵图-->
56
+ <div
57
+ :style="{
58
+ top: 100,
59
+ left: 600,
60
+ width: 210,
61
+ height: 120,
62
+ backgroundImage: sparkPng,
63
+ }"
64
+ ></div>
65
+ <!-- 素材2 炮仗精灵图 -->
66
+ <div
67
+ :style="{
68
+ top: 300,
69
+ left: 600,
70
+ width: 210,
71
+ height: 120,
72
+ backgroundImage: firecrackerPng,
73
+ }"
74
+ ></div>
75
+ <!-- 素材3 引线图 -->
76
+ <div
77
+ :style="{
78
+ top: 520,
79
+ left: 650,
80
+ width: 100,
81
+ height: 150,
82
+ backgroundImage: leadWire,
83
+ }"
84
+ ></div>
85
+ <!-- 素材4 红色星星 -->
86
+ <div
87
+ :style="{
88
+ top: 100,
89
+ left: 900,
90
+ width: 210,
91
+ height: 120,
92
+ backgroundImage: redStar,
93
+ }"
94
+ ></div>
95
+ <!-- 素材5 黄色星星 -->
96
+ <div
97
+ :style="{
98
+ top: 300,
99
+ left: 900,
100
+ width: 210,
101
+ height: 120,
102
+ backgroundImage: yellowStar,
103
+ }"
104
+ ></div>
105
+ <!-- 素材6 紫色星星 -->
106
+ <div
107
+ :style="{
108
+ top: 520,
109
+ left: 900,
110
+ width: 210,
111
+ height: 120,
112
+ backgroundImage: purpleStar,
113
+ }"
114
+ ></div>
115
+ <!-- 说明 -->
116
+ <div class="text" :style="{ top: 40, left: 600, width: 210, height: 100 }">
117
+ {{ "素材1" }}
118
+ </div>
119
+ <div class="text" :style="{ top: 240, left: 600, width: 210, height: 100 }">
120
+ {{ "素材2" }}
121
+ </div>
122
+ <div class="text" :style="{ top: 460, left: 600, width: 210, height: 100 }">
123
+ {{ "素材3" }}
124
+ </div>
125
+ <div class="text" :style="{ top: 40, left: 900, width: 210, height: 100 }">
126
+ {{ "素材4" }}
127
+ </div>
128
+ <div class="text" :style="{ top: 240, left: 900, width: 210, height: 100 }">
129
+ {{ "素材5" }}
130
+ </div>
131
+ <div class="text" :style="{ top: 460, left: 900, width: 210, height: 100 }">
132
+ {{ "素材6" }}
133
+ </div>
134
+ </template>
135
+
136
+ <script setup>
137
+ import Maroon from "./Maroon.vue";
138
+ import { shallowRef, onMounted } from "vue";
139
+ import leadWire from "./images/leadWire.png";
140
+ import { JsvSpriteAnim } from "jsview";
141
+ import { _formatInfo } from "./Common/SpriteDeal";
142
+ import sparkPng from "./Sprite/spark.png";
143
+ import sparkJson from "./Sprite/spark.json";
144
+ import firecrackerPng from "./Sprite/firecracker.png";
145
+ import redStar from "./images/redStar.png";
146
+ import yellowStar from "./images/yellowStar.png";
147
+ import purpleStar from "./images/purpleStar.png";
148
+ const props = defineProps({
149
+ top: Number,
150
+ left: Number,
151
+ });
152
+ let sprite_info = shallowRef(_formatInfo(sparkJson));
153
+ const view_size = {
154
+ w: sprite_info.value.maxW,
155
+ h: sprite_info.value.maxH,
156
+ };
157
+ //控制燃烧特效
158
+ let isSpark = shallowRef(true);
159
+ const closeSpark = () => {
160
+ isSpark.value = false;
161
+ };
162
+ //ref数组
163
+ const spriteArray = new Array(12);
164
+ let RefArray = shallowRef([]);
165
+ for (let i = 0; i < spriteArray.length; i++) {
166
+ spriteArray[i] = shallowRef(null);
167
+ }
168
+
169
+ const callFireMethod = (index) => {
170
+ // 检查索引是否超出范围,如果超出则停止递归
171
+ if (index >= spriteArray.length) {
172
+ return;
173
+ }
174
+
175
+ // 获取当前索引对应的Maroon组件的ref
176
+ const currentMaroonRef = RefArray.value[index];
177
+ // 调用当前Maroon组件的fire方法
178
+ if (currentMaroonRef) {
179
+ currentMaroonRef.fire();
180
+ }
181
+ // 延迟1秒后递归调用下一个Maroon组件的fire方法
182
+ setTimeout(() => {
183
+ callFireMethod(index + 1);
184
+ }, 400);
185
+ };
186
+
187
+ onMounted(() => {
188
+ setTimeout(() => {
189
+ // 调用递归函数,传入初始索引0
190
+ callFireMethod(0);
191
+ }, 500);
192
+ });
193
+ </script>
194
+
195
+ <style scoped>
196
+ @keyframes recovery-clip {
197
+ 0% {
198
+ transform: translate3d(0, 600, 0);
199
+ }
200
+
201
+ 100% {
202
+ transform: translate3d(0, 0, 0);
203
+ }
204
+ }
205
+ @keyframes recovery-img {
206
+ 0% {
207
+ transform: translate3d(0, -600, 0);
208
+ }
209
+
210
+ 100% {
211
+ transform: translate3d(0, 0, 0);
212
+ }
213
+ }
214
+ .text {
215
+ font-size: 24;
216
+ color: #ffffff;
217
+ font-weight: bold;
218
+ text-align: center;
219
+ line-height: 32;
220
+ }
221
+ </style>
@@ -0,0 +1,112 @@
1
+ <template>
2
+ <div
3
+ :style="{
4
+ top: myTop,
5
+ left: props.left,
6
+ width: 30,
7
+ height: 60,
8
+ transition: 'top 1.5s',
9
+ }"
10
+ @transitionend="myTransitionEnd"
11
+ >
12
+ <div
13
+ :style="{
14
+ width: 30,
15
+ height: 60,
16
+ transform: `rotate3d(0,0,1,${deg}deg) scale3d(${40 / view_size.w},${
17
+ 40 / view_size.w
18
+ },1)`,
19
+ transformOrigin:'center center',
20
+ }"
21
+ >
22
+ <!-- 炮仗图 -->
23
+ <JsvSpriteAnim
24
+ :spriteInfo="sprite_info.info"
25
+ :loop="1"
26
+ :duration="0.8"
27
+ :imageUrl="firecrackerPng"
28
+ :controller="props.controller"
29
+ :onAnimEnd="onAnimEnd"
30
+ :ref="props.myRef"
31
+ >
32
+ </JsvSpriteAnim>
33
+ <!-- 喷射粒子 -->
34
+ <div
35
+ v-if="isSpray"
36
+ :style="{
37
+ top: view_size.h/2,
38
+ left: view_size.w/2,
39
+ width:view_size.w,
40
+ height:view_size.h,
41
+ }"
42
+ >
43
+ <jsv-spray
44
+ v-for="item in ImgData"
45
+ :pointRes="`url(${item})`"
46
+ :sprayStyle="sprayOk"
47
+ :ignoreClip="true"
48
+ />
49
+ </div>
50
+ </div>
51
+ </div>
52
+ </template>
53
+
54
+ <script setup>
55
+ import { shallowRef } from "vue";
56
+ import { JsvSpriteAnim, JsvSpray } from "jsview";
57
+ import firecrackerJson from "./Sprite/firecracker.json";
58
+ import firecrackerPng from "./Sprite/firecracker.png";
59
+ import { _formatInfo } from "./Common/SpriteDeal";
60
+ import redStar from "./images/redStar.png";
61
+ import yellowStar from "./images/yellowStar.png";
62
+ import purpleStar from "./images/purpleStar.png";
63
+ const props = defineProps({
64
+ top: Number,
65
+ left: Number,
66
+ deg: Number,
67
+ controller: Object,
68
+ myRef: Object,
69
+ });
70
+ let myTop = shallowRef(props.top);
71
+ let sprite_info = shallowRef(_formatInfo(firecrackerJson));
72
+ const view_size = {
73
+ w: sprite_info.value.maxW,
74
+ h: sprite_info.value.maxH,
75
+ };
76
+ let isShow = shallowRef(true);
77
+ let isSpray = shallowRef(false);
78
+ let deg = shallowRef(props.deg);
79
+ //动画处理
80
+ const fire = () => {
81
+ myTop.value += 300;
82
+ props.myRef.value.start();
83
+ };
84
+ //粒子效果
85
+ const ImgData = [redStar, yellowStar, purpleStar];
86
+ const sprayOk = {
87
+ type: 0,
88
+ particleNum: 100,
89
+ deltaAngle: 360,
90
+ deltaWidth: 20,
91
+ deltaHeight: 20,
92
+ pointSizeMin: 20,
93
+ pointSizeMax: 30,
94
+ speedMin: 1,
95
+ speedMax: 7,
96
+ lifeMin: 1000,
97
+ lifeMax: 2000,
98
+ accelerateX: 0,
99
+ accelerateY: 0,
100
+ addNumSpeed: 0.001,
101
+ enableFade: true,
102
+ enableShrink: true,
103
+ };
104
+ //动画结束播放粒子效果
105
+ const onAnimEnd = () => {
106
+ isShow.value = false;
107
+ isSpray.value = true;
108
+ };
109
+ defineExpose({ fire });
110
+ </script>
111
+
112
+ <style scoped></style>