@melt-js/comps-vue2 2026.11.5 → 2026.11.6
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/README.md +17 -1
- package/hel_dist/css/{chunk-e3b20906.1a16268b.css → chunk-f032efe6.332a9b03.css} +1 -1
- package/hel_dist/hel-meta.json +23 -18
- package/hel_dist/img/clouds_back.d1a6739b.jpg +0 -0
- package/hel_dist/img/clouds_front.b35c0bd4.jpg +0 -0
- package/hel_dist/img/clouds_left.4f5664b9.jpg +0 -0
- package/hel_dist/img/clouds_right.0e9ec637.jpg +0 -0
- package/hel_dist/img/clouds_top.31039c75.jpg +0 -0
- package/hel_dist/index.html +1 -1
- package/hel_dist/js/{app~493df0b3.f16034ff.js → app~493df0b3.39d7ea1f.js} +3 -3
- package/hel_dist/js/{app~493df0b3.f16034ff.js.map → app~493df0b3.39d7ea1f.js.map} +1 -1
- package/hel_dist/js/chunk-f032efe6.d73e0465.js +2 -0
- package/hel_dist/js/chunk-f032efe6.d73e0465.js.map +1 -0
- package/package.json +2 -1
- package/src/components/Butterflies3d/assets/clouds_back.jpg +0 -0
- package/src/components/Butterflies3d/assets/clouds_front.jpg +0 -0
- package/src/components/Butterflies3d/assets/clouds_left.jpg +0 -0
- package/src/components/Butterflies3d/assets/clouds_right.jpg +0 -0
- package/src/components/Butterflies3d/assets/clouds_top.jpg +0 -0
- package/src/components/Butterflies3d/assets/wing-pattern.gif +0 -0
- package/src/components/Butterflies3d/index.vue +245 -0
- package/src/components/Butterflies3d/source/README.md +17 -0
- package/src/components/Butterflies3d/source/index.html +305 -0
- package/src/components/Butterflies3d/source/reset.css +1 -0
- package/src/components/Butterflies3d/source/style.css +831 -0
- package/src/components/Butterflies3d/style.css +295 -0
- package/src/components/index.js +2 -0
- package/src/entrance/libTypes.ts +3 -0
- package/hel_dist/js/chunk-e3b20906.e04b1c48.js +0 -2
- package/hel_dist/js/chunk-e3b20906.e04b1c48.js.map +0 -1
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"module": "hel_proxy_es/entry.js",
|
|
6
6
|
"types": "src/entrance/libTypes.ts",
|
|
7
7
|
"unpkg": "hel_dist/index.html",
|
|
8
|
-
"version": "2026.11.
|
|
8
|
+
"version": "2026.11.6",
|
|
9
9
|
"publishConfig": {
|
|
10
10
|
"access": "public",
|
|
11
11
|
"registry": "https://registry.npmjs.org"
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
"start:App": "cross-env PORT=20040 VUE_APP_COMP=App NODE_OPTIONS=--openssl-legacy-provider vue-cli-service serve",
|
|
24
24
|
"start:Hello": "cross-env PORT=20040 VUE_APP_COMP=HelloWorld NODE_OPTIONS=--openssl-legacy-provider vue-cli-service serve",
|
|
25
25
|
"start:Ranking": "cross-env PORT=20040 VUE_APP_COMP=TierRanking NODE_OPTIONS=--openssl-legacy-provider vue-cli-service serve",
|
|
26
|
+
"start:Butterfly": "cross-env PORT=20040 VUE_APP_COMP=Butterflies3d NODE_OPTIONS=--openssl-legacy-provider vue-cli-service serve",
|
|
26
27
|
"build": "pnpm run check_name && pnpm run build_dist && pnpm run build_meta && pnpm run build_proxy",
|
|
27
28
|
"build_dist": "cross-env NODE_OPTIONS=--openssl-legacy-provider vue-cli-service build",
|
|
28
29
|
"check_name": "node ./scripts/check.js",
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
class="butterflies-3d"
|
|
4
|
+
:class="{ 'is-paused': paused }"
|
|
5
|
+
role="img"
|
|
6
|
+
aria-label="3D 蝴蝶在云层中飞舞的动画"
|
|
7
|
+
>
|
|
8
|
+
<!--
|
|
9
|
+
翅膀纹理与蝴蝶轮廓:id 由实例 uid 生成,
|
|
10
|
+
同一个页面里挂载多个实例时不会互相覆盖。
|
|
11
|
+
-->
|
|
12
|
+
<svg class="svg-defs" aria-hidden="true" focusable="false">
|
|
13
|
+
<defs>
|
|
14
|
+
<pattern
|
|
15
|
+
:id="patternId"
|
|
16
|
+
width="1"
|
|
17
|
+
height="1"
|
|
18
|
+
viewBox="0 0 100 100"
|
|
19
|
+
preserveAspectRatio="none"
|
|
20
|
+
>
|
|
21
|
+
<image
|
|
22
|
+
:xlink:href="resolvedWingTexture"
|
|
23
|
+
width="100"
|
|
24
|
+
height="100"
|
|
25
|
+
preserveAspectRatio="none"
|
|
26
|
+
/>
|
|
27
|
+
</pattern>
|
|
28
|
+
|
|
29
|
+
<g :id="shapeId">
|
|
30
|
+
<path
|
|
31
|
+
class="path"
|
|
32
|
+
clip-rule="evenodd"
|
|
33
|
+
d="M8.65,2.85c0.934-0.2,2.15-0.333,3.65-0.4c1.534-0.1,2.667-0.083,3.4,0.05
|
|
34
|
+
c1.533,0.267,3.45,0.767,5.75,1.5c2.466,0.8,4.35,1.617,5.65,2.45c2.066,1.2,3.883,2.383,5.45,3.55c2.567,2.1,4.35,3.8,5.35,5.1
|
|
35
|
+
l2.1,2.5c0.933,1.167,1.517,1.983,1.75,2.45c0.333,0.767,1.083,2.117,2.25,4.05c0.233,0.467,0.717,1.683,1.45,3.65
|
|
36
|
+
c0.733,2.067,1.2,3.45,1.4,4.15c0.467,1.733,0.917,3.767,1.35,6.1l0.4,3.85l-0.25-3.4c-0.6-5.967-1.267-10.25-2-12.85
|
|
37
|
+
c-0.733-2.434-2.167-5.467-4.3-9.1c-0.966-1.667-1.566-3-1.8-4c-0.233-0.933-0.1-1.267,0.4-1c1.3,0.733,2.917,3.867,4.85,9.4
|
|
38
|
+
c1.667,4.7,2.85,11.2,3.55,19.5c0.567,6.934,0.667,11.917,0.3,14.95l0.2,0.05c0.231,0,0.348-0.05,0.35-0.15v0.05l0.1,0.05v27.4
|
|
39
|
+
c-0.032-0.018-0.065-0.035-0.1-0.05v-0.05c-0.7,0.267-0.983,0.117-0.85-0.45c0.067-0.333,0.017-0.817-0.15-1.45
|
|
40
|
+
c-0.2-0.6-0.316-0.983-0.35-1.15l-0.5-1.65c-0.533-2.967-0.833-5.034-0.9-6.2c-0.1-1.533-0.133-2.4-0.1-2.6
|
|
41
|
+
c0-0.933,0.167-1.667,0.5-2.2c0.567-0.9,0.684-1.75,0.35-2.55c-0.167-0.367-0.367-0.6-0.6-0.7c-0.333-0.133-0.517,0.283-0.55,1.25
|
|
42
|
+
c-0.033,1.533-0.167,2.9-0.4,4.1c-0.1,2.3-0.267,3.684-0.5,4.15c-0.333,0.667-1.25,2.95-2.75,6.85c-1.167,2.8-2.233,4.817-3.2,6.05
|
|
43
|
+
c-0.9,1.2-1.583,2.1-2.05,2.7c-0.8,1-1.434,1.667-1.9,2c-2.067,1.333-3.633,2.067-4.7,2.2c-3.033,0.267-4.95,0.317-5.75,0.15
|
|
44
|
+
c-0.8-0.167-1.383-0.217-1.75-0.15c-0.533,0.1-1.033,0.45-1.5,1.05c-0.5,0.667-1.217,1.284-2.15,1.85
|
|
45
|
+
c-0.934,0.567-1.85,0.934-2.75,1.1c-2.467,0.433-4.45,0.25-5.95-0.55c-0.7-0.4-1.467-1.15-2.3-2.25c-0.6-0.867-1.033-1.567-1.3-2.1
|
|
46
|
+
c-0.267-0.667-0.483-1.483-0.65-2.45c-0.3-1.467-0.383-2.717-0.25-3.75c0.267-1.9,0.45-3.05,0.55-3.45
|
|
47
|
+
c0.233-1.233,0.566-2.333,1-3.3C9.25,77.45,9.767,76.4,10,76c0.667-1.233,1.55-2.583,2.65-4.05c1.1-1.434,2.184-2.583,3.25-3.45
|
|
48
|
+
c0.367-0.3,1.15-0.867,2.35-1.7c0.767-0.566,1.917-1.25,3.45-2.05c1.733-0.933,3.267-1.633,4.6-2.1
|
|
49
|
+
c2.133-0.733,4.534-1.467,7.2-2.2c0.467-0.1,1.517-0.3,3.15-0.6c0.967-0.233,0.4-0.4-1.7-0.5c-2.434-0.1-4.534-0.3-6.3-0.6
|
|
50
|
+
c-1.566-0.267-3.383-0.7-5.45-1.3c-2.8-0.8-4.467-1.317-5-1.55c-1.567-0.667-3.2-1.75-4.9-3.25c-1.733-1.533-3-3.1-3.8-4.7
|
|
51
|
+
c-0.533-1.067-0.967-2.434-1.3-4.1c-0.233-1.067-0.3-2.133-0.2-3.2c0.133-0.833,0.183-1.3,0.15-1.4v-0.6
|
|
52
|
+
c-2.467-3.233-3.983-5.433-4.55-6.6c-0.533-1.033-0.883-1.833-1.05-2.4c-0.3-0.867-0.466-1.85-0.5-2.95
|
|
53
|
+
c-0.033-2.367,0.034-4.117,0.2-5.25c0.3-1.034,0.483-1.8,0.55-2.3c0.167-0.867,0.034-1.533-0.4-2c-0.6-0.7-1.133-1.517-1.6-2.45
|
|
54
|
+
c-0.566-1.133-0.833-2.117-0.8-2.95c0.033-1.333,0.167-2.367,0.4-3.1c0.367-1.267,1.05-2.267,2.05-3
|
|
55
|
+
C4.417,4.25,6.483,3.317,8.65,2.85z"
|
|
56
|
+
/>
|
|
57
|
+
</g>
|
|
58
|
+
</defs>
|
|
59
|
+
</svg>
|
|
60
|
+
|
|
61
|
+
<!-- 天空兜底背景:天空盒图片加载前 / 旋转到边缘时不露出宿主页面 -->
|
|
62
|
+
<div class="background" aria-hidden="true"></div>
|
|
63
|
+
|
|
64
|
+
<div class="scene3d" aria-hidden="true">
|
|
65
|
+
<!-- 天空盒:六面贴图拼成的立方体,慢速绕 Y 轴自转 -->
|
|
66
|
+
<div class="cube skybox" :style="skyboxStyle">
|
|
67
|
+
<div class="scale">
|
|
68
|
+
<div class="face front"></div>
|
|
69
|
+
<div class="face back"></div>
|
|
70
|
+
<div class="face right"></div>
|
|
71
|
+
<div class="face left"></div>
|
|
72
|
+
<div class="face top"></div>
|
|
73
|
+
<div class="face bottom"></div>
|
|
74
|
+
</div>
|
|
75
|
+
</div>
|
|
76
|
+
|
|
77
|
+
<!--
|
|
78
|
+
每只蝴蝶都是同一套 3D 图层:容器绕 Y 轴公转 → 姿态 → 缩放 →
|
|
79
|
+
平移 → 上下飘动(fluttering)→ 翅膀扇动。
|
|
80
|
+
-->
|
|
81
|
+
<div
|
|
82
|
+
v-for="butterfly in items"
|
|
83
|
+
:key="butterfly.key"
|
|
84
|
+
class="butterfly_container"
|
|
85
|
+
:class="butterfly.sizeClass"
|
|
86
|
+
:style="butterfly.containerStyle"
|
|
87
|
+
>
|
|
88
|
+
<div class="layer rotate3d">
|
|
89
|
+
<div class="layer scale">
|
|
90
|
+
<div class="layer translate3d">
|
|
91
|
+
<div class="layer translate3d-1" :style="butterfly.flutterStyle">
|
|
92
|
+
<figure class="butterfly">
|
|
93
|
+
<svg class="wing left" viewBox="0 0 50 100" :style="butterfly.wingStyle">
|
|
94
|
+
<use :xlink:href="'#' + shapeId" :style="wingFillStyle" />
|
|
95
|
+
</svg>
|
|
96
|
+
<svg class="wing right" viewBox="0 0 50 100" :style="butterfly.wingStyle">
|
|
97
|
+
<use :xlink:href="'#' + shapeId" :style="wingFillStyle" />
|
|
98
|
+
</svg>
|
|
99
|
+
</figure>
|
|
100
|
+
</div>
|
|
101
|
+
</div>
|
|
102
|
+
</div>
|
|
103
|
+
</div>
|
|
104
|
+
</div>
|
|
105
|
+
</div>
|
|
106
|
+
</div>
|
|
107
|
+
</template>
|
|
108
|
+
|
|
109
|
+
<script>
|
|
110
|
+
/**
|
|
111
|
+
* 3D 蝴蝶飞舞(Vue 2 组件)
|
|
112
|
+
*
|
|
113
|
+
* 抽取自 https://github.com/luo0412/night-demo-codepen-gulp-2019 的
|
|
114
|
+
* gulp3-jquery-melt-ie8-mpa/_melt/ch2-effects/03-animal/butterflies-3d/index.html:
|
|
115
|
+
* - 原始 HTML / CSS 见同目录 source/(保留出处,不在构建中使用)
|
|
116
|
+
* - 原页面用 7 段重复的内联 style 摆放蝴蝶,这里改为数据驱动:
|
|
117
|
+
* props.butterflies 里的每一项对应一只蝴蝶(尺寸、公转周期、扇翅周期、偏移)
|
|
118
|
+
* - 原 CSS 里的 body/html 规则、-moz-/-ms-/-o- 前缀与无效的 FlipH 已清理,
|
|
119
|
+
* 皮肤与关键帧数值保持不变;根节点负责裁剪,不再依赖整页 overflow:hidden
|
|
120
|
+
* - 天空盒贴图、翅膀纹理都改为同目录 assets/ 下的本地文件(原纹理在 CodePen S3 上,
|
|
121
|
+
* 已失效),不再请求外部图片
|
|
122
|
+
* - 轮廓 / 纹理的 id 按实例 uid 生成,同一页面可安全挂载多个实例
|
|
123
|
+
*
|
|
124
|
+
* 对外:props = butterflies / paused / speed / wingTexture
|
|
125
|
+
* 纯 CSS 动画驱动,无定时器,卸载即停止。
|
|
126
|
+
*/
|
|
127
|
+
|
|
128
|
+
import defaultWingTexture from './assets/wing-pattern.gif';
|
|
129
|
+
|
|
130
|
+
const DEFAULT_BUTTERFLIES = [
|
|
131
|
+
// 大只:10s 公转、0.5s 扇一次
|
|
132
|
+
{ size: '', duration: 10, wingDuration: 0.5 },
|
|
133
|
+
// 大只:5s 公转,往左上偏
|
|
134
|
+
{ size: '', duration: 5, wingDuration: 0.75, marginTop: -150, marginLeft: 140 },
|
|
135
|
+
// 半尺寸:5s 公转
|
|
136
|
+
{ size: 'half', duration: 5, wingDuration: 0.75, marginTop: -10, marginLeft: 50 },
|
|
137
|
+
// 半尺寸:20s 公转、1s 扇一次
|
|
138
|
+
{ size: 'half', duration: 20, wingDuration: 1, marginTop: 20 },
|
|
139
|
+
// 半尺寸:20s 公转,往右下偏
|
|
140
|
+
{ size: 'half', duration: 20, wingDuration: 1.2, marginTop: 100, marginLeft: 50 },
|
|
141
|
+
// 三分之一:20s 公转,0.35s 快扇
|
|
142
|
+
{ size: 'third', duration: 20, wingDuration: 0.35, marginTop: 150 },
|
|
143
|
+
// 三分之一:4s 公转(飞得最快),往右上偏
|
|
144
|
+
{ size: 'third', duration: 4, wingDuration: 0.45, marginTop: -250, marginLeft: 300 }
|
|
145
|
+
];
|
|
146
|
+
|
|
147
|
+
// 公转、飘动这些没有单独配置的动画沿用源码里的默认周期
|
|
148
|
+
const SKYBOX_DURATION = 40;
|
|
149
|
+
const FLUTTER_DURATION = 10;
|
|
150
|
+
|
|
151
|
+
const ALLOWED_SIZES = ['half', 'third', 'quarter'];
|
|
152
|
+
|
|
153
|
+
// 允许 marginTop / marginLeft 传数字(px)或字符串(原样使用)
|
|
154
|
+
function toLength(value) {
|
|
155
|
+
if (value === undefined || value === null || value === '') return undefined;
|
|
156
|
+
return typeof value === 'number' ? value + 'px' : String(value);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
export default {
|
|
160
|
+
name: 'Butterflies3d',
|
|
161
|
+
props: {
|
|
162
|
+
// 每只蝴蝶的配置:{ size, duration, wingDuration, marginTop, marginLeft }
|
|
163
|
+
// - size: '' | 'half' | 'third' | 'quarter'
|
|
164
|
+
// - duration: 绕 Y 轴公转一圈的秒数
|
|
165
|
+
// - wingDuration: 翅膀扇动一个来回的秒数
|
|
166
|
+
// - marginTop / marginLeft: 相对舞台中心的偏移,数字按 px 处理
|
|
167
|
+
butterflies: {
|
|
168
|
+
type: Array,
|
|
169
|
+
default: () => DEFAULT_BUTTERFLIES.map((butterfly) => ({ ...butterfly }))
|
|
170
|
+
},
|
|
171
|
+
// 暂停全部动画(公转、飘动、扇翅、天空盒)
|
|
172
|
+
paused: {
|
|
173
|
+
type: Boolean,
|
|
174
|
+
default: false
|
|
175
|
+
},
|
|
176
|
+
// 全局速度倍率:2 表示快一倍,0.5 表示慢一倍,会被限制在 0.1 ~ 10
|
|
177
|
+
speed: {
|
|
178
|
+
type: Number,
|
|
179
|
+
default: 1
|
|
180
|
+
},
|
|
181
|
+
// 自定义翅膀纹理;不传则用内置的本地纹理
|
|
182
|
+
wingTexture: {
|
|
183
|
+
type: String,
|
|
184
|
+
default: ''
|
|
185
|
+
}
|
|
186
|
+
},
|
|
187
|
+
computed: {
|
|
188
|
+
safeSpeed() {
|
|
189
|
+
const speed = Number(this.speed);
|
|
190
|
+
if (!Number.isFinite(speed) || speed <= 0) return 1;
|
|
191
|
+
return Math.min(10, Math.max(0.1, speed));
|
|
192
|
+
},
|
|
193
|
+
resolvedWingTexture() {
|
|
194
|
+
return this.wingTexture || defaultWingTexture;
|
|
195
|
+
},
|
|
196
|
+
// 用实例 uid 生成唯一 id,避免多实例互相抢 defs
|
|
197
|
+
patternId() {
|
|
198
|
+
return 'butterflies-3d-pattern-' + this._uid;
|
|
199
|
+
},
|
|
200
|
+
shapeId() {
|
|
201
|
+
return 'butterflies-3d-shape-' + this._uid;
|
|
202
|
+
},
|
|
203
|
+
wingFillStyle() {
|
|
204
|
+
return { fill: 'url(#' + this.patternId + ')' };
|
|
205
|
+
},
|
|
206
|
+
skyboxStyle() {
|
|
207
|
+
return { animationDuration: SKYBOX_DURATION / this.safeSpeed + 's' };
|
|
208
|
+
},
|
|
209
|
+
// 把外部配置归一化成模板直接可用的样式对象
|
|
210
|
+
items() {
|
|
211
|
+
return this.normalizeButterflies(this.butterflies);
|
|
212
|
+
}
|
|
213
|
+
},
|
|
214
|
+
methods: {
|
|
215
|
+
normalizeButterflies(list) {
|
|
216
|
+
if (!Array.isArray(list)) return [];
|
|
217
|
+
return list.map((item, index) => {
|
|
218
|
+
const butterfly = item || {};
|
|
219
|
+
const size = ALLOWED_SIZES.indexOf(butterfly.size) > -1 ? butterfly.size : '';
|
|
220
|
+
const duration = Number(butterfly.duration) > 0 ? Number(butterfly.duration) : 10;
|
|
221
|
+
const wingDuration =
|
|
222
|
+
Number(butterfly.wingDuration) > 0 ? Number(butterfly.wingDuration) : 0.5;
|
|
223
|
+
|
|
224
|
+
return {
|
|
225
|
+
key: index,
|
|
226
|
+
sizeClass: size ? 'scale_' + size : '',
|
|
227
|
+
containerStyle: {
|
|
228
|
+
marginTop: toLength(butterfly.marginTop),
|
|
229
|
+
marginLeft: toLength(butterfly.marginLeft),
|
|
230
|
+
animationDuration: duration / this.safeSpeed + 's'
|
|
231
|
+
},
|
|
232
|
+
wingStyle: {
|
|
233
|
+
animationDuration: wingDuration / this.safeSpeed + 's'
|
|
234
|
+
},
|
|
235
|
+
flutterStyle: {
|
|
236
|
+
animationDuration: FLUTTER_DURATION / this.safeSpeed + 's'
|
|
237
|
+
}
|
|
238
|
+
};
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
};
|
|
243
|
+
</script>
|
|
244
|
+
|
|
245
|
+
<style scoped src="./style.css"></style>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# 原始来源
|
|
2
|
+
|
|
3
|
+
- 页面:<https://github.com/luo0412/night-demo-codepen-gulp-2019/blob/master/gulp3-jquery-melt-ie8-mpa/_melt/ch2-effects/03-animal/butterflies-3d/index.html>
|
|
4
|
+
- 本目录的 `index.html`、`style.css`、`reset.css` 原样拷贝自上述仓库的
|
|
5
|
+
`butterflies-3d/index.html` 与 `butterflies-3d/css/`,仅用于保留出处,不参与组件构建。
|
|
6
|
+
|
|
7
|
+
改写为 Vue 2 组件(`../index.vue` + `../style.css`)时的处理:
|
|
8
|
+
|
|
9
|
+
- `body` / `html` 的整页尺寸与 `overflow: hidden` 改到组件根节点 `.butterflies-3d` 上,组件不再影响宿主页面。
|
|
10
|
+
- 天空盒贴图 `clouds_*.jpg` 移到 `../assets/` 并压缩(512×512,JPEG quality 82)。
|
|
11
|
+
- 翅膀纹理原地址 `https://s3-us-west-2.amazonaws.com/s.cdpn.io/78881/pattern_141.gif` 已返回 403,
|
|
12
|
+
这里改用 Internet Archive 的快照(12×48 GIF),保存为 `../assets/wing-pattern.gif`。
|
|
13
|
+
- 去掉 `-moz-` / `-ms-` / `-o-` 前缀和无效的 `FlipH` 滤镜,保留原始变换、关键帧与尺寸数值。
|
|
14
|
+
- 原页面里 7 只蝴蝶的重复内联 `animation-duration` / `margin-*` 改为 `butterflies` prop。
|
|
15
|
+
- 原页面的 `<var class="...">` 图层改为 `<div class="layer ...">`,便于阅读与组件复用。
|
|
16
|
+
- `reset.css` 是页面级 reset,组件不引入;组件自身的布局完全由 `../style.css` 负责。
|
|
17
|
+
- 轮廓 / 纹理的 id 由实例 uid 生成,同一页面可以挂载多个组件实例。
|
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
|
|
4
|
+
<head>
|
|
5
|
+
|
|
6
|
+
<meta charset="UTF-8">
|
|
7
|
+
|
|
8
|
+
<title>HTML5 SVG 3D蝴蝶飞舞动画</title>
|
|
9
|
+
|
|
10
|
+
<link rel="stylesheet" href="css/reset.css">
|
|
11
|
+
|
|
12
|
+
<link rel="stylesheet" href="css/style.css" media="screen"/>
|
|
13
|
+
|
|
14
|
+
</head>
|
|
15
|
+
|
|
16
|
+
<body>
|
|
17
|
+
|
|
18
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" xml:space="preserve" xmlns:xml="http://www.w3.org/XML/1998/namespace" class="svg-defs">
|
|
19
|
+
<defs>
|
|
20
|
+
|
|
21
|
+
<pattern id='image' width="1" height="1" viewBox="0 0 100 100" preserveAspectRatio="none">
|
|
22
|
+
<image xlink:href="https://s3-us-west-2.amazonaws.com/s.cdpn.io/78881/pattern_141.gif" width="100" height="100" preserveAspectRatio="none"></image>
|
|
23
|
+
</pattern>
|
|
24
|
+
|
|
25
|
+
<g id="shape-butterfly-1">
|
|
26
|
+
<path class="path" fill="" clip-rule="evenodd" d="M8.65,2.85c0.934-0.2,2.15-0.333,3.65-0.4c1.534-0.1,2.667-0.083,3.4,0.05
|
|
27
|
+
c1.533,0.267,3.45,0.767,5.75,1.5c2.466,0.8,4.35,1.617,5.65,2.45c2.066,1.2,3.883,2.383,5.45,3.55c2.567,2.1,4.35,3.8,5.35,5.1
|
|
28
|
+
l2.1,2.5c0.933,1.167,1.517,1.983,1.75,2.45c0.333,0.767,1.083,2.117,2.25,4.05c0.233,0.467,0.717,1.683,1.45,3.65
|
|
29
|
+
c0.733,2.067,1.2,3.45,1.4,4.15c0.467,1.733,0.917,3.767,1.35,6.1l0.4,3.85l-0.25-3.4c-0.6-5.967-1.267-10.25-2-12.85
|
|
30
|
+
c-0.733-2.434-2.167-5.467-4.3-9.1c-0.966-1.667-1.566-3-1.8-4c-0.233-0.933-0.1-1.267,0.4-1c1.3,0.733,2.917,3.867,4.85,9.4
|
|
31
|
+
c1.667,4.7,2.85,11.2,3.55,19.5c0.567,6.934,0.667,11.917,0.3,14.95l0.2,0.05c0.231,0,0.348-0.05,0.35-0.15v0.05l0.1,0.05v27.4
|
|
32
|
+
c-0.032-0.018-0.065-0.035-0.1-0.05v-0.05c-0.7,0.267-0.983,0.117-0.85-0.45c0.067-0.333,0.017-0.817-0.15-1.45
|
|
33
|
+
c-0.2-0.6-0.316-0.983-0.35-1.15l-0.5-1.65c-0.533-2.967-0.833-5.034-0.9-6.2c-0.1-1.533-0.133-2.4-0.1-2.6
|
|
34
|
+
c0-0.933,0.167-1.667,0.5-2.2c0.567-0.9,0.684-1.75,0.35-2.55c-0.167-0.367-0.367-0.6-0.6-0.7c-0.333-0.133-0.517,0.283-0.55,1.25
|
|
35
|
+
c-0.033,1.533-0.167,2.9-0.4,4.1c-0.1,2.3-0.267,3.684-0.5,4.15c-0.333,0.667-1.25,2.95-2.75,6.85c-1.167,2.8-2.233,4.817-3.2,6.05
|
|
36
|
+
c-0.9,1.2-1.583,2.1-2.05,2.7c-0.8,1-1.434,1.667-1.9,2c-2.067,1.333-3.633,2.067-4.7,2.2c-3.033,0.267-4.95,0.317-5.75,0.15
|
|
37
|
+
c-0.8-0.167-1.383-0.217-1.75-0.15c-0.533,0.1-1.033,0.45-1.5,1.05c-0.5,0.667-1.217,1.284-2.15,1.85
|
|
38
|
+
c-0.934,0.567-1.85,0.934-2.75,1.1c-2.467,0.433-4.45,0.25-5.95-0.55c-0.7-0.4-1.467-1.15-2.3-2.25c-0.6-0.867-1.033-1.567-1.3-2.1
|
|
39
|
+
c-0.267-0.667-0.483-1.483-0.65-2.45c-0.3-1.467-0.383-2.717-0.25-3.75c0.267-1.9,0.45-3.05,0.55-3.45
|
|
40
|
+
c0.233-1.233,0.566-2.333,1-3.3C9.25,77.45,9.767,76.4,10,76c0.667-1.233,1.55-2.583,2.65-4.05c1.1-1.434,2.184-2.583,3.25-3.45
|
|
41
|
+
c0.367-0.3,1.15-0.867,2.35-1.7c0.767-0.566,1.917-1.25,3.45-2.05c1.733-0.933,3.267-1.633,4.6-2.1
|
|
42
|
+
c2.133-0.733,4.534-1.467,7.2-2.2c0.467-0.1,1.517-0.3,3.15-0.6c0.967-0.233,0.4-0.4-1.7-0.5c-2.434-0.1-4.534-0.3-6.3-0.6
|
|
43
|
+
c-1.566-0.267-3.383-0.7-5.45-1.3c-2.8-0.8-4.467-1.317-5-1.55c-1.567-0.667-3.2-1.75-4.9-3.25c-1.733-1.533-3-3.1-3.8-4.7
|
|
44
|
+
c-0.533-1.067-0.967-2.434-1.3-4.1c-0.233-1.067-0.3-2.133-0.2-3.2c0.133-0.833,0.183-1.3,0.15-1.4v-0.6
|
|
45
|
+
c-2.467-3.233-3.983-5.433-4.55-6.6c-0.533-1.033-0.883-1.833-1.05-2.4c-0.3-0.867-0.466-1.85-0.5-2.95
|
|
46
|
+
c-0.033-2.367,0.034-4.117,0.2-5.25c0.3-1.034,0.483-1.8,0.55-2.3c0.167-0.867,0.034-1.533-0.4-2c-0.6-0.7-1.133-1.517-1.6-2.45
|
|
47
|
+
c-0.566-1.133-0.833-2.117-0.8-2.95c0.033-1.333,0.167-2.367,0.4-3.1c0.367-1.267,1.05-2.267,2.05-3
|
|
48
|
+
C4.417,4.25,6.483,3.317,8.65,2.85z"/>
|
|
49
|
+
<g>
|
|
50
|
+
|
|
51
|
+
</defs>
|
|
52
|
+
</svg>
|
|
53
|
+
<div style="text-align:center;clear:both;position:absolute;top:30px;left:260px;z-index:999">
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
</div>
|
|
57
|
+
<section class="background"></section>
|
|
58
|
+
|
|
59
|
+
<section class="scene3d">
|
|
60
|
+
|
|
61
|
+
<div class="cube skybox">
|
|
62
|
+
<var class="scale">
|
|
63
|
+
<figure class="face front"></figure>
|
|
64
|
+
<figure class="face back"></figure>
|
|
65
|
+
<figure class="face right"></figure>
|
|
66
|
+
<figure class="face left"></figure>
|
|
67
|
+
<figure class="face top"></figure>
|
|
68
|
+
<figure class="face bottom"></figure>
|
|
69
|
+
</var>
|
|
70
|
+
</div>
|
|
71
|
+
|
|
72
|
+
<div class="butterfly_container">
|
|
73
|
+
<var class="rotate3d">
|
|
74
|
+
<var class="scale">
|
|
75
|
+
<var class="translate3d">
|
|
76
|
+
<var class="translate3d-1">
|
|
77
|
+
<figure class="butterfly">
|
|
78
|
+
<svg class="wing left" viewBox="0 0 50 100" class="icon shape-codepen">
|
|
79
|
+
<use class="left" xlink:href="#shape-butterfly-1"></use>
|
|
80
|
+
</svg>
|
|
81
|
+
<svg class="wing right" viewBox="0 0 50 100" class="icon shape-codepen">
|
|
82
|
+
<use class="left" xlink:href="#shape-butterfly-1"></use>
|
|
83
|
+
</svg>
|
|
84
|
+
</figure>
|
|
85
|
+
</var>
|
|
86
|
+
</var>
|
|
87
|
+
</var>
|
|
88
|
+
</var>
|
|
89
|
+
</div>
|
|
90
|
+
|
|
91
|
+
<div class="butterfly_container"
|
|
92
|
+
style="margin-top: -150px; margin-left: 140px;
|
|
93
|
+
-webkit-animation-duration: 5s;
|
|
94
|
+
-moz-animation-duration: 5s;
|
|
95
|
+
-ms-animation-duration: 5s;
|
|
96
|
+
-o-animation-duration: 5s;
|
|
97
|
+
animation-duration: 5s;">
|
|
98
|
+
<var class="rotate3d">
|
|
99
|
+
<var class="scale">
|
|
100
|
+
<var class="translate3d">
|
|
101
|
+
<var class="translate3d-1">
|
|
102
|
+
<figure class="butterfly">
|
|
103
|
+
<svg class="wing left" viewBox="0 0 50 100"
|
|
104
|
+
style="-webkit-animation-duration: .75s;
|
|
105
|
+
-moz-animation-duration: .75s;
|
|
106
|
+
-ms-animation-duration: .75s;
|
|
107
|
+
-o-animation-duration: .75s;
|
|
108
|
+
animation-duration: .75s;">
|
|
109
|
+
<use class="left" xlink:href="#shape-butterfly-1"></use>
|
|
110
|
+
</svg>
|
|
111
|
+
<svg class="wing right" viewBox="0 0 50 100"
|
|
112
|
+
style="-webkit-animation-duration: .75s;
|
|
113
|
+
-moz-animation-duration: .75s;
|
|
114
|
+
-ms-animation-duration: .75s;
|
|
115
|
+
-o-animation-duration: .75s;
|
|
116
|
+
animation-duration: .75s;">
|
|
117
|
+
<use class="left" xlink:href="#shape-butterfly-1"></use>
|
|
118
|
+
</svg>
|
|
119
|
+
</figure>
|
|
120
|
+
</var>
|
|
121
|
+
</var>
|
|
122
|
+
</var>
|
|
123
|
+
</var>
|
|
124
|
+
</div>
|
|
125
|
+
|
|
126
|
+
<div class="butterfly_container scale_half"
|
|
127
|
+
style="margin-top: -10px; margin-left: 50px;
|
|
128
|
+
-webkit-animation-duration: 5s;
|
|
129
|
+
-moz-animation-duration: 5s;
|
|
130
|
+
-ms-animation-duration: 5s;
|
|
131
|
+
-o-animation-duration: 5s;
|
|
132
|
+
animation-duration: 5s;">
|
|
133
|
+
<var class="rotate3d">
|
|
134
|
+
<var class="scale">
|
|
135
|
+
<var class="translate3d">
|
|
136
|
+
<var class="translate3d-1">
|
|
137
|
+
<figure class="butterfly">
|
|
138
|
+
<svg class="wing left" viewBox="0 0 50 100"
|
|
139
|
+
style="-webkit-animation-duration: .75s;
|
|
140
|
+
-moz-animation-duration: .75s;
|
|
141
|
+
-ms-animation-duration: .75s;
|
|
142
|
+
-o-animation-duration: .75s;
|
|
143
|
+
animation-duration: .75s;">
|
|
144
|
+
<use class="left" xlink:href="#shape-butterfly-1"></use>
|
|
145
|
+
</svg>
|
|
146
|
+
<svg class="wing right" viewBox="0 0 50 100"
|
|
147
|
+
style="-webkit-animation-duration: .75s;
|
|
148
|
+
-moz-animation-duration: .75s;
|
|
149
|
+
-ms-animation-duration: .75s;
|
|
150
|
+
-o-animation-duration: .75s;
|
|
151
|
+
animation-duration: .75s;">
|
|
152
|
+
<use class="left" xlink:href="#shape-butterfly-1"></use>
|
|
153
|
+
</svg>
|
|
154
|
+
</figure>
|
|
155
|
+
</var>
|
|
156
|
+
</var>
|
|
157
|
+
</var>
|
|
158
|
+
</var>
|
|
159
|
+
</div>
|
|
160
|
+
|
|
161
|
+
<div class="butterfly_container scale_half"
|
|
162
|
+
style="margin-top: 20px;
|
|
163
|
+
-webkit-animation-duration: 20s;
|
|
164
|
+
-moz-animation-duration: 20s;
|
|
165
|
+
-ms-animation-duration: 20s;
|
|
166
|
+
-o-animation-duration: 20s;
|
|
167
|
+
animation-duration: 20s;">
|
|
168
|
+
<var class="rotate3d">
|
|
169
|
+
<var class="scale">
|
|
170
|
+
<var class="translate3d">
|
|
171
|
+
<var class="translate3d-1">
|
|
172
|
+
<figure class="butterfly">
|
|
173
|
+
<svg class="wing left" viewBox="0 0 50 100"
|
|
174
|
+
style="-webkit-animation-duration: 1s;
|
|
175
|
+
-moz-animation-duration: 1s;
|
|
176
|
+
-ms-animation-duration: 1s;
|
|
177
|
+
-o-animation-duration: 1s;
|
|
178
|
+
animation-duration: 1s;">
|
|
179
|
+
<use class="left" xlink:href="#shape-butterfly-1"></use>
|
|
180
|
+
</svg>
|
|
181
|
+
<svg class="wing right" viewBox="0 0 50 100"
|
|
182
|
+
style="-webkit-animation-duration: 1s;
|
|
183
|
+
-moz-animation-duration: 1s;
|
|
184
|
+
-ms-animation-duration: 1s;
|
|
185
|
+
-o-animation-duration: 1s;
|
|
186
|
+
animation-duration: 1s;">
|
|
187
|
+
<use class="left" xlink:href="#shape-butterfly-1"></use>
|
|
188
|
+
</svg>
|
|
189
|
+
</figure>
|
|
190
|
+
</var>
|
|
191
|
+
</var>
|
|
192
|
+
</var>
|
|
193
|
+
</var>
|
|
194
|
+
</div>
|
|
195
|
+
|
|
196
|
+
<div class="butterfly_container scale_half"
|
|
197
|
+
style="margin-top: 100px; margin-left: 50px;
|
|
198
|
+
-webkit-animation-duration: 20s;
|
|
199
|
+
-moz-animation-duration: 20s;
|
|
200
|
+
-ms-animation-duration: 20s;
|
|
201
|
+
-o-animation-duration: 20s;
|
|
202
|
+
animation-duration: 20s;">
|
|
203
|
+
<var class="rotate3d">
|
|
204
|
+
<var class="scale">
|
|
205
|
+
<var class="translate3d">
|
|
206
|
+
<var class="translate3d-1">
|
|
207
|
+
<figure class="butterfly">
|
|
208
|
+
<svg class="wing left" viewBox="0 0 50 100"
|
|
209
|
+
style="-webkit-animation-duration: 1.2s;
|
|
210
|
+
-moz-animation-duration: 1.2s;
|
|
211
|
+
-ms-animation-duration: 1.2s;
|
|
212
|
+
-o-animation-duration: 1.2s;
|
|
213
|
+
animation-duration: 1.2s;">
|
|
214
|
+
<use class="left" xlink:href="#shape-butterfly-1"></use>
|
|
215
|
+
</svg>
|
|
216
|
+
<svg class="wing right" viewBox="0 0 50 100"
|
|
217
|
+
style="-webkit-animation-duration: 1.2s;
|
|
218
|
+
-moz-animation-duration: 1.2s;
|
|
219
|
+
-ms-animation-duration: 1.2s;
|
|
220
|
+
-o-animation-duration: 1.2s;
|
|
221
|
+
animation-duration: 1.2s;">
|
|
222
|
+
<use class="left" xlink:href="#shape-butterfly-1"></use>
|
|
223
|
+
</svg>
|
|
224
|
+
</figure>
|
|
225
|
+
</var>
|
|
226
|
+
</var>
|
|
227
|
+
</var>
|
|
228
|
+
</var>
|
|
229
|
+
</div>
|
|
230
|
+
|
|
231
|
+
<div class="butterfly_container scale_third"
|
|
232
|
+
style="margin-top: 150px;
|
|
233
|
+
-webkit-animation-duration: 20s;
|
|
234
|
+
-moz-animation-duration: 20s;
|
|
235
|
+
-ms-animation-duration: 20s;
|
|
236
|
+
-o-animation-duration: 20s;
|
|
237
|
+
animation-duration: 20s;">
|
|
238
|
+
<var class="rotate3d">
|
|
239
|
+
<var class="scale">
|
|
240
|
+
<var class="translate3d">
|
|
241
|
+
<var class="translate3d-1">
|
|
242
|
+
<figure class="butterfly">
|
|
243
|
+
<svg class="wing left" viewBox="0 0 50 100"
|
|
244
|
+
style="-webkit-animation-duration: .35s;
|
|
245
|
+
-moz-animation-duration: .35s;
|
|
246
|
+
-ms-animation-duration: .35s;
|
|
247
|
+
-o-animation-duration: .35s;
|
|
248
|
+
animation-duration: .35s;">
|
|
249
|
+
<use class="left" xlink:href="#shape-butterfly-1"></use>
|
|
250
|
+
</svg>
|
|
251
|
+
<svg class="wing right" viewBox="0 0 50 100"
|
|
252
|
+
style="-webkit-animation-duration: .35s;
|
|
253
|
+
-moz-animation-duration: .35s;
|
|
254
|
+
-ms-animation-duration: .53s;
|
|
255
|
+
-o-animation-duration: .35s;
|
|
256
|
+
animation-duration: .35s;">
|
|
257
|
+
<use class="left" xlink:href="#shape-butterfly-1"></use>
|
|
258
|
+
</svg>
|
|
259
|
+
</figure>
|
|
260
|
+
</var>
|
|
261
|
+
</var>
|
|
262
|
+
</var>
|
|
263
|
+
</var>
|
|
264
|
+
</div>
|
|
265
|
+
|
|
266
|
+
<div class="butterfly_container scale_third"
|
|
267
|
+
style="margin-top: -250px; margin-left: 300px;
|
|
268
|
+
-webkit-animation-duration: 4s;
|
|
269
|
+
-moz-animation-duration: 4s;
|
|
270
|
+
-ms-animation-duration: 4s;
|
|
271
|
+
-o-animation-duration: 4s;
|
|
272
|
+
animation-duration: 4s;">
|
|
273
|
+
<var class="rotate3d">
|
|
274
|
+
<var class="scale">
|
|
275
|
+
<var class="translate3d">
|
|
276
|
+
<var class="translate3d-1">
|
|
277
|
+
<figure class="butterfly">
|
|
278
|
+
<svg class="wing left" viewBox="0 0 50 100"
|
|
279
|
+
style="-webkit-animation-duration: .45s;
|
|
280
|
+
-moz-animation-duration: .45s;
|
|
281
|
+
-ms-animation-duration: .45s;
|
|
282
|
+
-o-animation-duration: .45s;
|
|
283
|
+
animation-duration: .45s;">
|
|
284
|
+
<use class="left" xlink:href="#shape-butterfly-1"></use>
|
|
285
|
+
</svg>
|
|
286
|
+
<svg class="wing right" viewBox="0 0 50 100"
|
|
287
|
+
style="-webkit-animation-duration: .45s;
|
|
288
|
+
-moz-animation-duration: .45s;
|
|
289
|
+
-ms-animation-duration: .45s;
|
|
290
|
+
-o-animation-duration: .45s;
|
|
291
|
+
animation-duration: .45s;">
|
|
292
|
+
<use class="left" xlink:href="#shape-butterfly-1"></use>
|
|
293
|
+
</svg>
|
|
294
|
+
</figure>
|
|
295
|
+
</var>
|
|
296
|
+
</var>
|
|
297
|
+
</var>
|
|
298
|
+
</var>
|
|
299
|
+
</div>
|
|
300
|
+
|
|
301
|
+
</section>
|
|
302
|
+
|
|
303
|
+
</body>
|
|
304
|
+
|
|
305
|
+
</html>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video{margin:0;padding:0;border:0;font-size:100%;font:inherit;vertical-align:baseline}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:'';content:none}table{border-collapse:collapse;border-spacing:0}
|