1 line
94 KiB
Plaintext
Executable File
1 line
94 KiB
Plaintext
Executable File
{"version":3,"sources":["node_modules/browser-pack/_prelude.js","ts-dist/AnimatedParticle.js","ts-dist/Emitter.js","ts-dist/Particle.js","ts-dist/ParticleUtils.js","ts-dist/PathParticle.js","ts-dist/PropertyList.js","ts-dist/PropertyNode.js","ts-dist/particles.js","ts-dist"],"names":[],"mappings":";;;;;;;AAAA;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACryBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AClUA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AChMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3GA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AChEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACZA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"pixi-particles.js","sourcesContent":["(function(){function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require==\"function\"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error(\"Cannot find module '\"+o+\"'\");throw f.code=\"MODULE_NOT_FOUND\",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require==\"function\"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}return e})()","\"use strict\";\r\nvar __extends = (this && this.__extends) || (function () {\r\n var extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return function (d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n };\r\n})();\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nvar Particle_1 = require(\"./Particle\");\r\nvar Texture = PIXI.Texture;\r\n/**\r\n * An individual particle image with an animation. Art data passed to the emitter must be\r\n * formatted in a particular way for AnimatedParticle to be able to handle it:\r\n *\r\n * {\r\n * //framerate is required. It is the animation speed of the particle in frames per\r\n * //second.\r\n * //A value of \"matchLife\" causes the animation to match the lifetime of an individual\r\n * //particle, instead of at a constant framerate. This causes the animation to play\r\n * //through one time, completing when the particle expires.\r\n * framerate: 6,\r\n * //loop is optional, and defaults to false.\r\n * loop: true,\r\n * //textures is required, and can be an array of any (non-zero) length.\r\n * textures: [\r\n * //each entry represents a single texture that should be used for one or more\r\n * //frames. Any strings will be converted to Textures with Texture.fromImage().\r\n * //Instances of PIXI.Texture will be used directly.\r\n * \"animFrame1.png\",\r\n * //entries can be an object with a 'count' property, telling AnimatedParticle to\r\n * //use that texture for 'count' frames sequentially.\r\n * {\r\n * texture: \"animFrame2.png\",\r\n * count: 3\r\n * },\r\n * \"animFrame3.png\"\r\n * ]\r\n * }\r\n *\r\n * @memberof PIXI.particles\r\n * @class AnimatedParticle\r\n * @extends PIXI.particles.Particle\r\n * @constructor\r\n * @param {PIXI.particles.Emitter} emitter The emitter that controls this AnimatedParticle.\r\n */\r\nvar AnimatedParticle = /** @class */ (function (_super) {\r\n __extends(AnimatedParticle, _super);\r\n function AnimatedParticle(emitter) {\r\n var _this = _super.call(this, emitter) || this;\r\n _this.textures = null;\r\n _this.duration = 0;\r\n _this.framerate = 0;\r\n _this.elapsed = 0;\r\n _this.loop = false;\r\n return _this;\r\n }\r\n /**\r\n * Initializes the particle for use, based on the properties that have to\r\n * have been set already on the particle.\r\n * @method PIXI.particles.AnimatedParticle#init\r\n */\r\n AnimatedParticle.prototype.init = function () {\r\n this.Particle_init();\r\n this.elapsed = 0;\r\n //if the animation needs to match the particle's life, then cacluate variables\r\n if (this.framerate < 0) {\r\n this.duration = this.maxLife;\r\n this.framerate = this.textures.length / this.duration;\r\n }\r\n };\r\n /**\r\n * Sets the textures for the particle.\r\n * @method PIXI.particles.AnimatedParticle#applyArt\r\n * @param {Array} art An array of PIXI.Texture objects for this animated particle.\r\n */\r\n AnimatedParticle.prototype.applyArt = function (art) {\r\n this.textures = art.textures;\r\n this.framerate = art.framerate;\r\n this.duration = art.duration;\r\n this.loop = art.loop;\r\n };\r\n /**\r\n * Updates the particle.\r\n * @method PIXI.particles.AnimatedParticle#update\r\n * @param {Number} delta Time elapsed since the previous frame, in __seconds__.\r\n */\r\n AnimatedParticle.prototype.update = function (delta) {\r\n var lerp = this.Particle_update(delta);\r\n //only animate the particle if it is still alive\r\n if (lerp >= 0) {\r\n this.elapsed += delta;\r\n if (this.elapsed > this.duration) {\r\n //loop elapsed back around\r\n if (this.loop)\r\n this.elapsed = this.elapsed % this.duration;\r\n else\r\n this.elapsed = this.duration - 0.000001;\r\n }\r\n var frame = (this.elapsed * this.framerate + 0.0000001) | 0;\r\n this.texture = this.textures[frame] || PIXI.Texture.EMPTY;\r\n }\r\n return lerp;\r\n };\r\n /**\r\n * Destroys the particle, removing references and preventing future use.\r\n * @method PIXI.particles.AnimatedParticle#destroy\r\n */\r\n AnimatedParticle.prototype.destroy = function () {\r\n this.Particle_destroy();\r\n this.textures = null;\r\n };\r\n /**\r\n * Checks over the art that was passed to the Emitter's init() function, to do any special\r\n * modifications to prepare it ahead of time.\r\n * @method PIXI.particles.AnimatedParticle.parseArt\r\n * @static\r\n * @param {Array} art The array of art data, properly formatted for AnimatedParticle.\r\n * @return {Array} The art, after any needed modifications.\r\n */\r\n AnimatedParticle.parseArt = function (art) {\r\n var data, output, textures, tex, outTextures;\r\n var outArr = [];\r\n for (var i = 0; i < art.length; ++i) {\r\n data = art[i];\r\n outArr[i] = output = {};\r\n output.textures = outTextures = [];\r\n textures = data.textures;\r\n for (var j = 0; j < textures.length; ++j) {\r\n tex = textures[j];\r\n if (typeof tex == \"string\")\r\n outTextures.push(Texture.fromImage(tex));\r\n else if (tex instanceof Texture)\r\n outTextures.push(tex);\r\n else {\r\n var dupe = tex.count || 1;\r\n if (typeof tex.texture == \"string\")\r\n tex = Texture.fromImage(tex.texture);\r\n else\r\n tex = tex.texture;\r\n for (; dupe > 0; --dupe) {\r\n outTextures.push(tex);\r\n }\r\n }\r\n }\r\n //use these values to signify that the animation should match the particle life time.\r\n if (data.framerate == \"matchLife\") {\r\n //-1 means that it should be calculated\r\n output.framerate = -1;\r\n output.duration = 0;\r\n output.loop = false;\r\n }\r\n else {\r\n //determine if the animation should loop\r\n output.loop = !!data.loop;\r\n //get the framerate, default to 60\r\n output.framerate = data.framerate > 0 ? data.framerate : 60;\r\n //determine the duration\r\n output.duration = outTextures.length / output.framerate;\r\n }\r\n }\r\n return outArr;\r\n };\r\n return AnimatedParticle;\r\n}(Particle_1.default));\r\nexports.default = AnimatedParticle;\r\n","\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nvar ParticleUtils_1 = require(\"./ParticleUtils\");\r\nvar Particle_1 = require(\"./Particle\");\r\nvar PropertyNode_1 = require(\"./PropertyNode\");\r\nvar ticker = PIXI.ticker.shared;\r\nvar helperPoint = new PIXI.Point();\r\n/**\r\n * A particle emitter.\r\n * @memberof PIXI.particles\r\n * @class Emitter\r\n * @constructor\r\n * @param {PIXI.Container} particleParent The container to add the\r\n * particles to.\r\n * @param {Array|PIXI.Texture|String} [particleImages] A texture or array of textures to use\r\n * for the particles. Strings will be turned\r\n * into textures via Texture.fromImage().\r\n * @param {Object} [config] A configuration object containing settings for the emitter.\r\n * @param {Boolean} [config.emit=true] If config.emit is explicitly passed as false, the Emitter\r\n * will start disabled.\r\n * @param {Boolean} [config.autoUpdate=false] If config.emit is explicitly passed as true, the Emitter\r\n * will automatically call update via the PIXI shared ticker.\r\n */\r\nvar Emitter = /** @class */ (function () {\r\n function Emitter(particleParent, particleImages, config) {\r\n this._particleConstructor = Particle_1.default;\r\n //properties for individual particles\r\n this.particleImages = null;\r\n this.startAlpha = null;\r\n this.startSpeed = null;\r\n this.minimumSpeedMultiplier = 1;\r\n this.acceleration = null;\r\n this.maxSpeed = NaN;\r\n this.startScale = null;\r\n this.minimumScaleMultiplier = 1;\r\n this.startColor = null;\r\n this.minLifetime = 0;\r\n this.maxLifetime = 0;\r\n this.minStartRotation = 0;\r\n this.maxStartRotation = 0;\r\n this.noRotation = false;\r\n this.minRotationSpeed = 0;\r\n this.maxRotationSpeed = 0;\r\n this.particleBlendMode = 0;\r\n this.customEase = null;\r\n this.extraData = null;\r\n //properties for spawning particles\r\n this._frequency = 1;\r\n this.spawnChance = 1;\r\n this.maxParticles = 1000;\r\n this.emitterLifetime = -1;\r\n this.spawnPos = null;\r\n this.spawnType = null;\r\n this._spawnFunc = null;\r\n this.spawnRect = null;\r\n this.spawnCircle = null;\r\n this.particlesPerWave = 1;\r\n this.particleSpacing = 0;\r\n this.angleStart = 0;\r\n //emitter properties\r\n this.rotation = 0;\r\n this.ownerPos = null;\r\n this._prevEmitterPos = null;\r\n this._prevPosIsValid = false;\r\n this._posChanged = false;\r\n this._parent = null;\r\n this.addAtBack = false;\r\n this.particleCount = 0;\r\n this._emit = false;\r\n this._spawnTimer = 0;\r\n this._emitterLife = -1;\r\n this._activeParticlesFirst = null;\r\n this._activeParticlesLast = null;\r\n this._poolFirst = null;\r\n this._origConfig = null;\r\n this._origArt = null;\r\n this._autoUpdate = false;\r\n this._destroyWhenComplete = false;\r\n this._completeCallback = null;\r\n //set the initial parent\r\n this.parent = particleParent;\r\n if (particleImages && config)\r\n this.init(particleImages, config);\r\n //save often used functions on the instance instead of the prototype for better speed\r\n this.recycle = this.recycle;\r\n this.update = this.update;\r\n this.rotate = this.rotate;\r\n this.updateSpawnPos = this.updateSpawnPos;\r\n this.updateOwnerPos = this.updateOwnerPos;\r\n }\r\n Object.defineProperty(Emitter.prototype, \"frequency\", {\r\n /**\r\n * Time between particle spawns in seconds. If this value is not a number greater than 0,\r\n * it will be set to 1 (particle per second) to prevent infinite loops.\r\n * @member {Number} PIXI.particles.Emitter#frequency\r\n */\r\n get: function () { return this._frequency; },\r\n set: function (value) {\r\n //do some error checking to prevent infinite loops\r\n if (typeof value == \"number\" && value > 0)\r\n this._frequency = value;\r\n else\r\n this._frequency = 1;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Emitter.prototype, \"particleConstructor\", {\r\n /**\r\n * The constructor used to create new particles. The default is\r\n * the built in Particle class. Setting this will dump any active or\r\n * pooled particles, if the emitter has already been used.\r\n * @member {Function} PIXI.particles.Emitter#particleConstructor\r\n */\r\n get: function () { return this._particleConstructor; },\r\n set: function (value) {\r\n if (value != this._particleConstructor) {\r\n this._particleConstructor = value;\r\n //clean up existing particles\r\n this.cleanup();\r\n //scrap all the particles\r\n for (var particle = this._poolFirst; particle; particle = particle.next) {\r\n particle.destroy();\r\n }\r\n this._poolFirst = null;\r\n //re-initialize the emitter so that the new constructor can do anything it needs to\r\n if (this._origConfig && this._origArt)\r\n this.init(this._origArt, this._origConfig);\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Emitter.prototype, \"parent\", {\r\n /**\r\n * The container to add particles to. Settings this will dump any active particles.\r\n * @member {PIXI.Container} PIXI.particles.Emitter#parent\r\n */\r\n get: function () { return this._parent; },\r\n set: function (value) {\r\n this.cleanup();\r\n this._parent = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Sets up the emitter based on the config settings.\r\n * @method PIXI.particles.Emitter#init\r\n * @param {Array|PIXI.Texture} art A texture or array of textures to use for the particles.\r\n * @param {Object} config A configuration object containing settings for the emitter.\r\n */\r\n Emitter.prototype.init = function (art, config) {\r\n if (!art || !config)\r\n return;\r\n //clean up any existing particles\r\n this.cleanup();\r\n //store the original config and particle images, in case we need to re-initialize\r\n //when the particle constructor is changed\r\n this._origConfig = config;\r\n this._origArt = art;\r\n //set up the array of data, also ensuring that it is an array\r\n art = Array.isArray(art) ? art.slice() : [art];\r\n //run the art through the particle class's parsing function\r\n var partClass = this._particleConstructor;\r\n this.particleImages = partClass.parseArt ? partClass.parseArt(art) : art;\r\n ///////////////////////////\r\n // Particle Properties //\r\n ///////////////////////////\r\n //set up the alpha\r\n if (config.alpha) {\r\n this.startAlpha = PropertyNode_1.default.createList(config.alpha);\r\n }\r\n else\r\n this.startAlpha = new PropertyNode_1.default(1, 0);\r\n //set up the speed\r\n if (config.speed) {\r\n this.startSpeed = PropertyNode_1.default.createList(config.speed);\r\n this.minimumSpeedMultiplier = config.speed.minimumSpeedMultiplier || 1;\r\n }\r\n else {\r\n this.minimumSpeedMultiplier = 1;\r\n this.startSpeed = new PropertyNode_1.default(0, 0);\r\n }\r\n //set up acceleration\r\n var acceleration = config.acceleration;\r\n if (acceleration && (acceleration.x || acceleration.y)) {\r\n //make sure we disable speed interpolation\r\n this.startSpeed.next = null;\r\n this.acceleration = new PIXI.Point(acceleration.x, acceleration.y);\r\n this.maxSpeed = config.maxSpeed || NaN;\r\n }\r\n else\r\n this.acceleration = new PIXI.Point();\r\n //set up the scale\r\n if (config.scale) {\r\n this.startScale = PropertyNode_1.default.createList(config.scale);\r\n this.minimumScaleMultiplier = config.scale.minimumScaleMultiplier || 1;\r\n }\r\n else {\r\n this.startScale = new PropertyNode_1.default(1, 0);\r\n this.minimumScaleMultiplier = 1;\r\n }\r\n //set up the color\r\n if (config.color) {\r\n this.startColor = PropertyNode_1.default.createList(config.color);\r\n }\r\n else {\r\n this.startColor = new PropertyNode_1.default({ r: 0xFF, g: 0xFF, b: 0xFF }, 0);\r\n }\r\n //set up the start rotation\r\n if (config.startRotation) {\r\n this.minStartRotation = config.startRotation.min;\r\n this.maxStartRotation = config.startRotation.max;\r\n }\r\n else\r\n this.minStartRotation = this.maxStartRotation = 0;\r\n if (config.noRotation &&\r\n (this.minStartRotation || this.maxStartRotation)) {\r\n this.noRotation = !!config.noRotation;\r\n }\r\n else\r\n this.noRotation = false;\r\n //set up the rotation speed\r\n if (config.rotationSpeed) {\r\n this.minRotationSpeed = config.rotationSpeed.min;\r\n this.maxRotationSpeed = config.rotationSpeed.max;\r\n }\r\n else\r\n this.minRotationSpeed = this.maxRotationSpeed = 0;\r\n //set up the lifetime\r\n this.minLifetime = config.lifetime.min;\r\n this.maxLifetime = config.lifetime.max;\r\n //get the blend mode\r\n this.particleBlendMode = ParticleUtils_1.default.getBlendMode(config.blendMode);\r\n //use the custom ease if provided\r\n if (config.ease) {\r\n this.customEase = typeof config.ease == \"function\" ?\r\n config.ease :\r\n ParticleUtils_1.default.generateEase(config.ease);\r\n }\r\n else\r\n this.customEase = null;\r\n //set up the extra data, running it through the particle class's parseData function.\r\n if (partClass.parseData)\r\n this.extraData = partClass.parseData(config.extraData);\r\n else\r\n this.extraData = config.extraData || null;\r\n //////////////////////////\r\n // Emitter Properties //\r\n //////////////////////////\r\n //reset spawn type specific settings\r\n this.spawnRect = this.spawnCircle = null;\r\n this.particlesPerWave = 1;\r\n if (config.particlesPerWave && config.particlesPerWave > 1)\r\n this.particlesPerWave = config.particlesPerWave;\r\n this.particleSpacing = 0;\r\n this.angleStart = 0;\r\n var spawnCircle;\r\n //determine the spawn function to use\r\n switch (config.spawnType) {\r\n case \"rect\":\r\n this.spawnType = \"rect\";\r\n this._spawnFunc = this._spawnRect;\r\n var spawnRect = config.spawnRect;\r\n this.spawnRect = new PIXI.Rectangle(spawnRect.x, spawnRect.y, spawnRect.w, spawnRect.h);\r\n break;\r\n case \"circle\":\r\n this.spawnType = \"circle\";\r\n this._spawnFunc = this._spawnCircle;\r\n spawnCircle = config.spawnCircle;\r\n this.spawnCircle = new PIXI.Circle(spawnCircle.x, spawnCircle.y, spawnCircle.r);\r\n break;\r\n case \"ring\":\r\n this.spawnType = \"ring\";\r\n this._spawnFunc = this._spawnRing;\r\n spawnCircle = config.spawnCircle;\r\n this.spawnCircle = new PIXI.Circle(spawnCircle.x, spawnCircle.y, spawnCircle.r);\r\n this.spawnCircle.minRadius = spawnCircle.minR;\r\n break;\r\n case \"burst\":\r\n this.spawnType = \"burst\";\r\n this._spawnFunc = this._spawnBurst;\r\n this.particleSpacing = config.particleSpacing;\r\n this.angleStart = config.angleStart ? config.angleStart : 0;\r\n break;\r\n case \"point\":\r\n this.spawnType = \"point\";\r\n this._spawnFunc = this._spawnPoint;\r\n break;\r\n default:\r\n this.spawnType = \"point\";\r\n this._spawnFunc = this._spawnPoint;\r\n break;\r\n }\r\n //set the spawning frequency\r\n this.frequency = config.frequency;\r\n this.spawnChance = (typeof config.spawnChance === 'number' && config.spawnChance > 0) ? config.spawnChance : 1;\r\n //set the emitter lifetime\r\n this.emitterLifetime = config.emitterLifetime || -1;\r\n //set the max particles\r\n this.maxParticles = config.maxParticles > 0 ? config.maxParticles : 1000;\r\n //determine if we should add the particle at the back of the list or not\r\n this.addAtBack = !!config.addAtBack;\r\n //reset the emitter position and rotation variables\r\n this.rotation = 0;\r\n this.ownerPos = new PIXI.Point();\r\n this.spawnPos = new PIXI.Point(config.pos.x, config.pos.y);\r\n this._prevEmitterPos = this.spawnPos.clone();\r\n //previous emitter position is invalid and should not be used for interpolation\r\n this._prevPosIsValid = false;\r\n //start emitting\r\n this._spawnTimer = 0;\r\n this.emit = config.emit === undefined ? true : !!config.emit;\r\n this.autoUpdate = config.autoUpdate === undefined ? false : !!config.autoUpdate;\r\n };\r\n /**\r\n * Recycles an individual particle.\r\n * @method PIXI.particles.Emitter#recycle\r\n * @param {Particle} particle The particle to recycle.\r\n * @private\r\n */\r\n Emitter.prototype.recycle = function (particle) {\r\n if (particle.next)\r\n particle.next.prev = particle.prev;\r\n if (particle.prev)\r\n particle.prev.next = particle.next;\r\n if (particle == this._activeParticlesLast)\r\n this._activeParticlesLast = particle.prev;\r\n if (particle == this._activeParticlesFirst)\r\n this._activeParticlesFirst = particle.next;\r\n //add to pool\r\n particle.prev = null;\r\n particle.next = this._poolFirst;\r\n this._poolFirst = particle;\r\n //remove child from display, or make it invisible if it is in a ParticleContainer\r\n if (particle.parent)\r\n particle.parent.removeChild(particle);\r\n //decrease count\r\n --this.particleCount;\r\n };\r\n /**\r\n * Sets the rotation of the emitter to a new value.\r\n * @method PIXI.particles.Emitter#rotate\r\n * @param {Number} newRot The new rotation, in degrees.\r\n */\r\n Emitter.prototype.rotate = function (newRot) {\r\n if (this.rotation == newRot)\r\n return;\r\n //caclulate the difference in rotation for rotating spawnPos\r\n var diff = newRot - this.rotation;\r\n this.rotation = newRot;\r\n //rotate spawnPos\r\n ParticleUtils_1.default.rotatePoint(diff, this.spawnPos);\r\n //mark the position as having changed\r\n this._posChanged = true;\r\n };\r\n /**\r\n * Changes the spawn position of the emitter.\r\n * @method PIXI.particles.Emitter#updateSpawnPos\r\n * @param {Number} x The new x value of the spawn position for the emitter.\r\n * @param {Number} y The new y value of the spawn position for the emitter.\r\n */\r\n Emitter.prototype.updateSpawnPos = function (x, y) {\r\n this._posChanged = true;\r\n this.spawnPos.x = x;\r\n this.spawnPos.y = y;\r\n };\r\n /**\r\n * Changes the position of the emitter's owner. You should call this if you are adding\r\n * particles to the world container that your emitter's owner is moving around in.\r\n * @method PIXI.particles.Emitter#updateOwnerPos\r\n * @param {Number} x The new x value of the emitter's owner.\r\n * @param {Number} y The new y value of the emitter's owner.\r\n */\r\n Emitter.prototype.updateOwnerPos = function (x, y) {\r\n this._posChanged = true;\r\n this.ownerPos.x = x;\r\n this.ownerPos.y = y;\r\n };\r\n /**\r\n * Prevents emitter position interpolation in the next update.\r\n * This should be used if you made a major position change of your emitter's owner\r\n * that was not normal movement.\r\n * @method PIXI.particles.Emitter#resetPositionTracking\r\n */\r\n Emitter.prototype.resetPositionTracking = function () {\r\n this._prevPosIsValid = false;\r\n };\r\n Object.defineProperty(Emitter.prototype, \"emit\", {\r\n /**\r\n * If particles should be emitted during update() calls. Setting this to false\r\n * stops new particles from being created, but allows existing ones to die out.\r\n * @member {Boolean} PIXI.particles.Emitter#emit\r\n */\r\n get: function () { return this._emit; },\r\n set: function (value) {\r\n this._emit = !!value;\r\n this._emitterLife = this.emitterLifetime;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n ;\r\n Object.defineProperty(Emitter.prototype, \"autoUpdate\", {\r\n /**\r\n * If the update function is called automatically from the shared ticker.\r\n * Setting this to false requires calling the update function manually.\r\n * @member {Boolean} PIXI.particles.Emitter#autoUpdate\r\n */\r\n get: function () { return this._autoUpdate; },\r\n set: function (value) {\r\n if (this._autoUpdate && !value) {\r\n ticker.remove(this.update, this);\r\n }\r\n else if (!this._autoUpdate && value) {\r\n ticker.add(this.update, this);\r\n }\r\n this._autoUpdate = !!value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Starts emitting particles, sets autoUpdate to true, and sets up the Emitter to destroy itself\r\n * when particle emission is complete.\r\n * @method PIXI.particles.Emitter#playOnceAndDestroy\r\n * @param {Function} [callback] Callback for when emission is complete (all particles have died off)\r\n */\r\n Emitter.prototype.playOnceAndDestroy = function (callback) {\r\n this.autoUpdate = true;\r\n this.emit = true;\r\n this._destroyWhenComplete = true;\r\n this._completeCallback = callback;\r\n };\r\n /**\r\n * Starts emitting particles and optionally calls a callback when particle emission is complete.\r\n * @method PIXI.particles.Emitter#playOnce\r\n * @param {Function} [callback] Callback for when emission is complete (all particles have died off)\r\n */\r\n Emitter.prototype.playOnce = function (callback) {\r\n this.emit = true;\r\n this._completeCallback = callback;\r\n };\r\n /**\r\n * Updates all particles spawned by this emitter and emits new ones.\r\n * @method PIXI.particles.Emitter#update\r\n * @param {Number} delta Time elapsed since the previous frame, in __seconds__.\r\n */\r\n Emitter.prototype.update = function (delta) {\r\n if (this._autoUpdate) {\r\n delta = delta / PIXI.settings.TARGET_FPMS / 1000;\r\n }\r\n //if we don't have a parent to add particles to, then don't do anything.\r\n //this also works as a isDestroyed check\r\n if (!this._parent)\r\n return;\r\n //update existing particles\r\n var i, particle, next;\r\n for (particle = this._activeParticlesFirst; particle; particle = next) {\r\n next = particle.next;\r\n particle.update(delta);\r\n }\r\n var prevX, prevY;\r\n //if the previous position is valid, store these for later interpolation\r\n if (this._prevPosIsValid) {\r\n prevX = this._prevEmitterPos.x;\r\n prevY = this._prevEmitterPos.y;\r\n }\r\n //store current position of the emitter as local variables\r\n var curX = this.ownerPos.x + this.spawnPos.x;\r\n var curY = this.ownerPos.y + this.spawnPos.y;\r\n //spawn new particles\r\n if (this._emit) {\r\n //decrease spawn timer\r\n this._spawnTimer -= delta < 0 ? 0 : delta;\r\n //while _spawnTimer < 0, we have particles to spawn\r\n while (this._spawnTimer <= 0) {\r\n //determine if the emitter should stop spawning\r\n if (this._emitterLife > 0) {\r\n this._emitterLife -= this._frequency;\r\n if (this._emitterLife <= 0) {\r\n this._spawnTimer = 0;\r\n this._emitterLife = 0;\r\n this.emit = false;\r\n break;\r\n }\r\n }\r\n //determine if we have hit the particle limit\r\n if (this.particleCount >= this.maxParticles) {\r\n this._spawnTimer += this._frequency;\r\n continue;\r\n }\r\n //determine the particle lifetime\r\n var lifetime = void 0;\r\n if (this.minLifetime == this.maxLifetime)\r\n lifetime = this.minLifetime;\r\n else\r\n lifetime = Math.random() * (this.maxLifetime - this.minLifetime) + this.minLifetime;\r\n //only make the particle if it wouldn't immediately destroy itself\r\n if (-this._spawnTimer < lifetime) {\r\n //If the position has changed and this isn't the first spawn,\r\n //interpolate the spawn position\r\n var emitPosX = void 0, emitPosY = void 0;\r\n if (this._prevPosIsValid && this._posChanged) {\r\n //1 - _spawnTimer / delta, but _spawnTimer is negative\r\n var lerp = 1 + this._spawnTimer / delta;\r\n emitPosX = (curX - prevX) * lerp + prevX;\r\n emitPosY = (curY - prevY) * lerp + prevY;\r\n }\r\n else {\r\n emitPosX = curX;\r\n emitPosY = curY;\r\n }\r\n //create enough particles to fill the wave (non-burst types have a wave of 1)\r\n i = 0;\r\n for (var len = Math.min(this.particlesPerWave, this.maxParticles - this.particleCount); i < len; ++i) {\r\n //see if we actually spawn one\r\n if (this.spawnChance < 1 && Math.random() >= this.spawnChance)\r\n continue;\r\n //create particle\r\n var p = void 0;\r\n if (this._poolFirst) {\r\n p = this._poolFirst;\r\n this._poolFirst = this._poolFirst.next;\r\n p.next = null;\r\n }\r\n else {\r\n p = new this.particleConstructor(this);\r\n }\r\n //set a random texture if we have more than one\r\n if (this.particleImages.length > 1) {\r\n p.applyArt(this.particleImages[Math.floor(Math.random() * this.particleImages.length)]);\r\n }\r\n else {\r\n //if they are actually the same texture, a standard particle\r\n //will quit early from the texture setting in setTexture().\r\n p.applyArt(this.particleImages[0]);\r\n }\r\n //set up the start and end values\r\n p.alphaList.reset(this.startAlpha);\r\n if (this.minimumSpeedMultiplier != 1) {\r\n p.speedMultiplier = Math.random() * (1 - this.minimumSpeedMultiplier) + this.minimumSpeedMultiplier;\r\n }\r\n p.speedList.reset(this.startSpeed);\r\n p.acceleration.x = this.acceleration.x;\r\n p.acceleration.y = this.acceleration.y;\r\n p.maxSpeed = this.maxSpeed;\r\n if (this.minimumScaleMultiplier != 1) {\r\n p.scaleMultiplier = Math.random() * (1 - this.minimumScaleMultiplier) + this.minimumScaleMultiplier;\r\n }\r\n p.scaleList.reset(this.startScale);\r\n p.colorList.reset(this.startColor);\r\n //randomize the rotation speed\r\n if (this.minRotationSpeed == this.maxRotationSpeed)\r\n p.rotationSpeed = this.minRotationSpeed;\r\n else\r\n p.rotationSpeed = Math.random() * (this.maxRotationSpeed - this.minRotationSpeed) + this.minRotationSpeed;\r\n p.noRotation = this.noRotation;\r\n //set up the lifetime\r\n p.maxLife = lifetime;\r\n //set the blend mode\r\n p.blendMode = this.particleBlendMode;\r\n //set the custom ease, if any\r\n p.ease = this.customEase;\r\n //set the extra data, if any\r\n p.extraData = this.extraData;\r\n //call the proper function to handle rotation and position of particle\r\n this._spawnFunc(p, emitPosX, emitPosY, i);\r\n //initialize particle\r\n p.init();\r\n //update the particle by the time passed, so the particles are spread out properly\r\n p.update(-this._spawnTimer); //we want a positive delta, because a negative delta messes things up\r\n //add the particle to the display list\r\n if (!p.parent) {\r\n if (this.addAtBack)\r\n this._parent.addChildAt(p, 0);\r\n else\r\n this._parent.addChild(p);\r\n }\r\n else {\r\n //kind of hacky, but performance friendly\r\n //shuffle children to correct place\r\n var children = this._parent.children;\r\n //avoid using splice if possible\r\n if (children[0] == p)\r\n children.shift();\r\n else if (children[children.length - 1] == p)\r\n children.pop();\r\n else {\r\n var index = children.indexOf(p);\r\n children.splice(index, 1);\r\n }\r\n if (this.addAtBack)\r\n children.unshift(p);\r\n else\r\n children.push(p);\r\n }\r\n //add particle to list of active particles\r\n if (this._activeParticlesLast) {\r\n this._activeParticlesLast.next = p;\r\n p.prev = this._activeParticlesLast;\r\n this._activeParticlesLast = p;\r\n }\r\n else {\r\n this._activeParticlesLast = this._activeParticlesFirst = p;\r\n }\r\n ++this.particleCount;\r\n }\r\n }\r\n //increase timer and continue on to any other particles that need to be created\r\n this._spawnTimer += this._frequency;\r\n }\r\n }\r\n //if the position changed before this update, then keep track of that\r\n if (this._posChanged) {\r\n this._prevEmitterPos.x = curX;\r\n this._prevEmitterPos.y = curY;\r\n this._prevPosIsValid = true;\r\n this._posChanged = false;\r\n }\r\n //if we are all done and should destroy ourselves, take care of that\r\n if (!this._emit && !this._activeParticlesFirst) {\r\n if (this._completeCallback) {\r\n this._completeCallback();\r\n }\r\n if (this._destroyWhenComplete) {\r\n this.destroy();\r\n }\r\n }\r\n };\r\n /**\r\n * Positions a particle for a point type emitter.\r\n * @method PIXI.particles.Emitter#_spawnPoint\r\n * @private\r\n * @param {Particle} p The particle to position and rotate.\r\n * @param {Number} emitPosX The emitter's x position\r\n * @param {Number} emitPosY The emitter's y position\r\n * @param {int} i The particle number in the current wave. Not used for this function.\r\n */\r\n Emitter.prototype._spawnPoint = function (p, emitPosX, emitPosY) {\r\n //set the initial rotation/direction of the particle based on\r\n //starting particle angle and rotation of emitter\r\n if (this.minStartRotation == this.maxStartRotation)\r\n p.rotation = this.minStartRotation + this.rotation;\r\n else\r\n p.rotation = Math.random() * (this.maxStartRotation - this.minStartRotation) + this.minStartRotation + this.rotation;\r\n //drop the particle at the emitter's position\r\n p.position.x = emitPosX;\r\n p.position.y = emitPosY;\r\n };\r\n /**\r\n * Positions a particle for a rectangle type emitter.\r\n * @method PIXI.particles.Emitter#_spawnRect\r\n * @private\r\n * @param {Particle} p The particle to position and rotate.\r\n * @param {Number} emitPosX The emitter's x position\r\n * @param {Number} emitPosY The emitter's y position\r\n * @param {int} i The particle number in the current wave. Not used for this function.\r\n */\r\n Emitter.prototype._spawnRect = function (p, emitPosX, emitPosY) {\r\n //set the initial rotation/direction of the particle based on starting\r\n //particle angle and rotation of emitter\r\n if (this.minStartRotation == this.maxStartRotation)\r\n p.rotation = this.minStartRotation + this.rotation;\r\n else\r\n p.rotation = Math.random() * (this.maxStartRotation - this.minStartRotation) + this.minStartRotation + this.rotation;\r\n //place the particle at a random point in the rectangle\r\n helperPoint.x = Math.random() * this.spawnRect.width + this.spawnRect.x;\r\n helperPoint.y = Math.random() * this.spawnRect.height + this.spawnRect.y;\r\n if (this.rotation !== 0)\r\n ParticleUtils_1.default.rotatePoint(this.rotation, helperPoint);\r\n p.position.x = emitPosX + helperPoint.x;\r\n p.position.y = emitPosY + helperPoint.y;\r\n };\r\n /**\r\n * Positions a particle for a circle type emitter.\r\n * @method PIXI.particles.Emitter#_spawnCircle\r\n * @private\r\n * @param {Particle} p The particle to position and rotate.\r\n * @param {Number} emitPosX The emitter's x position\r\n * @param {Number} emitPosY The emitter's y position\r\n * @param {int} i The particle number in the current wave. Not used for this function.\r\n */\r\n Emitter.prototype._spawnCircle = function (p, emitPosX, emitPosY) {\r\n //set the initial rotation/direction of the particle based on starting\r\n //particle angle and rotation of emitter\r\n if (this.minStartRotation == this.maxStartRotation)\r\n p.rotation = this.minStartRotation + this.rotation;\r\n else\r\n p.rotation = Math.random() * (this.maxStartRotation - this.minStartRotation) +\r\n this.minStartRotation + this.rotation;\r\n //place the particle at a random radius in the circle\r\n helperPoint.x = Math.random() * this.spawnCircle.radius;\r\n helperPoint.y = 0;\r\n //rotate the point to a random angle in the circle\r\n ParticleUtils_1.default.rotatePoint(Math.random() * 360, helperPoint);\r\n //offset by the circle's center\r\n helperPoint.x += this.spawnCircle.x;\r\n helperPoint.y += this.spawnCircle.y;\r\n //rotate the point by the emitter's rotation\r\n if (this.rotation !== 0)\r\n ParticleUtils_1.default.rotatePoint(this.rotation, helperPoint);\r\n //set the position, offset by the emitter's position\r\n p.position.x = emitPosX + helperPoint.x;\r\n p.position.y = emitPosY + helperPoint.y;\r\n };\r\n /**\r\n * Positions a particle for a ring type emitter.\r\n * @method PIXI.particles.Emitter#_spawnRing\r\n * @private\r\n * @param {Particle} p The particle to position and rotate.\r\n * @param {Number} emitPosX The emitter's x position\r\n * @param {Number} emitPosY The emitter's y position\r\n * @param {int} i The particle number in the current wave. Not used for this function.\r\n */\r\n Emitter.prototype._spawnRing = function (p, emitPosX, emitPosY) {\r\n var spawnCircle = this.spawnCircle;\r\n //set the initial rotation/direction of the particle based on starting\r\n //particle angle and rotation of emitter\r\n if (this.minStartRotation == this.maxStartRotation)\r\n p.rotation = this.minStartRotation + this.rotation;\r\n else\r\n p.rotation = Math.random() * (this.maxStartRotation - this.minStartRotation) +\r\n this.minStartRotation + this.rotation;\r\n //place the particle at a random radius in the ring\r\n if (spawnCircle.minRadius !== spawnCircle.radius) {\r\n helperPoint.x = Math.random() * (spawnCircle.radius - spawnCircle.minRadius) +\r\n spawnCircle.minRadius;\r\n }\r\n else\r\n helperPoint.x = spawnCircle.radius;\r\n helperPoint.y = 0;\r\n //rotate the point to a random angle in the circle\r\n var angle = Math.random() * 360;\r\n p.rotation += angle;\r\n ParticleUtils_1.default.rotatePoint(angle, helperPoint);\r\n //offset by the circle's center\r\n helperPoint.x += this.spawnCircle.x;\r\n helperPoint.y += this.spawnCircle.y;\r\n //rotate the point by the emitter's rotation\r\n if (this.rotation !== 0)\r\n ParticleUtils_1.default.rotatePoint(this.rotation, helperPoint);\r\n //set the position, offset by the emitter's position\r\n p.position.x = emitPosX + helperPoint.x;\r\n p.position.y = emitPosY + helperPoint.y;\r\n };\r\n /**\r\n * Positions a particle for a burst type emitter.\r\n * @method PIXI.particles.Emitter#_spawnBurst\r\n * @private\r\n * @param {Particle} p The particle to position and rotate.\r\n * @param {Number} emitPosX The emitter's x position\r\n * @param {Number} emitPosY The emitter's y position\r\n * @param {int} i The particle number in the current wave.\r\n */\r\n Emitter.prototype._spawnBurst = function (p, emitPosX, emitPosY, i) {\r\n //set the initial rotation/direction of the particle based on spawn\r\n //angle and rotation of emitter\r\n if (this.particleSpacing === 0)\r\n p.rotation = Math.random() * 360;\r\n else\r\n p.rotation = this.angleStart + (this.particleSpacing * i) + this.rotation;\r\n //drop the particle at the emitter's position\r\n p.position.x = emitPosX;\r\n p.position.y = emitPosY;\r\n };\r\n /**\r\n * Kills all active particles immediately.\r\n * @method PIXI.particles.Emitter#cleanup\r\n */\r\n Emitter.prototype.cleanup = function () {\r\n var particle, next;\r\n for (particle = this._activeParticlesFirst; particle; particle = next) {\r\n next = particle.next;\r\n this.recycle(particle);\r\n if (particle.parent)\r\n particle.parent.removeChild(particle);\r\n }\r\n this._activeParticlesFirst = this._activeParticlesLast = null;\r\n this.particleCount = 0;\r\n };\r\n /**\r\n * Destroys the emitter and all of its particles.\r\n * @method PIXI.particles.Emitter#destroy\r\n */\r\n Emitter.prototype.destroy = function () {\r\n //make sure we aren't still listening to any tickers\r\n this.autoUpdate = false;\r\n //puts all active particles in the pool, and removes them from the particle parent\r\n this.cleanup();\r\n //wipe the pool clean\r\n var next;\r\n for (var particle = this._poolFirst; particle; particle = next) {\r\n //store next value so we don't lose it in our destroy call\r\n next = particle.next;\r\n particle.destroy();\r\n }\r\n this._poolFirst = this._parent = this.particleImages = this.spawnPos = this.ownerPos =\r\n this.startColor = this.startScale = this.startAlpha = this.startSpeed =\r\n this.customEase = this._completeCallback = null;\r\n };\r\n return Emitter;\r\n}());\r\nexports.default = Emitter;\r\n","\"use strict\";\r\nvar __extends = (this && this.__extends) || (function () {\r\n var extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return function (d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n };\r\n})();\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nvar ParticleUtils_1 = require(\"./ParticleUtils\");\r\nvar PropertyList_1 = require(\"./PropertyList\");\r\nvar Sprite = PIXI.Sprite;\r\n/**\r\n * An individual particle image. You shouldn't have to deal with these.\r\n * @memberof PIXI.particles\r\n * @class Particle\r\n * @extends PIXI.Sprite\r\n * @constructor\r\n * @param {PIXI.particles.Emitter} emitter The emitter that controls this particle.\r\n */\r\nvar Particle = /** @class */ (function (_super) {\r\n __extends(Particle, _super);\r\n function Particle(emitter) {\r\n var _this = \r\n //start off the sprite with a blank texture, since we are going to replace it\r\n //later when the particle is initialized.\r\n _super.call(this) || this;\r\n _this.emitter = emitter;\r\n //particles should be centered\r\n _this.anchor.x = _this.anchor.y = 0.5;\r\n _this.velocity = new PIXI.Point();\r\n _this.maxLife = 0;\r\n _this.age = 0;\r\n _this.ease = null;\r\n _this.extraData = null;\r\n _this.alphaList = new PropertyList_1.default();\r\n _this.speedList = new PropertyList_1.default();\r\n _this.speedMultiplier = 1;\r\n /**\r\n * Acceleration to apply to the particle.\r\n * @property {PIXI.Point} accleration\r\n */\r\n _this.acceleration = new PIXI.Point();\r\n /**\r\n * The maximum speed allowed for accelerating particles. Negative values, values of 0 or NaN\r\n * will disable the maximum speed.\r\n * @property {Number} maxSpeed\r\n * @default NaN\r\n */\r\n _this.maxSpeed = NaN;\r\n /**\r\n * The scale of the particle throughout its life.\r\n * @property {PIXI.particles.PropertyList} scaleList\r\n */\r\n _this.scaleList = new PropertyList_1.default();\r\n /**\r\n * A multiplier from 0-1 applied to the scale of the particle at all times.\r\n * @property {number} scaleMultiplier\r\n */\r\n _this.scaleMultiplier = 1;\r\n /**\r\n * The tint of the particle throughout its life.\r\n * @property {PIXI.particles.PropertyList} colorList\r\n */\r\n _this.colorList = new PropertyList_1.default(true);\r\n /**\r\n * If alpha should be interpolated at all.\r\n * @property {Boolean} _doAlpha\r\n * @private\r\n */\r\n _this._doAlpha = false;\r\n /**\r\n * If scale should be interpolated at all.\r\n * @property {Boolean} _doScale\r\n * @private\r\n */\r\n _this._doScale = false;\r\n /**\r\n * If speed should be interpolated at all.\r\n * @property {Boolean} _doSpeed\r\n * @private\r\n */\r\n _this._doSpeed = false;\r\n /**\r\n * If acceleration should be handled at all. _doSpeed is mutually exclusive with this,\r\n * and _doSpeed gets priority.\r\n * @property {Boolean} _doAcceleration\r\n * @private\r\n */\r\n _this._doAcceleration = false;\r\n /**\r\n * If color should be interpolated at all.\r\n * @property {Boolean} _doColor\r\n * @private\r\n */\r\n _this._doColor = false;\r\n /**\r\n * If normal movement should be handled. Subclasses wishing to override movement\r\n * can set this to false in init().\r\n * @property {Boolean} _doNormalMovement\r\n * @private\r\n */\r\n _this._doNormalMovement = false;\r\n /**\r\n * One divided by the max life of the particle, saved for slightly faster math.\r\n * @property {Number} _oneOverLife\r\n * @private\r\n */\r\n _this._oneOverLife = 0;\r\n /**\r\n * Reference to the next particle in the list.\r\n * @property {Particle} next\r\n * @private\r\n */\r\n _this.next = null;\r\n /**\r\n * Reference to the previous particle in the list.\r\n * @property {Particle} prev\r\n * @private\r\n */\r\n _this.prev = null;\r\n //save often used functions on the instance instead of the prototype for better speed\r\n _this.init = _this.init;\r\n _this.Particle_init = Particle.prototype.init;\r\n _this.update = _this.update;\r\n _this.Particle_update = Particle.prototype.update;\r\n _this.Sprite_destroy = _super.prototype.destroy;\r\n _this.Particle_destroy = Particle.prototype.destroy;\r\n _this.applyArt = _this.applyArt;\r\n _this.kill = _this.kill;\r\n return _this;\r\n }\r\n /**\r\n * Initializes the particle for use, based on the properties that have to\r\n * have been set already on the particle.\r\n * @method PIXI.particles.Particle#init\r\n */\r\n Particle.prototype.init = function () {\r\n //reset the age\r\n this.age = 0;\r\n //set up the velocity based on the start speed and rotation\r\n this.velocity.x = this.speedList.current.value * this.speedMultiplier;\r\n this.velocity.y = 0;\r\n ParticleUtils_1.default.rotatePoint(this.rotation, this.velocity);\r\n if (this.noRotation) {\r\n this.rotation = 0;\r\n }\r\n else {\r\n //convert rotation to Radians from Degrees\r\n this.rotation *= ParticleUtils_1.default.DEG_TO_RADS;\r\n }\r\n //convert rotation speed to Radians from Degrees\r\n this.rotationSpeed *= ParticleUtils_1.default.DEG_TO_RADS;\r\n //set alpha to inital alpha\r\n this.alpha = this.alphaList.current.value;\r\n //set scale to initial scale\r\n this.scale.x = this.scale.y = this.scaleList.current.value;\r\n //figure out what we need to interpolate\r\n this._doAlpha = !!this.alphaList.current.next;\r\n this._doSpeed = !!this.speedList.current.next;\r\n this._doScale = !!this.scaleList.current.next;\r\n this._doColor = !!this.colorList.current.next;\r\n this._doAcceleration = this.acceleration.x !== 0 || this.acceleration.y !== 0;\r\n //_doNormalMovement can be cancelled by subclasses\r\n this._doNormalMovement = this._doSpeed || this.speedList.current.value !== 0 || this._doAcceleration;\r\n //save our lerp helper\r\n this._oneOverLife = 1 / this.maxLife;\r\n //set the inital color\r\n var color = this.colorList.current.value;\r\n this.tint = ParticleUtils_1.default.combineRGBComponents(color.r, color.g, color.b);\r\n //ensure visibility\r\n this.visible = true;\r\n };\r\n /**\r\n * Sets the texture for the particle. This can be overridden to allow\r\n * for an animated particle.\r\n * @method PIXI.particles.Particle#applyArt\r\n * @param {PIXI.Texture} art The texture to set.\r\n */\r\n Particle.prototype.applyArt = function (art) {\r\n this.texture = art || PIXI.Texture.EMPTY;\r\n };\r\n /**\r\n * Updates the particle.\r\n * @method PIXI.particles.Particle#update\r\n * @param {Number} delta Time elapsed since the previous frame, in __seconds__.\r\n * @return {Number} The standard interpolation multiplier (0-1) used for all relevant particle\r\n * properties. A value of -1 means the particle died of old age instead.\r\n */\r\n Particle.prototype.update = function (delta) {\r\n //increase age\r\n this.age += delta;\r\n //recycle particle if it is too old\r\n if (this.age >= this.maxLife || this.age < 0) {\r\n this.kill();\r\n return -1;\r\n }\r\n //determine our interpolation value\r\n var lerp = this.age * this._oneOverLife; //lifetime / maxLife;\r\n if (this.ease) {\r\n if (this.ease.length == 4) {\r\n //the t, b, c, d parameters that some tween libraries use\r\n //(time, initial value, end value, duration)\r\n lerp = this.ease(lerp, 0, 1, 1);\r\n }\r\n else {\r\n //the simplified version that we like that takes\r\n //one parameter, time from 0-1. TweenJS eases provide this usage.\r\n lerp = this.ease(lerp);\r\n }\r\n }\r\n //interpolate alpha\r\n if (this._doAlpha)\r\n this.alpha = this.alphaList.interpolate(lerp);\r\n //interpolate scale\r\n if (this._doScale) {\r\n var scale = this.scaleList.interpolate(lerp) * this.scaleMultiplier;\r\n this.scale.x = this.scale.y = scale;\r\n }\r\n //handle movement\r\n if (this._doNormalMovement) {\r\n //interpolate speed\r\n if (this._doSpeed) {\r\n var speed = this.speedList.interpolate(lerp) * this.speedMultiplier;\r\n ParticleUtils_1.default.normalize(this.velocity);\r\n ParticleUtils_1.default.scaleBy(this.velocity, speed);\r\n }\r\n else if (this._doAcceleration) {\r\n this.velocity.x += this.acceleration.x * delta;\r\n this.velocity.y += this.acceleration.y * delta;\r\n if (this.maxSpeed) {\r\n var currentSpeed = ParticleUtils_1.default.length(this.velocity);\r\n //if we are going faster than we should, clamp at the max speed\r\n //DO NOT recalculate vector length\r\n if (currentSpeed > this.maxSpeed) {\r\n ParticleUtils_1.default.scaleBy(this.velocity, this.maxSpeed / currentSpeed);\r\n }\r\n }\r\n }\r\n //adjust position based on velocity\r\n this.position.x += this.velocity.x * delta;\r\n this.position.y += this.velocity.y * delta;\r\n }\r\n //interpolate color\r\n if (this._doColor) {\r\n this.tint = this.colorList.interpolate(lerp);\r\n }\r\n //update rotation\r\n if (this.rotationSpeed !== 0) {\r\n this.rotation += this.rotationSpeed * delta;\r\n }\r\n else if (this.acceleration && !this.noRotation) {\r\n this.rotation = Math.atan2(this.velocity.y, this.velocity.x); // + Math.PI / 2;\r\n }\r\n return lerp;\r\n };\r\n /**\r\n * Kills the particle, removing it from the display list\r\n * and telling the emitter to recycle it.\r\n * @method PIXI.particles.Particle#kill\r\n */\r\n Particle.prototype.kill = function () {\r\n this.emitter.recycle(this);\r\n };\r\n /**\r\n * Destroys the particle, removing references and preventing future use.\r\n * @method PIXI.particles.Particle#destroy\r\n */\r\n Particle.prototype.destroy = function () {\r\n if (this.parent)\r\n this.parent.removeChild(this);\r\n this.Sprite_destroy();\r\n this.emitter = this.velocity = this.colorList = this.scaleList = this.alphaList =\r\n this.speedList = this.ease = this.next = this.prev = null;\r\n };\r\n /**\r\n * Checks over the art that was passed to the Emitter's init() function, to do any special\r\n * modifications to prepare it ahead of time.\r\n * @method PIXI.particles.Particle.parseArt\r\n * @static\r\n * @param {Array} art The array of art data. For Particle, it should be an array of Textures.\r\n * Any strings in the array will be converted to Textures via\r\n * Texture.fromImage().\r\n * @return {Array} The art, after any needed modifications.\r\n */\r\n Particle.parseArt = function (art) {\r\n //convert any strings to Textures.\r\n var i;\r\n for (i = art.length; i >= 0; --i) {\r\n if (typeof art[i] == \"string\")\r\n art[i] = PIXI.Texture.fromImage(art[i]);\r\n }\r\n //particles from different base textures will be slower in WebGL than if they\r\n //were from one spritesheet\r\n if (ParticleUtils_1.default.verbose) {\r\n for (i = art.length - 1; i > 0; --i) {\r\n if (art[i].baseTexture != art[i - 1].baseTexture) {\r\n if (window.console)\r\n console.warn(\"PixiParticles: using particle textures from different images may hinder performance in WebGL\");\r\n break;\r\n }\r\n }\r\n }\r\n return art;\r\n };\r\n /**\r\n * Parses extra emitter data to ensure it is set up for this particle class.\r\n * Particle does nothing to the extra data.\r\n * @method PIXI.particles.Particle.parseData\r\n * @static\r\n * @param {Object} extraData The extra data from the particle config.\r\n * @return {Object} The parsed extra data.\r\n */\r\n Particle.parseData = function (extraData) {\r\n return extraData;\r\n };\r\n return Particle;\r\n}(Sprite));\r\nexports.default = Particle;\r\n","\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nvar BLEND_MODES = PIXI.BLEND_MODES;\r\nvar PropertyNode_1 = require(\"./PropertyNode\");\r\n/**\r\n * Contains helper functions for particles and emitters to use.\r\n * @memberof PIXI.particles\r\n * @class ParticleUtils\r\n * @static\r\n */\r\nvar ParticleUtils = {\r\n /**\r\n * If errors and warnings should be logged within the library.\r\n * @name PIXI.particles.ParticleUtils.verbose\r\n * @default false\r\n * @static\r\n */\r\n verbose: false,\r\n DEG_TO_RADS: Math.PI / 180,\r\n /**\r\n * Rotates a point by a given angle.\r\n * @method PIXI.particles.ParticleUtils.rotatePoint\r\n * @param {Number} angle The angle to rotate by in degrees\r\n * @param {PIXI.Point} p The point to rotate around 0,0.\r\n * @static\r\n */\r\n rotatePoint: function (angle, p) {\r\n if (!angle)\r\n return;\r\n angle *= ParticleUtils.DEG_TO_RADS;\r\n var s = Math.sin(angle);\r\n var c = Math.cos(angle);\r\n var xnew = p.x * c - p.y * s;\r\n var ynew = p.x * s + p.y * c;\r\n p.x = xnew;\r\n p.y = ynew;\r\n },\r\n /**\r\n * Combines separate color components (0-255) into a single uint color.\r\n * @method PIXI.particles.ParticleUtils.combineRGBComponents\r\n * @param {uint} r The red value of the color\r\n * @param {uint} g The green value of the color\r\n * @param {uint} b The blue value of the color\r\n * @return {uint} The color in the form of 0xRRGGBB\r\n * @static\r\n */\r\n combineRGBComponents: function (r, g, b /*, a*/) {\r\n return /*a << 24 |*/ r << 16 | g << 8 | b;\r\n },\r\n /**\r\n * Reduces the point to a length of 1.\r\n * @method PIXI.particles.ParticleUtils.normalize\r\n * @static\r\n * @param {PIXI.Point} point The point to normalize\r\n */\r\n normalize: function (point) {\r\n var oneOverLen = 1 / ParticleUtils.length(point);\r\n point.x *= oneOverLen;\r\n point.y *= oneOverLen;\r\n },\r\n /**\r\n * Multiplies the x and y values of this point by a value.\r\n * @method PIXI.particles.ParticleUtils.scaleBy\r\n * @static\r\n * @param {PIXI.Point} point The point to scaleBy\r\n * @param {number} value The value to scale by.\r\n */\r\n scaleBy: function (point, value) {\r\n point.x *= value;\r\n point.y *= value;\r\n },\r\n /**\r\n * Returns the length (or magnitude) of this point.\r\n * @method PIXI.particles.ParticleUtils.length\r\n * @static\r\n * @param {PIXI.Point} point The point to measure length\r\n * @return The length of this point.\r\n */\r\n length: function (point) {\r\n return Math.sqrt(point.x * point.x + point.y * point.y);\r\n },\r\n /**\r\n * Converts a hex string from \"#AARRGGBB\", \"#RRGGBB\", \"0xAARRGGBB\", \"0xRRGGBB\",\r\n * \"AARRGGBB\", or \"RRGGBB\" to an object of ints of 0-255, as\r\n * {r, g, b, (a)}.\r\n * @method PIXI.particles.ParticleUtils.hexToRGB\r\n * @param {string} color The input color string.\r\n * @param {Object} [output] An object to put the output in. If omitted, a new object is created.\r\n * @return The object with r, g, and b properties, possibly with an a property.\r\n * @static\r\n */\r\n hexToRGB: function (color, output) {\r\n if (!output)\r\n output = {};\r\n if (color.charAt(0) == \"#\")\r\n color = color.substr(1);\r\n else if (color.indexOf(\"0x\") === 0)\r\n color = color.substr(2);\r\n var alpha;\r\n if (color.length == 8) {\r\n alpha = color.substr(0, 2);\r\n color = color.substr(2);\r\n }\r\n output.r = parseInt(color.substr(0, 2), 16); //Red\r\n output.g = parseInt(color.substr(2, 2), 16); //Green\r\n output.b = parseInt(color.substr(4, 2), 16); //Blue\r\n if (alpha)\r\n output.a = parseInt(alpha, 16);\r\n return output;\r\n },\r\n /**\r\n * Generates a custom ease function, based on the GreenSock custom ease, as demonstrated\r\n * by the related tool at http://www.greensock.com/customease/.\r\n * @method PIXI.particles.ParticleUtils.generateEase\r\n * @param {Array} segments An array of segments, as created by\r\n * http://www.greensock.com/customease/.\r\n * @return {Function} A function that calculates the percentage of change at\r\n * a given point in time (0-1 inclusive).\r\n * @static\r\n */\r\n generateEase: function (segments) {\r\n var qty = segments.length;\r\n var oneOverQty = 1 / qty;\r\n /*\r\n * Calculates the percentage of change at a given point in time (0-1 inclusive).\r\n * @param {Number} time The time of the ease, 0-1 inclusive.\r\n * @return {Number} The percentage of the change, 0-1 inclusive (unless your\r\n * ease goes outside those bounds).\r\n */\r\n return function (time) {\r\n var t, s;\r\n var i = (qty * time) | 0; //do a quick floor operation\r\n t = (time - (i * oneOverQty)) * qty;\r\n s = segments[i] || segments[qty - 1];\r\n return (s.s + t * (2 * (1 - t) * (s.cp - s.s) + t * (s.e - s.s)));\r\n };\r\n },\r\n /**\r\n * Gets a blend mode, ensuring that it is valid.\r\n * @method PIXI.particles.ParticleUtils.getBlendMode\r\n * @param {string} name The name of the blend mode to get.\r\n * @return {int} The blend mode as specified in the PIXI.BLEND_MODES enumeration.\r\n * @static\r\n */\r\n getBlendMode: function (name) {\r\n if (!name)\r\n return BLEND_MODES.NORMAL;\r\n name = name.toUpperCase();\r\n while (name.indexOf(\" \") >= 0)\r\n name = name.replace(\" \", \"_\");\r\n return BLEND_MODES[name] || BLEND_MODES.NORMAL;\r\n },\r\n /**\r\n * Converts a list of {value, time} objects starting at time 0 and ending at time 1 into an evenly\r\n * spaced stepped list of PropertyNodes for color values. This is primarily to handle conversion of\r\n * linear gradients to fewer colors, allowing for some optimization for Canvas2d fallbacks.\r\n * @method PIXI.particles.ParticleUtils.createSteppedGradient\r\n * @param {Array} list The list of data to convert.\r\n * @param {number} [numSteps=10] The number of steps to use.\r\n * @return {PIXI.particles.PropertyNode} The blend mode as specified in the PIXI.blendModes enumeration.\r\n * @static\r\n */\r\n createSteppedGradient: function (list, numSteps) {\r\n if (numSteps === void 0) { numSteps = 10; }\r\n if (typeof numSteps !== 'number' || numSteps <= 0)\r\n numSteps = 10;\r\n var first = new PropertyNode_1.default(list[0].value, list[0].time);\r\n first.isStepped = true;\r\n var currentNode = first;\r\n var current = list[0];\r\n var nextIndex = 1;\r\n var next = list[nextIndex];\r\n for (var i = 1; i < numSteps; ++i) {\r\n var lerp = i / numSteps;\r\n //ensure we are on the right segment, if multiple\r\n while (lerp > next.time) {\r\n current = next;\r\n next = list[++nextIndex];\r\n }\r\n //convert the lerp value to the segment range\r\n lerp = (lerp - current.time) / (next.time - current.time);\r\n var curVal = ParticleUtils.hexToRGB(current.value);\r\n var nextVal = ParticleUtils.hexToRGB(next.value);\r\n var output = {};\r\n output.r = (nextVal.r - curVal.r) * lerp + curVal.r;\r\n output.g = (nextVal.g - curVal.g) * lerp + curVal.g;\r\n output.b = (nextVal.b - curVal.b) * lerp + curVal.b;\r\n currentNode.next = new PropertyNode_1.default(output, i / numSteps);\r\n currentNode = currentNode.next;\r\n }\r\n //we don't need to have a PropertyNode for time of 1, because in a stepped version at that point\r\n //the particle has died of old age\r\n return first;\r\n }\r\n};\r\nexports.default = ParticleUtils;\r\n","\"use strict\";\r\nvar __extends = (this && this.__extends) || (function () {\r\n var extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return function (d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n };\r\n})();\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nvar ParticleUtils_1 = require(\"./ParticleUtils\");\r\nvar Particle_1 = require(\"./Particle\");\r\n/**\r\n * A helper point for math things.\r\n * @private\r\n */\r\nvar helperPoint = new PIXI.Point();\r\n//a hand picked list of Math functions (and a couple properties) that are allowable.\r\n//they should be used without the preceding \"Math.\"\r\nvar MATH_FUNCS = [\r\n \"pow\",\r\n \"sqrt\",\r\n \"abs\",\r\n \"floor\",\r\n \"round\",\r\n \"ceil\",\r\n \"E\",\r\n \"PI\",\r\n \"sin\",\r\n \"cos\",\r\n \"tan\",\r\n \"asin\",\r\n \"acos\",\r\n \"atan\",\r\n \"atan2\",\r\n \"log\"\r\n];\r\n//create an actual regular expression object from the string\r\nvar WHITELISTER = new RegExp([\r\n //Allow the 4 basic operations, parentheses and all numbers/decimals, as well\r\n //as 'x', for the variable usage.\r\n \"[01234567890\\\\.\\\\*\\\\-\\\\+\\\\/\\\\(\\\\)x ,]\",\r\n].concat(MATH_FUNCS).join(\"|\"), \"g\");\r\n/**\r\n * Parses a string into a function for path following.\r\n * This involves whitelisting the string for safety, inserting \"Math.\" to math function\r\n * names, and using `new Function()` to generate a function.\r\n * @method PIXI.particles.PathParticle~parsePath\r\n * @private\r\n * @static\r\n * @param {String} pathString The string to parse.\r\n * @return {Function} The path function - takes x, outputs y.\r\n */\r\nvar parsePath = function (pathString) {\r\n var matches = pathString.match(WHITELISTER);\r\n for (var i = matches.length - 1; i >= 0; --i) {\r\n if (MATH_FUNCS.indexOf(matches[i]) >= 0)\r\n matches[i] = \"Math.\" + matches[i];\r\n }\r\n pathString = matches.join(\"\");\r\n return new Function(\"x\", \"return \" + pathString + \";\");\r\n};\r\n/**\r\n * An particle that follows a path defined by an algebraic expression, e.g. \"sin(x)\" or\r\n * \"5x + 3\".\r\n * To use this class, the particle config must have a \"path\" string in the\r\n * \"extraData\" parameter. This string should have \"x\" in it to represent movement (from the\r\n * speed settings of the particle). It may have numbers, parentheses, the four basic\r\n * operations, and the following Math functions or properties (without the preceding \"Math.\"):\r\n * \"pow\", \"sqrt\", \"abs\", \"floor\", \"round\", \"ceil\", \"E\", \"PI\", \"sin\", \"cos\", \"tan\", \"asin\",\r\n * \"acos\", \"atan\", \"atan2\", \"log\".\r\n * The overall movement of the particle and the expression value become x and y positions for\r\n * the particle, respectively. The final position is rotated by the spawn rotation/angle of\r\n * the particle.\r\n *\r\n * Some example paths:\r\n *\r\n * \t\"sin(x/10) * 20\" // A sine wave path.\r\n * \t\"cos(x/100) * 30\" // Particles curve counterclockwise (for medium speed/low lifetime particles)\r\n * \t\"pow(x/10, 2) / 2\" // Particles curve clockwise (remember, +y is down).\r\n *\r\n * @memberof PIXI.particles\r\n * @class PathParticle\r\n * @extends PIXI.particles.Particle\r\n * @constructor\r\n * @param {PIXI.particles.Emitter} emitter The emitter that controls this PathParticle.\r\n */\r\nvar PathParticle = /** @class */ (function (_super) {\r\n __extends(PathParticle, _super);\r\n function PathParticle(emitter) {\r\n var _this = _super.call(this, emitter) || this;\r\n _this.path = null;\r\n _this.initialRotation = 0;\r\n _this.initialPosition = new PIXI.Point();\r\n _this.movement = 0;\r\n return _this;\r\n }\r\n /**\r\n * Initializes the particle for use, based on the properties that have to\r\n * have been set already on the particle.\r\n * @method PIXI.particles.PathParticle#init\r\n */\r\n PathParticle.prototype.init = function () {\r\n //get initial rotation before it is converted to radians\r\n this.initialRotation = this.rotation;\r\n //standard init\r\n this.Particle_init();\r\n //set the path for the particle\r\n this.path = this.extraData.path;\r\n //cancel the normal movement behavior\r\n this._doNormalMovement = !this.path;\r\n //reset movement\r\n this.movement = 0;\r\n //grab position\r\n this.initialPosition.x = this.position.x;\r\n this.initialPosition.y = this.position.y;\r\n };\r\n /**\r\n * Updates the particle.\r\n * @method PIXI.particles.PathParticle#update\r\n * @param {Number} delta Time elapsed since the previous frame, in __seconds__.\r\n */\r\n PathParticle.prototype.update = function (delta) {\r\n var lerp = this.Particle_update(delta);\r\n //if the particle died during the update, then don't bother\r\n if (lerp >= 0 && this.path) {\r\n //increase linear movement based on speed\r\n var speed = this.speedList.interpolate(lerp) * this.speedMultiplier;\r\n this.movement += speed * delta;\r\n //set up the helper point for rotation\r\n helperPoint.x = this.movement;\r\n helperPoint.y = this.path(this.movement);\r\n ParticleUtils_1.default.rotatePoint(this.initialRotation, helperPoint);\r\n this.position.x = this.initialPosition.x + helperPoint.x;\r\n this.position.y = this.initialPosition.y + helperPoint.y;\r\n }\r\n return lerp;\r\n };\r\n /**\r\n * Destroys the particle, removing references and preventing future use.\r\n * @method PIXI.particles.PathParticle#destroy\r\n */\r\n PathParticle.prototype.destroy = function () {\r\n this.Particle_destroy();\r\n this.path = this.initialPosition = null;\r\n };\r\n /**\r\n * Checks over the art that was passed to the Emitter's init() function, to do any special\r\n * modifications to prepare it ahead of time. This just runs Particle.parseArt().\r\n * @method PIXI.particles.PathParticle.parseArt\r\n * @static\r\n * @param {Array} art The array of art data. For Particle, it should be an array of Textures.\r\n * Any strings in the array will be converted to Textures via\r\n * Texture.fromImage().\r\n * @return {Array} The art, after any needed modifications.\r\n */\r\n PathParticle.parseArt = function (art) {\r\n return Particle_1.default.parseArt(art);\r\n };\r\n /**\r\n * Parses extra emitter data to ensure it is set up for this particle class.\r\n * PathParticle checks for the existence of path data, and parses the path data for use\r\n * by particle instances.\r\n * @method PIXI.particles.PathParticle.parseData\r\n * @static\r\n * @param {Object} extraData The extra data from the particle config.\r\n * @return {Object} The parsed extra data.\r\n */\r\n PathParticle.parseData = function (extraData) {\r\n var output = {};\r\n if (extraData && extraData.path) {\r\n try {\r\n output.path = parsePath(extraData.path);\r\n }\r\n catch (e) {\r\n if (ParticleUtils_1.default.verbose)\r\n console.error(\"PathParticle: error in parsing path expression\");\r\n output.path = null;\r\n }\r\n }\r\n else {\r\n if (ParticleUtils_1.default.verbose)\r\n console.error(\"PathParticle requires a path string in extraData!\");\r\n output.path = null;\r\n }\r\n return output;\r\n };\r\n return PathParticle;\r\n}(Particle_1.default));\r\nexports.default = PathParticle;\r\n","\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nvar ParticleUtils_1 = require(\"./ParticleUtils\");\r\n/**\r\n * Singly linked list container for keeping track of interpolated properties for particles.\r\n * Each Particle will have one of these for each interpolated property.\r\n * @memberof PIXI.particles\r\n * @class PropertyList\r\n * @constructor\r\n * @param {boolean} isColor If this list handles color values\r\n */\r\nvar PropertyList = /** @class */ (function () {\r\n function PropertyList(isColor) {\r\n if (isColor === void 0) { isColor = false; }\r\n this.current = null;\r\n this.next = null;\r\n this.isColor = !!isColor;\r\n this.interpolate = null;\r\n this.ease = null;\r\n }\r\n /**\r\n * Resets the list for use.\r\n * @method interpolate\r\n * @param {PIXI.particles.PropertyNode} first The first node in the list.\r\n * @param {boolean} [isStepped=false] If the values should be stepped instead of interpolated linearly.\r\n */\r\n PropertyList.prototype.reset = function (first) {\r\n this.current = first;\r\n this.next = first.next;\r\n var isSimple = this.next && this.next.time >= 1;\r\n if (isSimple) {\r\n this.interpolate = this.isColor ? intColorSimple : intValueSimple;\r\n }\r\n else if (first.isStepped) {\r\n this.interpolate = this.isColor ? intColorStepped : intValueStepped;\r\n }\r\n else {\r\n this.interpolate = this.isColor ? intColorComplex : intValueComplex;\r\n }\r\n this.ease = this.current.ease;\r\n };\r\n return PropertyList;\r\n}());\r\nexports.default = PropertyList;\r\nfunction intValueSimple(lerp) {\r\n if (this.ease)\r\n lerp = this.ease(lerp);\r\n return (this.next.value - this.current.value) * lerp + this.current.value;\r\n}\r\nfunction intColorSimple(lerp) {\r\n if (this.ease)\r\n lerp = this.ease(lerp);\r\n var curVal = this.current.value, nextVal = this.next.value;\r\n var r = (nextVal.r - curVal.r) * lerp + curVal.r;\r\n var g = (nextVal.g - curVal.g) * lerp + curVal.g;\r\n var b = (nextVal.b - curVal.b) * lerp + curVal.b;\r\n return ParticleUtils_1.default.combineRGBComponents(r, g, b);\r\n}\r\nfunction intValueComplex(lerp) {\r\n if (this.ease)\r\n lerp = this.ease(lerp);\r\n //make sure we are on the right segment\r\n while (lerp > this.next.time) {\r\n this.current = this.next;\r\n this.next = this.next.next;\r\n }\r\n //convert the lerp value to the segment range\r\n lerp = (lerp - this.current.time) / (this.next.time - this.current.time);\r\n return (this.next.value - this.current.value) * lerp + this.current.value;\r\n}\r\nfunction intColorComplex(lerp) {\r\n if (this.ease)\r\n lerp = this.ease(lerp);\r\n //make sure we are on the right segment\r\n while (lerp > this.next.time) {\r\n this.current = this.next;\r\n this.next = this.next.next;\r\n }\r\n //convert the lerp value to the segment range\r\n lerp = (lerp - this.current.time) / (this.next.time - this.current.time);\r\n var curVal = this.current.value, nextVal = this.next.value;\r\n var r = (nextVal.r - curVal.r) * lerp + curVal.r;\r\n var g = (nextVal.g - curVal.g) * lerp + curVal.g;\r\n var b = (nextVal.b - curVal.b) * lerp + curVal.b;\r\n return ParticleUtils_1.default.combineRGBComponents(r, g, b);\r\n}\r\nfunction intValueStepped(lerp) {\r\n if (this.ease)\r\n lerp = this.ease(lerp);\r\n //make sure we are on the right segment\r\n while (this.next && lerp > this.next.time) {\r\n this.current = this.next;\r\n this.next = this.next.next;\r\n }\r\n return this.current.value;\r\n}\r\nfunction intColorStepped(lerp) {\r\n if (this.ease)\r\n lerp = this.ease(lerp);\r\n //make sure we are on the right segment\r\n while (this.next && lerp > this.next.time) {\r\n this.current = this.next;\r\n this.next = this.next.next;\r\n }\r\n var curVal = this.current.value;\r\n return ParticleUtils_1.default.combineRGBComponents(curVal.r, curVal.g, curVal.b);\r\n}\r\n","\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nvar ParticleUtils_1 = require(\"./ParticleUtils\");\r\n/**\r\n * A single node in a PropertyList.\r\n * @memberof PIXI.particles\r\n * @class PropertyNode\r\n * @constructor\r\n * @param {number|string} value The value for this node\r\n * @param {number} time The time for this node, between 0-1\r\n * @param {Function|Array} [ease] Custom ease for this list. Only relevant for the first node.\r\n */\r\nvar PropertyNode = /** @class */ (function () {\r\n function PropertyNode(value, time, ease) {\r\n this.value = typeof value == \"string\" ? ParticleUtils_1.default.hexToRGB(value) : value;\r\n this.time = time;\r\n this.next = null;\r\n this.isStepped = false;\r\n if (ease) {\r\n this.ease = typeof ease == \"function\" ? ease : ParticleUtils_1.default.generateEase(ease);\r\n }\r\n else {\r\n this.ease = null;\r\n }\r\n }\r\n /**\r\n * Creates a list of property values from a data object {list, isStepped} with a list of objects in\r\n * the form {value, time}. Alternatively, the data object can be in the deprecated form of\r\n * {start, end}.\r\n * @method PIXI.particles.PropertyNode.createListFromArray\r\n * @static\r\n * @param {Object} data The data for the list.\r\n * @param {Array} data.list The array of value and time objects.\r\n * @param {boolean} [data.isStepped] If the list is stepped rather than interpolated.\r\n * @param {Function|Array} [data.ease] Custom ease for this list.\r\n * @return {PIXI.particles.PropertyNode} The first node in the list\r\n */\r\n PropertyNode.createList = function (data) {\r\n if (Array.isArray(data.list)) {\r\n var array = data.list;\r\n var node = void 0, first = void 0;\r\n first = node = new PropertyNode(array[0].value, array[0].time, data.ease);\r\n //only set up subsequent nodes if there are a bunch or the 2nd one is different from the first\r\n if (array.length > 2 || (array.length === 2 && array[1].value !== array[0].value)) {\r\n for (var i = 1; i < array.length; ++i) {\r\n node.next = new PropertyNode(array[i].value, array[i].time);\r\n node = node.next;\r\n }\r\n }\r\n first.isStepped = !!data.isStepped;\r\n return first;\r\n }\r\n else {\r\n //Handle deprecated version here\r\n var start = new PropertyNode(data.start, 0);\r\n //only set up a next value if it is different from the starting value\r\n if (data.end !== data.start)\r\n start.next = new PropertyNode(data.end, 1);\r\n return start;\r\n }\r\n };\r\n return PropertyNode;\r\n}());\r\nexports.default = PropertyNode;\r\n","\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nvar ParticleUtils_js_1 = require(\"./ParticleUtils.js\");\r\nexports.ParticleUtils = ParticleUtils_js_1.default;\r\nvar Particle_js_1 = require(\"./Particle.js\");\r\nexports.Particle = Particle_js_1.default;\r\nvar Emitter_js_1 = require(\"./Emitter.js\");\r\nexports.Emitter = Emitter_js_1.default;\r\nvar PathParticle_js_1 = require(\"./PathParticle.js\");\r\nexports.PathParticle = PathParticle_js_1.default;\r\nvar AnimatedParticle_js_1 = require(\"./AnimatedParticle.js\");\r\nexports.AnimatedParticle = AnimatedParticle_js_1.default;\r\n","\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\n// If we're in the browser make sure PIXI is available\r\nif (typeof PIXI === 'undefined') {\r\n throw \"pixi-particles requires pixi.js to be loaded first\";\r\n}\r\n//ensure that the particles namespace exist - PIXI 4 creates it itself, PIXI 3 does not\r\nif (!PIXI.particles) {\r\n PIXI.particles = {};\r\n}\r\n// get the library itself\r\nvar particles = require(\"./particles\");\r\n// insert the library into the particles namespace on PIXI\r\nfor (var prop in particles) {\r\n PIXI.particles[prop] = particles[prop];\r\n}\r\nif (typeof module !== \"undefined\" && module.exports) {\r\n module.exports = particles;\r\n}\r\n"],"sourceRoot":"."} |