Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@b-design/color

Package Overview
Dependencies
Maintainers
10
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@b-design/color - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

2

package.json
{
"name": "@b-design/color",
"version": "1.0.2",
"version": "1.0.3",
"title": "B-Design Color",

@@ -5,0 +5,0 @@ "description": "B-Design Color",

@@ -44,2 +44,11 @@ <br />

const config = {
// 设备像素比,默认值window.devicePixelRatio ;详细见下方“性能平衡”
dpr: window.devicePixelRatio,
// 抽帧率,详细见下方“性能平衡”
frame: 1,
// 图形分段,详细见下方“性能平衡”
segment: 200,
// 背景色

@@ -78,2 +87,3 @@ background: 'ff6220',

// 初始化
// 此时画布还没有出现图案,需要调用渲染接口绘制到画布上,见下方“渲染”
bdColor.init();

@@ -83,4 +93,5 @@

更新渲染
渲染
```javascript
/** 更新渲染 */
let rafID;

@@ -92,12 +103,36 @@ const animate = () => {

animate();
```
暂停渲染
```javascript
/** 暂停渲染 */
bdColor.pause();
/** 恢复渲染 */
bdColor.resume();
```
恢复渲染
性能平衡
```javascript
bdColor.resume();
// configs中与性能相关的参数如下
/** 设备像素比 dpr
* 取值范围:0.5 - 2。数字越大,画面精度越高,性能开销越大。
* @type {Number}
* @default window.devicePixelRatio 或 1
*/
dpr: window.devicePixelRatio,
/** 抽帧率 frame
* 取值范围:1, 2 或 3。数字越小,画面刷新率越高,性能开销越大。
* 当值为1时,每1帧都渲染一次。当值为2时,每2帧渲染一次。以此类推。
* @type {Integer} 整数
* @default 根据GPU自动推荐为1,2 或 3。
*/
frame: 1,
/** 图形分段 segment
* 取值范围:30 - 500的整数。数字越大,分段越多,画面色彩变化越细致,性能开销越大。
* @type {Integer} 整数
* @default 根据GPU自动推荐为60,100 或 200。
*/
segment: 200,
```

@@ -123,5 +158,10 @@

查看预设
```javascript
const config = bdColor.getConfig();
```
## dev构建预览
* `npm start` to start development.
* `npm build` to build library.

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc