npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

vue-starry-sky

v0.1.2

Published

基于VUE的星空特效组件,以后扩展其他相关的星空效果。

Downloads

21

Readme

vue-starry-sky

包下载&引用

在 vue 项目中使用 npm 安装

npm install vue-starry-sky

文件地址

下面是项目地址:

使用方法

在 vue 项目中 src/main.js 中加入下列语句

//main.js
import VueStarrySky from "vue-starry-sky"
import "vue-starry-sky/lib/vue-starry-sky.css"

Vue.use(VueStarrySky);

在 vue 页面中使用

<vue-starry-sky></vue-starry-sky>
//或者
<vue-starry-sky :stars-count="800" :distance="800"></vue-starry-sky>
  • 参数说明
    • stars-count 类型:{Number,String} 星星的数量控制,默认是 800
    • distance 类型:{Number,String} 星星的间距控制,默认是 800

原生 JS 写法

博客园可以用这类方法写入或者在设置中

<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>星星特效html版本</title>
    <style>
        body {
            background: radial-gradient(200% 100% at bottom center, #f7f7b6, #e96f92, #75517d, #1b2947);
            background: radial-gradient(220% 105% at top center, #1b2947 10%, #75517d 40%, #e96f92 65%, #f7f7b6);
            background-attachment: fixed;
        }

        @keyframes rotate {
            0% {
                transform: perspective(400px) rotateZ(20deg) rotateX(-40deg) rotateY(0);
            }

            100% {
                transform: perspective(400px) rotateZ(20deg) rotateX(-40deg) rotateY(-360deg);
            }
        }

        #stars {
            transform: perspective(500px);
            transform-style: preserve-3d;
            position: fixed;
            perspective-origin: 50% 100%;
            left: 50%;
            animation: rotate 66s infinite linear;
            bottom: 0;
            z-index: -99;
        }

        .star {
            width: 2px;
            height: 2px;
            background: #f7f7b8;
            position: fixed;
            top: 0px;
            left: 0;
            backface-visibility: hidden;
        }
    </style>
</head>

<body>
    <!-- 星星特效 -->
    <div id="stars">
    </div>

    <script>
        (function () {
            let starsCount = 800; //星星数量
            let distance = 800;//间距
            let parentStarts = document.getElementById("stars");
            for (let i = 0; i < starsCount; i++) {
                let childStart = document.createElement("div");
                childStart.setAttribute("class", 'star');
                parentStarts.appendChild(childStart);
            }
            for (let i = 0; i < starsCount; i++) {
                let item = parentStarts.children[i];
                let speed = 0.2 + (Math.random() * 1);
                let thisDistance = distance + (Math.random() * 300);
                console.log(parentStarts);
                item.style.transformOrigin = "0 0 " + thisDistance + "px";
                item.style.transform = "translate3d(0,0,-" + thisDistance + "px) rotateY(" + (Math.random() * 360) + "deg) rotateX(" + (Math.random() * -50) + "deg) scale(" + speed + "," + speed + ")";
            }
        })();
    </script>
</body>

</html>

参照の大佬

bilibili up 主 欧贵姥爷啊 等待授权

备注:

基于 vue 的一个星空特效插件 待更新...