0.3.0 • Published 3 years ago

tinyjs-plugin-dust v0.3.0

Weekly downloads
3
License
MIT
Repository
github
Last release
3 years ago

tinyjs-plugin-dust

Dust is a quick and easy particle effects engine

查看demo

http://tinyjs.net/plugins/tinyjs-plugin-dust.html#demo

引用方法

起步

首先当然是要引入,推荐NPM方式,当然你也可以使用CDN或下载独立版本,先从几个例子入手吧!

1、最简单的例子

引用 Tiny.js 源码

<script src="https://gw.alipayobjects.com/os/lib/tinyjs/tiny/1.5.0/tiny.js"></script>
var Dust = require('tinyjs-plugin-dust');
// 或者
// import Dust from 'tinyjs-plugin-dust';

// 新建 APP
var app = new Tiny.Application({
  width: 320,
  height: 320
});
// 创建容器
var container = new Tiny.Container();
// 初始化
var dust = new Dust(100, 100, function () {
    return new Tiny.Sprite.fromImage('https://gw.alipayobjects.com/as/g/tiny/resources/1.0.0/images/heart.png')
  }, container,
  {
    number: 50,
    gravity: 0.1,
    randomSpacing: true,
    minAngle: 0, maxAngle: 6.28,
    minSize: 12, maxSize: 24,
    minSpeed: 1, maxSpeed: 2,
    minScaleSpeed: 0.005, maxScaleSpeed: 0.01,
    minAlphaSpeed: 0.005, maxAlphaSpeed: 0.01,
    minRotationSpeed: 0.05, maxRotationSpeed: 0.1
  });

app.run(container);
app.onUpdate(function () {
  dust && dust.update();
});

依赖

API文档

http://tinyjs.net/plugins/tinyjs-plugin-dust.html#docs

0.3.0

3 years ago

0.2.0

4 years ago

0.1.6

5 years ago

0.1.5

5 years ago

0.1.4

5 years ago

0.1.3

5 years ago

0.1.2

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago

0.0.6

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago