hy-starry-sky
Version:
This template should help get you started developing with Vue 3 in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more.
55 lines (54 loc) • 1.47 kB
JavaScript
import { ref as y, onMounted as _, createElementBlock as o, openBlock as c, createElementVNode as m, Fragment as f, renderList as i } from "vue";
const p = (t, r) => {
const e = t.__vccOpts || t;
for (const [n, s] of r)
e[n] = s;
return e;
}, u = { class: "starry-sky-bg" }, h = { class: "stars" }, k = {
__name: "hy-starry-sky",
props: {
starsCount: {
type: [Number, String],
default: () => 800
},
distance: {
type: [Number, String],
default: () => 800
}
},
setup(t) {
const r = t, e = y();
return _(() => {
e.value.forEach((s) => {
let a = 0.1 + Math.random() * 1, l = r.distance + Math.random() * 300;
s.style.transformOrigin = `0 0 ${l}px`, s.style.transform = `translate3d(0,0,-${l}px) rotateY(${Math.random() * 360}deg) rotateX(${Math.random() * -50}deg) scale(${a},${a})`;
});
}), (n, s) => (c(), o("div", u, [
m("div", h, [
(c(!0), o(f, null, i(t.starsCount, (a) => (c(), o("div", {
key: a,
class: "star",
ref_for: !0,
ref_key: "star",
ref: e
}))), 128))
])
]));
}
}, d = /* @__PURE__ */ p(k, [["__scopeId", "data-v-562fe1eb"]]);
d.__name = "HyStarrySky";
const S = {
install: (t) => {
t.component("HyStarrySky", d);
}
}, g = [S], v = (t) => {
g.forEach((r) => {
t.component(r.__name, r);
});
}, x = {
install: v
};
export {
S as HyStarrySky,
x as default
};