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 🙏

© 2025 – Pkg Stats / Ryan Hefner

product-display-360

v1.2.0

Published

360˚产品展示

Downloads

249

Readme

Product Display 360

一个轻量级、高性能的 JavaScript 库,用于展示产品的 360 度全景视图。支持触摸和鼠标交互,提供流畅的旋转体验。

✨ 功能特点

  • 🎯 支持 360 度产品展示
  • 🔍 支持热点标记功能
  • ⚙️ 支持自定义初始帧
  • 🔄 支持正反向播放
  • 🎨 支持透明背景
  • 📱 支持触摸和鼠标交互
  • 🚀 高性能渲染
  • 📦 支持模块化和传统方式使用

📦 安装

NPM 安装

npm install product-display-360

CDN 引入

<script src="https://unpkg.com/product-display-360/dist/index.js"></script>
<link rel="stylesheet" href="https://unpkg.com/product-display-360/dist/index.css" />

直接下载

<script src="./dist/index.js"></script>
<link rel="stylesheet" href="./dist/index.css" />

🚀 快速开始

模块化开发 (推荐)

import { CI360LIB } from 'product-display-360';

// 添加热点标记
CI360LIB.addHotspot({
	frame: 58,
	x: 50,
	y: 50,
	title: '产品特点',
	description: '这是一个重要的产品特点'
});

// 初始化配置
CI360LIB.init({
	container: document.querySelector('.product-display-360'),
	framesPath: 'https://your-cdn.com/frames/',
	framesFile: '0-{index}.jpg',
	framesCount: 199,
	initFrame: 58,
	framesReverse: true,
	alpha: true
});

传统方式使用

  1. 在 HTML 中创建容器:
<div class="product-display-360"></div>
  1. 添加样式:
.product-display-360 {
	width: 99vw;
	height: 98vh;
	background: #c5c3c6;
	border-radius: 20px;
	overflow: hidden;
}
  1. 初始化配置:
// 添加热点标记
CI360LIB.addHotspot({
	frame: 58,
	x: 50,
	y: 50,
	title: '产品特点',
	description: '这是一个重要的产品特点'
});

// 初始化配置
CI360LIB.init({
	container: document.querySelector('.product-display-360'),
	framesPath: 'https://your-cdn.com/frames/',
	framesFile: '0-{index}.jpg',
	framesCount: 199,
	initFrame: 58,
	framesReverse: true,
	alpha: true
});

⚙️ 配置参数

| 参数 | 类型 | 必填 | 默认值 | 说明 | | ------------- | ----------- | ---- | ------ | ----------------------------------------- | | container | HTMLElement | 是 | - | 容器元素 | | framesPath | string | 是 | - | 图片帧路径 | | framesFile | string | 是 | - | 图片帧文件名格式,使用 {index} 作为占位符 | | framesCount | number | 是 | - | 总帧数 | | initFrame | number | 否 | 0 | 初始帧 | | framesReverse | boolean | 否 | false | 是否反向播放 | | alpha | boolean | 否 | false | 是否支持透明背景 |

🔧 开发指南

技术栈

  • TypeScript
  • Rollup
  • PostCSS
  • Babel

开发环境设置

  1. 克隆项目并安装依赖:
git clone [repository-url]
cd product-display-360
npm install
  1. 开发命令:
# 开发模式
npm run dev

# 构建
npm run build

# 生成类型声明文件
npm run build:types

项目结构

product-display-360/
├── src/                # 源代码目录
│   ├── core/          # 核心功能
│   ├── utils/         # 工具函数
│   └── types/         # 类型定义
├── dist/              # 构建输出目录
├── types/             # TypeScript 类型声明文件
├── rollup.config.ts   # Rollup 配置文件
├── tsconfig.json      # TypeScript 配置文件
└── package.json       # 项目配置文件

📝 最佳实践

  1. 图片优化

    • 使用 WebP 格式图片以获得更好的性能
    • 确保图片尺寸适中,建议宽度不超过 2000px
    • 使用 CDN 加速图片加载
  2. 性能优化

    • 合理设置 framesCount,建议不超过 200 帧
    • 使用 requestAnimationFrame 进行动画
    • 适当使用图片预加载
  3. 热点标记

    • 热点数量建议控制在 10 个以内
    • 确保热点位置准确,避免重叠
    • 提供清晰的标题和描述

⚠️ 注意事项

  • 确保图片帧的命名格式正确
  • 图片帧数量需要与 framesCount 参数匹配
  • 建议使用 CDN 加载图片资源以提高性能
  • 支持 TypeScript 类型提示
  • 支持 ES6+ 模块化导入

🤝 贡献指南

欢迎提交 Issue 和 Pull Request。在提交 PR 之前,请确保:

  1. 代码符合项目规范
  2. 添加了必要的测试
  3. 更新了相关文档

📄 许可证

MIT

👨‍💻 作者

Gleason

🔗 相关链接