sh-chart 1.5.2

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 (87) hide show
  1. package/.eslintrc.js +21 -0
  2. package/README.en.md +36 -0
  3. package/README.md +39 -0
  4. package/package.json +42 -0
  5. package/packages/components/global-components/mixin/autoResize.js +152 -0
  6. package/packages/components/global-components/sh-border/components/border1.vue +70 -0
  7. package/packages/components/global-components/sh-border/components/border10.vue +54 -0
  8. package/packages/components/global-components/sh-border/components/border11.vue +207 -0
  9. package/packages/components/global-components/sh-border/components/border12.vue +112 -0
  10. package/packages/components/global-components/sh-border/components/border13.vue +50 -0
  11. package/packages/components/global-components/sh-border/components/border2.vue +50 -0
  12. package/packages/components/global-components/sh-border/components/border3.vue +53 -0
  13. package/packages/components/global-components/sh-border/components/border4.vue +95 -0
  14. package/packages/components/global-components/sh-border/components/border5.vue +64 -0
  15. package/packages/components/global-components/sh-border/components/border6.vue +60 -0
  16. package/packages/components/global-components/sh-border/components/border7.vue +57 -0
  17. package/packages/components/global-components/sh-border/components/border8.vue +75 -0
  18. package/packages/components/global-components/sh-border/components/border9.vue +92 -0
  19. package/packages/components/global-components/sh-border/index.vue +73 -0
  20. package/packages/components/global-components/sh-border/mixin/border.js +62 -0
  21. package/packages/components/global-components/sh-charts/config/config.js +58 -0
  22. package/packages/components/global-components/sh-charts/index.vue +169 -0
  23. package/packages/components/global-components/sh-decoration/components/decoration1.vue +81 -0
  24. package/packages/components/global-components/sh-decoration/components/decoration10.vue +80 -0
  25. package/packages/components/global-components/sh-decoration/components/decoration11.vue +63 -0
  26. package/packages/components/global-components/sh-decoration/components/decoration12.vue +171 -0
  27. package/packages/components/global-components/sh-decoration/components/decoration2.vue +78 -0
  28. package/packages/components/global-components/sh-decoration/components/decoration3.vue +65 -0
  29. package/packages/components/global-components/sh-decoration/components/decoration4.vue +72 -0
  30. package/packages/components/global-components/sh-decoration/components/decoration5.vue +96 -0
  31. package/packages/components/global-components/sh-decoration/components/decoration6.vue +84 -0
  32. package/packages/components/global-components/sh-decoration/components/decoration7.vue +31 -0
  33. package/packages/components/global-components/sh-decoration/components/decoration8.vue +32 -0
  34. package/packages/components/global-components/sh-decoration/components/decoration9.vue +63 -0
  35. package/packages/components/global-components/sh-decoration/index.vue +71 -0
  36. package/packages/components/global-components/sh-decoration/mixin/decoration.js +69 -0
  37. package/packages/components/global-components/sh-screen-header/components/header1.vue +228 -0
  38. package/packages/components/global-components/sh-screen-header/components/header2.vue +285 -0
  39. package/packages/components/global-components/sh-screen-header/components/header3.vue +452 -0
  40. package/packages/components/global-components/sh-screen-header/components/header4.vue +544 -0
  41. package/packages/components/global-components/sh-screen-header/components/header5.vue +291 -0
  42. package/packages/components/global-components/sh-screen-header/components/header6.vue +206 -0
  43. package/packages/components/global-components/sh-screen-header/index.vue +50 -0
  44. package/packages/components/global-components/sh-screen-header/mixin/header.js +62 -0
  45. package/packages/components/global-components/sh-spin/index.vue +44 -0
  46. package/packages/components/index.js +24 -0
  47. package/packages/echarts/index.js +94 -0
  48. package/packages/echarts/map/110000.json +1 -0
  49. package/packages/echarts/map/120000.json +1 -0
  50. package/packages/echarts/map/130000.json +1 -0
  51. package/packages/echarts/map/140000.json +1 -0
  52. package/packages/echarts/map/150000.json +1 -0
  53. package/packages/echarts/map/210000.json +1 -0
  54. package/packages/echarts/map/220000.json +1 -0
  55. package/packages/echarts/map/230000.json +1 -0
  56. package/packages/echarts/map/310000.json +1 -0
  57. package/packages/echarts/map/320000.json +1 -0
  58. package/packages/echarts/map/330000.json +1 -0
  59. package/packages/echarts/map/340000.json +1 -0
  60. package/packages/echarts/map/350000.json +1 -0
  61. package/packages/echarts/map/360000.json +1 -0
  62. package/packages/echarts/map/370000.json +1 -0
  63. package/packages/echarts/map/410000.json +1 -0
  64. package/packages/echarts/map/420000.json +1 -0
  65. package/packages/echarts/map/430000.json +1 -0
  66. package/packages/echarts/map/440000.json +1 -0
  67. package/packages/echarts/map/450000.json +1 -0
  68. package/packages/echarts/map/460000.json +1 -0
  69. package/packages/echarts/map/500000.json +1 -0
  70. package/packages/echarts/map/510000.json +1 -0
  71. package/packages/echarts/map/520000.json +1 -0
  72. package/packages/echarts/map/530000.json +1 -0
  73. package/packages/echarts/map/540000.json +1 -0
  74. package/packages/echarts/map/610000.json +1 -0
  75. package/packages/echarts/map/620000.json +1 -0
  76. package/packages/echarts/map/630000.json +1 -0
  77. package/packages/echarts/map/640000.json +1 -0
  78. package/packages/echarts/map/650000.json +1 -0
  79. package/packages/echarts/map/710000.json +1 -0
  80. package/packages/echarts/map/china.json +1 -0
  81. package/packages/echarts/theme/dark.js +128 -0
  82. package/packages/echarts/theme/infographic.js +181 -0
  83. package/packages/echarts/theme/macarons.js +194 -0
  84. package/packages/echarts/theme/roma.js +66 -0
  85. package/packages/echarts/theme/shine.js +136 -0
  86. package/packages/echarts/theme/vintage.js +11 -0
  87. package/packages/index.js +31 -0
@@ -0,0 +1,171 @@
1
+ <template>
2
+ <div :ref="ref" class="sh-decoration-12">
3
+ <svg :width="width" :height="height">
4
+ <defs>
5
+ <g :id="gId">
6
+ <path v-for="(d, i) in pathD" :key="d" :stroke="pathColor[i]" :stroke-width="width / 2" fill="transparent" :d="d" />
7
+ </g>
8
+ <radialGradient :id="gradientId" cx="50%" cy="50%" r="50%">
9
+ <stop offset="0%" stop-color="transparent" stop-opacity="1" />
10
+ <stop offset="100%" :stop-color="fade(mergedColor[1] || defaultColor[1], 30)" stop-opacity="1" />
11
+ </radialGradient>
12
+ </defs>
13
+
14
+ <circle v-for="r in circleR" :key="r" :r="r" :cx="x" :cy="y" :stroke="mergedColor[1]" :stroke-width="0.5" fill="transparent" />
15
+
16
+ <circle r="1" :cx="x" :cy="y" stroke="transparent" :fill="`url(#${gradientId})`">
17
+ <animate attributeName="r" :values="`1;${width / 2}`" :dur="`${haloDur}s`" repeatCount="indefinite" />
18
+ <animate attributeName="opacity" values="1;0" :dur="`${haloDur}s`" repeatCount="indefinite" />
19
+ </circle>
20
+
21
+ <circle r="2" :cx="x" :cy="y" :fill="mergedColor[1]" />
22
+
23
+ <g v-if="showSplitLine">
24
+ <polyline v-for="p in splitLinePoints" :key="p" :points="p" :stroke="mergedColor[1]" :stroke-width="0.5" opacity="0.5" />
25
+ </g>
26
+
27
+ <path v-for="d in arcD" :key="d" :d="d" :stroke="mergedColor[1]" stroke-width="2" fill="transparent" />
28
+
29
+ <use :xlink:href="`#${gId}`">
30
+ <animateTransform attributeName="transform" type="rotate" :values="`0, ${x} ${y};360, ${x} ${y}`" :dur="`${scanDur}s`" repeatCount="indefinite" />
31
+ </use>
32
+ </svg>
33
+
34
+ <div class="decoration-content">
35
+ <slot></slot>
36
+ </div>
37
+ </div>
38
+ </template>
39
+
40
+ <script>
41
+ import mixin from '../mixin/decoration'
42
+ export default {
43
+ name: 'ShDecoration12',
44
+ mixins: [mixin],
45
+ props: {
46
+ /**
47
+ * @description Scan animation dur
48
+ */
49
+ scanDur: {
50
+ type: Number,
51
+ default: 3
52
+ },
53
+ /**
54
+ * @description Halo animation dur
55
+ */
56
+ haloDur: {
57
+ type: Number,
58
+ default: 2
59
+ }
60
+ },
61
+ data() {
62
+ return {
63
+ pathD: [],
64
+ pathColor: [],
65
+ circleR: [],
66
+ splitLinePoints: [],
67
+ arcD: [],
68
+ segment: 30,
69
+ sectorAngle: Math.PI / 3,
70
+ ringNum: 3,
71
+ ringWidth: 1,
72
+ showSplitLine: true
73
+ }
74
+ },
75
+ computed: {
76
+ gId() {
77
+ return `decoration-12-g-${this.decorationId}`
78
+ },
79
+ gradientId() {
80
+ return `decoration-12-gradient-${this.decorationId}`
81
+ },
82
+ x() {
83
+ const { width } = this
84
+ return width / 2
85
+ },
86
+ y() {
87
+ const { height } = this
88
+ return height / 2
89
+ }
90
+ },
91
+ methods: {
92
+ calcSVGData() {
93
+ const { calcPathD, calcPathColor, calcCircleR, calcSplitLinePoints, calcArcD } = this
94
+ calcPathD()
95
+ calcPathColor()
96
+ calcCircleR()
97
+ calcSplitLinePoints()
98
+ calcArcD()
99
+ },
100
+ calcPathD() {
101
+ const { x, y, width, segment, sectorAngle } = this
102
+ const startAngle = -Math.PI / 2
103
+ const angleGap = sectorAngle / segment
104
+ const r = width / 4
105
+ let lastEndPoints = this.getCircleRadianPoint(x, y, r, startAngle)
106
+ this.pathD = new Array(segment).fill('').map((_, i) => {
107
+ const endPoints = this.getCircleRadianPoint(x, y, r, startAngle - (i + 1) * angleGap).map(_ => _.toFixed(5))
108
+ const d = `M${lastEndPoints.join(',')} A${r}, ${r} 0 0 0 ${endPoints.join(',')}`
109
+ lastEndPoints = endPoints
110
+ return d
111
+ })
112
+ },
113
+ calcPathColor() {
114
+ const {
115
+ mergedColor: [color],
116
+ segment
117
+ } = this
118
+ const colorGap = 100 / (segment - 1)
119
+ this.pathColor = new Array(segment).fill(color).map((_, i) => this.fade(color, 100 - i * colorGap))
120
+ },
121
+ calcCircleR() {
122
+ const { segment, ringNum, width, ringWidth } = this
123
+ const radiusGap = (width / 2 - ringWidth / 2) / ringNum
124
+ this.circleR = new Array(ringNum).fill(0).map((_, i) => radiusGap * (i + 1))
125
+ },
126
+ calcSplitLinePoints() {
127
+ const { x, y, width } = this
128
+ const angleGap = Math.PI / 6
129
+ const r = width / 2
130
+ this.splitLinePoints = new Array(6).fill('').map((_, i) => {
131
+ const startAngle = angleGap * (i + 1)
132
+ const endAngle = startAngle + Math.PI
133
+ const startPoint = this.getCircleRadianPoint(x, y, r, startAngle)
134
+ const endPoint = this.getCircleRadianPoint(x, y, r, endAngle)
135
+ return `${startPoint.join(',')} ${endPoint.join(',')}`
136
+ })
137
+ },
138
+ calcArcD() {
139
+ const { x, y, width } = this
140
+ const angleGap = Math.PI / 6
141
+ const r = width / 2 - 1
142
+ this.arcD = new Array(4).fill('').map((_, i) => {
143
+ const startAngle = angleGap * (3 * i + 1)
144
+ const endAngle = startAngle + angleGap
145
+ const startPoint = this.getCircleRadianPoint(x, y, r, startAngle)
146
+ const endPoint = this.getCircleRadianPoint(x, y, r, endAngle)
147
+ return `M${startPoint.join(',')} A${x}, ${y} 0 0 1 ${endPoint.join(',')}`
148
+ })
149
+ }
150
+ }
151
+ }
152
+ </script>
153
+
154
+ <style scoped lang="scss">
155
+ .sh-decoration-12 {
156
+ position: relative;
157
+ width: 100%;
158
+ height: 100%;
159
+ display: flex;
160
+ .decoration-content {
161
+ position: absolute;
162
+ top: 0px;
163
+ left: 0px;
164
+ width: 100%;
165
+ height: 100%;
166
+ display: flex;
167
+ align-items: center;
168
+ justify-content: center;
169
+ }
170
+ }
171
+ </style>
@@ -0,0 +1,78 @@
1
+ <template>
2
+ <div :ref="ref" class="sh-decoration-2">
3
+ <svg :width="`${width}px`" :height="`${height}px`">
4
+ <rect :x="x" :y="y" :width="w" :height="h" :fill="mergedColor[0]">
5
+ <animate
6
+ :attributeName="reverse ? 'height' : 'width'"
7
+ from="0"
8
+ :to="reverse ? height : width"
9
+ :dur="`${dur}s`"
10
+ calcMode="spline"
11
+ keyTimes="0;1"
12
+ keySplines=".42,0,.58,1"
13
+ repeatCount="indefinite" />
14
+ </rect>
15
+
16
+ <rect :x="x" :y="y" width="1" height="1" :fill="mergedColor[1]">
17
+ <animate
18
+ :attributeName="reverse ? 'y' : 'x'"
19
+ from="0"
20
+ :to="reverse ? height : width"
21
+ :dur="`${dur}s`"
22
+ calcMode="spline"
23
+ keyTimes="0;1"
24
+ keySplines="0.42,0,0.58,1"
25
+ repeatCount="indefinite" />
26
+ </rect>
27
+ </svg>
28
+ </div>
29
+ </template>
30
+
31
+ <script>
32
+ import mixin from '../mixin/decoration'
33
+ export default {
34
+ name: 'ShDecoration2',
35
+ mixins: [mixin],
36
+ props: {
37
+ dur: {
38
+ type: Number,
39
+ default: 6
40
+ }
41
+ },
42
+ data() {
43
+ return {
44
+ x: 0,
45
+ y: 0,
46
+
47
+ w: 0,
48
+ h: 0
49
+ }
50
+ },
51
+ methods: {
52
+ calcSVGData() {
53
+ const { reverse, width, height } = this
54
+ if (reverse) {
55
+ this.w = 1
56
+ this.h = height
57
+ this.x = width / 2
58
+ this.y = 0
59
+ } else {
60
+ this.w = width
61
+ this.h = 1
62
+ this.x = 0
63
+ this.y = height / 2
64
+ }
65
+ }
66
+ }
67
+ }
68
+ </script>
69
+
70
+ <style scoped lang="scss">
71
+ .sh-decoration-2 {
72
+ display: flex;
73
+ width: 100%;
74
+ height: 100%;
75
+ justify-content: center;
76
+ align-items: center;
77
+ }
78
+ </style>
@@ -0,0 +1,65 @@
1
+ <template>
2
+ <div :ref="ref" class="sh-decoration-3">
3
+ <svg :width="`${svgWH[0]}px`" :height="`${svgWH[1]}px`" :style="`transform:scale(${svgScale[0]},${svgScale[1]});`">
4
+ <template v-for="(point, i) in points" :key="i">
5
+ <rect v-if="Math.random() > 0.6" :fill="mergedColor[0]" :x="point[0] - halfPointSideLength" :y="point[1] - halfPointSideLength" :width="pointSideLength" :height="pointSideLength">
6
+ <animate attributeName="fill" :values="`${mergedColor.join(';')}`" :dur="Math.random() + 1 + 's'" :begin="Math.random() * 2" repeatCount="indefinite" />
7
+ </rect>
8
+ </template>
9
+ </svg>
10
+ </div>
11
+ </template>
12
+
13
+ <script>
14
+ import mixin from '../mixin/decoration'
15
+ export default {
16
+ name: 'ShDecoration3',
17
+ mixins: [mixin],
18
+ data() {
19
+ const pointSideLength = 7
20
+ return {
21
+ svgWH: [300, 35],
22
+
23
+ svgScale: [1, 1],
24
+
25
+ rowNum: 2,
26
+ rowPoints: 25,
27
+
28
+ pointSideLength,
29
+ halfPointSideLength: pointSideLength / 2,
30
+
31
+ points: []
32
+ }
33
+ },
34
+ methods: {
35
+ calcSVGData() {
36
+ const { calcPointsPosition, calcScale } = this
37
+ calcPointsPosition()
38
+ calcScale()
39
+ },
40
+ calcPointsPosition() {
41
+ const { svgWH, rowNum, rowPoints } = this
42
+ const [w, h] = svgWH
43
+ const horizontalGap = w / (rowPoints + 1)
44
+ const verticalGap = h / (rowNum + 1)
45
+ let points = new Array(rowNum).fill(0).map((foo, i) => new Array(rowPoints).fill(0).map((foo, j) => [horizontalGap * (j + 1), verticalGap * (i + 1)]))
46
+ this.points = points.reduce((all, item) => [...all, ...item], [])
47
+ },
48
+ calcScale() {
49
+ const { width, height, svgWH } = this
50
+ const [w, h] = svgWH
51
+ this.svgScale = [width / w, height / h]
52
+ }
53
+ }
54
+ }
55
+ </script>
56
+
57
+ <style scoped lang="scss">
58
+ .sh-decoration-3 {
59
+ width: 100%;
60
+ height: 100%;
61
+ svg {
62
+ transform-origin: left top;
63
+ }
64
+ }
65
+ </style>
@@ -0,0 +1,72 @@
1
+ <template>
2
+ <div :ref="ref" class="sh-decoration-4">
3
+ <div
4
+ :class="`container ${reverse ? 'reverse' : 'normal'}`"
5
+ :style="reverse ? `width:${width}px;height:5px;animation-duration:${dur}s` : `width:5px;height:${height}px;animation-duration:${dur}s`">
6
+ <svg :width="reverse ? width : 5" :height="reverse ? 5 : height">
7
+ <polyline :stroke="mergedColor[0]" :points="reverse ? `0, 2.5 ${width}, 2.5` : `2.5, 0 2.5, ${height}`" />
8
+ <polyline
9
+ class="bold-line"
10
+ :stroke="mergedColor[1]"
11
+ stroke-width="3"
12
+ stroke-dasharray="20, 80"
13
+ stroke-dashoffset="-30"
14
+ :points="reverse ? `0, 2.5 ${width}, 2.5` : `2.5, 0 2.5, ${height}`" />
15
+ </svg>
16
+ </div>
17
+ </div>
18
+ </template>
19
+
20
+ <script>
21
+ import mixin from '../mixin/decoration'
22
+ export default {
23
+ name: 'ShDecoration4',
24
+ mixins: [mixin]
25
+ }
26
+ </script>
27
+
28
+ <style scoped lang="scss">
29
+ .sh-decoration-4 {
30
+ position: relative;
31
+ width: 100%;
32
+ height: 100%;
33
+ .container {
34
+ display: flex;
35
+ overflow: hidden;
36
+ position: absolute;
37
+ flex: 1;
38
+ }
39
+ .normal {
40
+ animation: ani-height ease-in-out infinite;
41
+ left: 50%;
42
+ margin-left: -2px;
43
+ }
44
+ .reverse {
45
+ animation: ani-width ease-in-out infinite;
46
+ top: 50%;
47
+ margin-top: -2px;
48
+ }
49
+ @keyframes ani-height {
50
+ 0% {
51
+ height: 0%;
52
+ }
53
+ 70% {
54
+ height: 100%;
55
+ }
56
+ 100% {
57
+ height: 100%;
58
+ }
59
+ }
60
+ @keyframes ani-width {
61
+ 0% {
62
+ width: 0%;
63
+ }
64
+ 70% {
65
+ width: 100%;
66
+ }
67
+ 100% {
68
+ width: 100%;
69
+ }
70
+ }
71
+ }
72
+ </style>
@@ -0,0 +1,96 @@
1
+ <template>
2
+ <div :ref="ref" class="sh-decoration-5">
3
+ <svg :width="width" :height="height">
4
+ <polyline fill="transparent" :stroke="mergedColor[0]" stroke-width="3" :points="line1Points">
5
+ <animate
6
+ attributeName="stroke-dasharray"
7
+ attributeType="XML"
8
+ :from="`0, ${line1Length / 2}, 0, ${line1Length / 2}`"
9
+ :to="`0, 0, ${line1Length}, 0`"
10
+ :dur="`${dur}s`"
11
+ begin="0s"
12
+ calcMode="spline"
13
+ keyTimes="0;1"
14
+ keySplines="0.4,1,0.49,0.98"
15
+ repeatCount="indefinite" />
16
+ </polyline>
17
+ <polyline fill="transparent" :stroke="mergedColor[1]" stroke-width="2" :points="line2Points">
18
+ <animate
19
+ attributeName="stroke-dasharray"
20
+ attributeType="XML"
21
+ :from="`0, ${line2Length / 2}, 0, ${line2Length / 2}`"
22
+ :to="`0, 0, ${line2Length}, 0`"
23
+ :dur="`${dur}s`"
24
+ begin="0s"
25
+ calcMode="spline"
26
+ keyTimes="0;1"
27
+ keySplines=".4,1,.49,.98"
28
+ repeatCount="indefinite" />
29
+ </polyline>
30
+ </svg>
31
+ </div>
32
+ </template>
33
+
34
+ <script>
35
+ import mixin from '../mixin/decoration'
36
+ export default {
37
+ name: 'ShDecoration5',
38
+ mixins: [mixin],
39
+ props: {
40
+ dur: {
41
+ type: Number,
42
+ default: 1.2
43
+ }
44
+ },
45
+ data() {
46
+ return {
47
+ line1Points: '',
48
+ line2Points: '',
49
+ line1Length: 0,
50
+ line2Length: 0
51
+ }
52
+ },
53
+ methods: {
54
+ calcSVGData() {
55
+ const { width, height } = this
56
+
57
+ let line1Points = [
58
+ [0, height * 0.2],
59
+ [width * 0.18, height * 0.2],
60
+ [width * 0.2, height * 0.4],
61
+ [width * 0.25, height * 0.4],
62
+ [width * 0.27, height * 0.6],
63
+ [width * 0.72, height * 0.6],
64
+ [width * 0.75, height * 0.4],
65
+ [width * 0.8, height * 0.4],
66
+ [width * 0.82, height * 0.2],
67
+ [width, height * 0.2]
68
+ ]
69
+
70
+ let line2Points = [
71
+ [width * 0.3, height * 0.8],
72
+ [width * 0.7, height * 0.8]
73
+ ]
74
+
75
+ const line1Length = this.getPolylineLength(line1Points)
76
+ const line2Length = this.getPolylineLength(line2Points)
77
+
78
+ line1Points = line1Points.map(point => point.join(',')).join(' ')
79
+ line2Points = line2Points.map(point => point.join(',')).join(' ')
80
+
81
+ this.line1Points = line1Points
82
+ this.line2Points = line2Points
83
+
84
+ this.line1Length = line1Length
85
+ this.line2Length = line2Length
86
+ }
87
+ }
88
+ }
89
+ </script>
90
+
91
+ <style scoped lang="scss">
92
+ .sh-decoration-5 {
93
+ width: 100%;
94
+ height: 100%;
95
+ }
96
+ </style>
@@ -0,0 +1,84 @@
1
+ <template>
2
+ <div :ref="ref" class="sh-decoration-6">
3
+ <svg :width="`${svgWH[0]}px`" :height="`${svgWH[1]}px`" :style="`transform:scale(${svgScale[0]},${svgScale[1]});`">
4
+ <template v-for="(point, i) in points" :key="i">
5
+ <rect :fill="mergedColor[Math.random() > 0.5 ? 0 : 1]" :x="point[0] - halfRectWidth" :y="point[1] - heights[i] / 2" :width="rectWidth" :height="heights[i]">
6
+ <animate
7
+ attributeName="y"
8
+ :values="`${point[1] - minHeights[i] / 2};${point[1] - heights[i] / 2};${point[1] - minHeights[i] / 2}`"
9
+ :dur="`${randoms[i]}s`"
10
+ keyTimes="0;0.5;1"
11
+ calcMode="spline"
12
+ keySplines="0.42,0,0.58,1;0.42,0,0.58,1"
13
+ begin="0s"
14
+ repeatCount="indefinite" />
15
+ <animate
16
+ attributeName="height"
17
+ :values="`${minHeights[i]};${heights[i]};${minHeights[i]}`"
18
+ :dur="`${randoms[i]}s`"
19
+ keyTimes="0;0.5;1"
20
+ calcMode="spline"
21
+ keySplines="0.42,0,0.58,1;0.42,0,0.58,1"
22
+ begin="0s"
23
+ repeatCount="indefinite" />
24
+ </rect>
25
+ </template>
26
+ </svg>
27
+ </div>
28
+ </template>
29
+
30
+ <script>
31
+ import mixin from '../mixin/decoration'
32
+ export default {
33
+ name: 'ShDecoration6',
34
+ mixins: [mixin],
35
+ data() {
36
+ const rectWidth = 7
37
+ return {
38
+ svgWH: [300, 35],
39
+ svgScale: [1, 1],
40
+ rowNum: 1,
41
+ rowPoints: 40,
42
+ rectWidth,
43
+ halfRectWidth: rectWidth / 2,
44
+ points: [],
45
+ heights: [],
46
+ minHeights: [],
47
+ randoms: []
48
+ }
49
+ },
50
+ methods: {
51
+ calcSVGData() {
52
+ const { calcPointsPosition, calcScale } = this
53
+ calcPointsPosition()
54
+ calcScale()
55
+ },
56
+ calcPointsPosition() {
57
+ const { svgWH, rowNum, rowPoints, randomExtend } = this
58
+ const [w, h] = svgWH
59
+ const horizontalGap = w / (rowPoints + 1)
60
+ const verticalGap = h / (rowNum + 1)
61
+ let points = new Array(rowNum).fill(0).map((foo, i) => new Array(rowPoints).fill(0).map((foo, j) => [horizontalGap * (j + 1), verticalGap * (i + 1)]))
62
+ this.points = points.reduce((all, item) => [...all, ...item], [])
63
+ const heights = (this.heights = new Array(rowNum * rowPoints).fill(0).map(foo => (Math.random() > 0.8 ? randomExtend(0.7 * h, h) : randomExtend(0.2 * h, 0.5 * h))))
64
+ this.minHeights = new Array(rowNum * rowPoints).fill(0).map((foo, i) => heights[i] * Math.random())
65
+ this.randoms = new Array(rowNum * rowPoints).fill(0).map(foo => Math.random() + 1.5)
66
+ },
67
+ calcScale() {
68
+ const { width, height, svgWH } = this
69
+ const [w, h] = svgWH
70
+ this.svgScale = [width / w, height / h]
71
+ }
72
+ }
73
+ }
74
+ </script>
75
+
76
+ <style scoped lang="scss">
77
+ .sh-decoration-6 {
78
+ width: 100%;
79
+ height: 100%;
80
+ svg {
81
+ transform-origin: left top;
82
+ }
83
+ }
84
+ </style>
@@ -0,0 +1,31 @@
1
+ <template>
2
+ <div :ref="ref" class="sh-decoration-7">
3
+ <svg width="21px" height="20px">
4
+ <polyline stroke-width="4" fill="transparent" :stroke="mergedColor[0]" points="10, 0 19, 10 10, 20" />
5
+ <polyline stroke-width="2" fill="transparent" :stroke="mergedColor[1]" points="2, 0 11, 10 2, 20" />
6
+ </svg>
7
+ <slot></slot>
8
+ <svg width="21px" height="20px">
9
+ <polyline stroke-width="4" fill="transparent" :stroke="mergedColor[0]" points="11, 0 2, 10 11, 20" />
10
+ <polyline stroke-width="2" fill="transparent" :stroke="mergedColor[1]" points="19, 0 10, 10 19, 20" />
11
+ </svg>
12
+ </div>
13
+ </template>
14
+
15
+ <script>
16
+ import mixin from '../mixin/decoration'
17
+ export default {
18
+ name: 'ShDecoration7',
19
+ mixins: [mixin]
20
+ }
21
+ </script>
22
+
23
+ <style scoped lang="scss">
24
+ .sh-decoration-7 {
25
+ display: flex;
26
+ width: 100%;
27
+ height: 100%;
28
+ justify-content: center;
29
+ align-items: center;
30
+ }
31
+ </style>
@@ -0,0 +1,32 @@
1
+ <template>
2
+ <div :ref="ref" class="sh-decoration-8">
3
+ <svg :width="width" :height="height">
4
+ <polyline :stroke="mergedColor[0]" stroke-width="2" fill="transparent" :points="`${xPos(0)}, 0 ${xPos(30)}, ${height / 2}`" />
5
+ <polyline :stroke="mergedColor[0]" stroke-width="2" fill="transparent" :points="`${xPos(20)}, 0 ${xPos(50)}, ${height / 2} ${xPos(width)}, ${height / 2}`" />
6
+ <polyline :stroke="mergedColor[1]" fill="transparent" stroke-width="3" :points="`${xPos(0)}, ${height - 3}, ${xPos(200)}, ${height - 3}`" />
7
+ </svg>
8
+ </div>
9
+ </template>
10
+
11
+ <script>
12
+ import mixin from '../mixin/decoration'
13
+ export default {
14
+ name: 'ShDecoration8',
15
+ mixins: [mixin],
16
+ methods: {
17
+ xPos (pos) {
18
+ const { reverse, width } = this
19
+ if (!reverse) return pos
20
+ return width - pos
21
+ }
22
+ }
23
+ }
24
+ </script>
25
+
26
+ <style scoped lang="scss">
27
+ .sh-decoration-8 {
28
+ display: flex;
29
+ width: 100%;
30
+ height: 100%;
31
+ }
32
+ </style>
@@ -0,0 +1,63 @@
1
+ <template>
2
+ <div :ref="ref" class="sh-decoration-9">
3
+ <svg :width="`${svgWH[0]}px`" :height="`${svgWH[1]}px`" :style="`transform:scale(${svgScale[0]},${svgScale[1]});`">
4
+ <defs><polygon :id="polygonId" points="15, 46.5, 21, 47.5, 21, 52.5, 15, 53.5" /></defs>
5
+ <circle cx="50" cy="50" r="45" fill="transparent" :stroke="mergedColor[1]" stroke-width="10" stroke-dasharray="80, 100, 30, 100">
6
+ <animateTransform attributeName="transform" type="rotate" values="0 50 50;360 50 50" :dur="`${dur}s`" repeatCount="indefinite" />
7
+ </circle>
8
+ <circle cx="50" cy="50" r="45" fill="transparent" :stroke="mergedColor[0]" stroke-width="6" stroke-dasharray="50, 66, 100, 66">
9
+ <animateTransform attributeName="transform" type="rotate" values="0 50 50;-360 50 50" :dur="`${dur}s`" repeatCount="indefinite" />
10
+ </circle>
11
+ <circle cx="50" cy="50" r="38" fill="transparent" :stroke="fade(mergedColor[1] || defaultColor[1], 30)" stroke-width="1" stroke-dasharray="5, 1" />
12
+ <use v-for="(foo, i) in new Array(20).fill(0)" :key="i" :xlink:href="`#${polygonId}`" :stroke="mergedColor[1]" :fill="Math.random() > 0.4 ? 'transparent' : mergedColor[0]">
13
+ <animateTransform attributeName="transform" type="rotate" values="0 50 50;360 50 50" :dur="`${dur}s`" :begin="`${(i * dur) / 20}s`" repeatCount="indefinite" />
14
+ </use>
15
+ <circle cx="50" cy="50" r="26" fill="transparent" :stroke="fade(mergedColor[1] || defaultColor[1], 30)" stroke-width="1" stroke-dasharray="5, 1" />
16
+ </svg>
17
+
18
+ <slot></slot>
19
+ </div>
20
+ </template>
21
+
22
+ <script>
23
+ import mixin from '../mixin/decoration'
24
+ export default {
25
+ name: 'ShDecoration9',
26
+ mixins: [mixin],
27
+ data() {
28
+ return {
29
+ svgWH: [100, 100],
30
+ svgScale: [1, 1]
31
+ }
32
+ },
33
+ computed: {
34
+ polygonId() {
35
+ return `decoration-9-polygon-${this.decorationId}`
36
+ }
37
+ },
38
+ methods: {
39
+ calcScale() {
40
+ const { width, height, svgWH } = this
41
+ const [w, h] = svgWH
42
+ this.svgScale = [width / w, height / h]
43
+ }
44
+ }
45
+ }
46
+ </script>
47
+
48
+ <style scoped lang="scss">
49
+ .sh-decoration-9 {
50
+ position: relative;
51
+ width: 100%;
52
+ height: 100%;
53
+ display: flex;
54
+ align-items: center;
55
+ justify-content: center;
56
+ svg {
57
+ position: absolute;
58
+ left: 0px;
59
+ top: 0px;
60
+ transform-origin: left top;
61
+ }
62
+ }
63
+ </style>