From 0b4ec182a26f38472fe3d86529edc80ca62d5f50 Mon Sep 17 00:00:00 2001 From: ics-ikeda Date: Tue, 17 Apr 2018 18:58:04 +0900 Subject: [PATCH] =?UTF-8?q?Shape=E7=B3=BBAsset=E3=82=92JS=E3=81=A7?= =?UTF-8?q?=E3=81=AF=E3=81=AA=E3=81=8F=E3=80=81TS=E3=81=A7=E3=83=90?= =?UTF-8?q?=E3=83=B3=E3=83=89=E3=83=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- libs/d.ts/asset-shapes.d.ts | 2 + libs/d.ts/particlejs.d.ts | 4 +- libs/particlejs.js | 554 +++++++++++++++++++++------------- libs/particlejs.min.js | 2 +- src/asset-shapes.js | 215 ------------- src/asset-shapes.ts | 417 +++++++++++++++++++++++++ src/assets/shape-generator.ts | 5 +- src/particlejs.ts | 4 +- 8 files changed, 766 insertions(+), 437 deletions(-) create mode 100644 libs/d.ts/asset-shapes.d.ts delete mode 100644 src/asset-shapes.js create mode 100644 src/asset-shapes.ts diff --git a/libs/d.ts/asset-shapes.d.ts b/libs/d.ts/asset-shapes.d.ts new file mode 100644 index 0000000..6c1a8c2 --- /dev/null +++ b/libs/d.ts/asset-shapes.d.ts @@ -0,0 +1,2 @@ +declare var Assets: {}; +export { Assets }; diff --git a/libs/d.ts/particlejs.d.ts b/libs/d.ts/particlejs.d.ts index 9a6b480..0dbd6bd 100644 --- a/libs/d.ts/particlejs.d.ts +++ b/libs/d.ts/particlejs.d.ts @@ -1,4 +1,4 @@ -import { assets } from "./asset-shapes.js"; +import { Assets } from "./asset-shapes"; import { ShapeGenerator } from "./assets/shape-generator"; import { ColorData } from "./data/data-color"; import { DrawingData } from "./data/data-drawing"; @@ -7,4 +7,4 @@ import { AlphaCurveType } from "./enum/alpha-curve-type"; import { ShapeType } from "./enum/shape-type"; import { Particle } from "./particle/particle"; import { ParticleSystem, VERSION } from "./particle/particle-system"; -export { ParticleSystem, Particle, VERSION, DrawingData, ColorData, ShapeData, ShapeGenerator, AlphaCurveType, ShapeType, assets }; +export { ParticleSystem, Particle, VERSION, DrawingData, ColorData, ShapeData, ShapeGenerator, AlphaCurveType, ShapeType, Assets }; diff --git a/libs/particlejs.js b/libs/particlejs.js index b62534d..b2f9504 100644 --- a/libs/particlejs.js +++ b/libs/particlejs.js @@ -86,221 +86,348 @@ return /******/ (function(modules) { // webpackBootstrap "use strict"; __webpack_require__.r(__webpack_exports__); -// CONCATENATED MODULE: ./src/asset-shapes.js -var lib = {}; +// CONCATENATED MODULE: ./src/asset-shapes.ts +var Assets = {}; var asset_shapes_images = {}; -var asset_shapes_createjs = window.createjs; +var asset_shapes_createjs = window["createjs"]; var ss = {}; - (function (lib, img, cjs, ss) { + var p; // shortcut to reference prototypes + // library properties: + lib.properties = { + width: 550, + height: 400, + fps: 24, + color: "#999999", + manifest: [] + }; + // symbols: + (lib.triangle = function () { + this.initialize(); + // レイヤー 1 + this.shape = new cjs.Shape(); + this.shape.graphics + .beginFill("#FFFFFF") + .beginStroke() + .moveTo(-0.7, -27.8) + .lineTo(32, 27.1) + .lineTo(-32, 27.8) + .closePath(); + this.shape.setTransform(0, -7); + this.addChild(this.shape); + }).prototype = p = new cjs.Container(); + p.nominalBounds = new cjs.Rectangle(-32, -34.8, 64, 55.7); + (lib.star_10 = function () { + this.initialize(); + // レイヤー 1 + this.shape = new cjs.Shape(); + this.shape.graphics + .beginFill("#FFFFFF") + .beginStroke() + .moveTo(-4.3, 18.3) + .lineTo(-19.9, 29.3) + .lineTo(-14.1, 10.3) + .lineTo(-32, 10.3) + .lineTo(-19.7, 0.7) + .lineTo(-31.2, -8.7) + .lineTo(-15.2, -8.8) + .lineTo(-21.7, -26.4) + .lineTo(-5.4, -16.4) + .lineTo(-0.2, -31.8) + .lineTo(4.4, -17.6) + .lineTo(17.8, -27.4) + .lineTo(13.1, -8.5) + .lineTo(30.3, -8.1) + .lineTo(19.9, 0.1) + .lineTo(32, 8.4) + .lineTo(12.8, 9.5) + .lineTo(18.2, 29.8) + .lineTo(4.9, 20) + .lineTo(1.4, 31.8) + .closePath(); + this.addChild(this.shape); + }).prototype = p = new cjs.Container(); + p.nominalBounds = new cjs.Rectangle(-32, -31.7, 64, 63.6); + (lib.star = function () { + this.initialize(); + // レイヤー 1 + this.shape = new cjs.Shape(); + this.shape.graphics + .beginFill("#FFFFFF") + .beginStroke() + .moveTo(-0.2, 17.3) + .lineTo(-20.2, 31.5) + .lineTo(-13, 7.4) + .lineTo(-32, -8) + .lineTo(-7.8, -8.4) + .lineTo(0.3, -32) + .lineTo(8, -8.2) + .lineTo(32, -7.4) + .lineTo(12.8, 7.5) + .lineTo(19.4, 32) + .closePath(); + this.addChild(this.shape); + }).prototype = p = new cjs.Container(); + p.nominalBounds = new cjs.Rectangle(-32, -32, 64, 64); + (lib.square = function () { + this.initialize(); + // レイヤー 1 + this.shape = new cjs.Shape(); + this.shape.graphics + .beginFill() + .beginStroke("#FFFFFF") + .setStrokeStyle(8, 1, 1) + .moveTo(-32, -32) + .lineTo(32, -32) + .lineTo(32, 32) + .lineTo(-32, 32) + .closePath(); + this.addChild(this.shape); + }).prototype = p = new cjs.Container(); + p.nominalBounds = new cjs.Rectangle(-36, -36, 72, 72); + (lib.reverse_blur_circle = function () { + this.initialize(); + // レイヤー 1 + this.shape = new cjs.Shape(); + this.shape.graphics + .beginFill() + .beginStroke("#FFFFFF") + .setStrokeStyle(8, 1, 1) + .moveTo(32, 0) + .curveTo(32, 13.2, 22.6, 22.6) + .curveTo(13.3, 32, 0, 32) + .curveTo(-13.2, 32, -22.7, 22.6) + .curveTo(-32, 13.2, -32, 0) + .curveTo(-32, -13.3, -22.7, -22.7) + .curveTo(-13.2, -32, 0, -32) + .curveTo(13.3, -32, 22.6, -22.7) + .curveTo(32, -13.3, 32, 0) + .closePath(); + this.addChild(this.shape); + }).prototype = p = new cjs.Container(); + p.nominalBounds = new cjs.Rectangle(-36, -36, 72, 72); + (lib.kirakira2 = function () { + this.initialize(); + // レイヤー 1 + this.shape = new cjs.Shape(); + this.shape.graphics + .beginFill("#FFFFFF") + .beginStroke() + .moveTo(-4, 9.5) + .curveTo(-7.8, 0, -13.4, -0.1) + .curveTo(-7.8, -0.2, -4, -9.9) + .curveTo(-0.1, -19.2, 0, -32) + .curveTo(0.1, -19.2, 4, -9.9) + .curveTo(8, -0.2, 13.4, -0.1) + .curveTo(8, 0, 4, 9.5) + .curveTo(0.1, 19, 0, 32) + .curveTo(-0.1, 19, -4, 9.5) + .closePath(); + this.addChild(this.shape); + }).prototype = p = new cjs.Container(); + p.nominalBounds = new cjs.Rectangle(-13.4, -32, 26.8, 64); + (lib.kirakira = function () { + this.initialize(); + // レイヤー 1 + this.shape = new cjs.Shape(); + this.shape.graphics + .beginFill("#FFFFFF") + .beginStroke() + .moveTo(-9.6, 9.3) + .curveTo(-18.9, 0, -32, -0.1) + .curveTo(-18.9, -0.2, -9.6, -9.6) + .curveTo(-0.2, -19, -0.1, -32) + .curveTo(0, -19, 9.4, -9.6) + .curveTo(18.9, -0.2, 32, -0.1) + .curveTo(18.9, 0, 9.4, 9.3) + .curveTo(0, 18.8, -0.1, 32) + .curveTo(-0.2, 18.8, -9.6, 9.3) + .closePath(); + this.addChild(this.shape); + }).prototype = p = new cjs.Container(); + p.nominalBounds = new cjs.Rectangle(-32, -32, 64, 64); + (lib.heart = function () { + this.initialize(); + // レイヤー 1 + this.shape = new cjs.Shape(); + this.shape.graphics + .beginFill("#FFFFFF") + .beginStroke() + .moveTo(-20.2, 10) + .lineTo(-24.8, 3.5) + .curveTo(-27, 0.1, -28.5, -3.1) + .curveTo(-30.1, -6.4, -31.1, -9.5) + .curveTo(-32, -13, -32, -16) + .curveTo(-32, -19.7, -30.4, -22.7) + .curveTo(-29.1, -25.4, -26.6, -27.4) + .curveTo(-24, -29.1, -21, -30.1) + .curveTo(-18.1, -31.1, -15, -31.1) + .curveTo(-11.7, -31.1, -8.8, -29.9) + .curveTo(-6.4, -29, -4.5, -27.4) + .curveTo(-3, -25.9, -1.7, -23.9) + .lineTo(0, -20.8) + .lineTo(1.7, -23.9) + .curveTo(3, -25.9, 4.5, -27.4) + .curveTo(6.6, -29.1, 8.8, -29.9) + .curveTo(11.7, -31.1, 15.2, -31.1) + .curveTo(18.4, -31.1, 21.3, -30.1) + .curveTo(24.2, -29.1, 26.7, -27.2) + .curveTo(29.1, -25.3, 30.5, -22.6) + .curveTo(32, -19.7, 32, -16.1) + .curveTo(32, -13.3, 31, -9.7) + .curveTo(30.2, -6.5, 28.5, -3.2) + .curveTo(27.1, 0, 24.9, 3.3) + .lineTo(20.3, 9.7) + .curveTo(13.4, 17.7, 9.7, 21.6) + .lineTo(0, 31) + .curveTo(-13.6, 18.3, -20.2, 10) + .closePath(); + this.addChild(this.shape); + }).prototype = p = new cjs.Container(); + p.nominalBounds = new cjs.Rectangle(-32, -31, 64, 62.1); + (lib.flower = function () { + this.initialize(); + // レイヤー 1 + this.shape = new cjs.Shape(); + this.shape.graphics + .beginFill("#FFFFFF") + .beginStroke() + .moveTo(4, 27.3) + .curveTo(0.5, 23.7, 0.5, 18.9) + .lineTo(0.5, 15.2) + .lineTo(-0.5, 15.2) + .lineTo(-0.7, 18.9) + .curveTo(-0.9, 24, -4.1, 27.6) + .curveTo(-7.4, 31.1, -12.1, 31.1) + .curveTo(-17, 31.1, -20.8, 27.5) + .curveTo(-24.7, 23.7, -24.7, 19.1) + .curveTo(-24.7, 15.3, -22.2, 12.1) + .curveTo(-19.7, 8.8, -16.1, 7.7) + .lineTo(-12.5, 6.4) + .lineTo(-12.7, 5.8) + .lineTo(-13, 5.4) + .lineTo(-16.5, 6.6) + .lineTo(-20.2, 7.1) + .curveTo(-25.3, 7.1, -28.7, 4) + .curveTo(-32, 0.7, -32, -4.1) + .curveTo(-32, -9.4, -28.7, -13) + .curveTo(-25.5, -16.8, -20.6, -16.8) + .curveTo(-17.8, -16.8, -15, -15.4) + .curveTo(-12.2, -14, -10.5, -11.6) + .lineTo(-8.4, -8.7) + .lineTo(-8, -8.8) + .lineTo(-7.4, -9.3) + .lineTo(-9.6, -12.2) + .curveTo(-10.7, -14, -11.3, -15.8) + .curveTo(-11.9, -17.9, -12, -19.9) + .curveTo(-12, -24.7, -8.5, -28) + .curveTo(-5.3, -31.1, -0.1, -31.1) + .curveTo(5.2, -31.1, 8.5, -28) + .curveTo(11.7, -24.7, 11.8, -19.9) + .curveTo(11.7, -17.7, 11.2, -15.7) + .curveTo(10.7, -13.8, 9.5, -12.2) + .lineTo(7.4, -9.3) + .lineTo(7.8, -9) + .lineTo(8.2, -8.7) + .lineTo(10.5, -11.6) + .curveTo(12.2, -14, 14.8, -15.4) + .curveTo(17.6, -16.8, 20.4, -16.8) + .curveTo(25.3, -16.8, 28.5, -13) + .curveTo(32, -9.4, 32, -4.1) + .curveTo(32, 0.8, 28.5, 4) + .curveTo(25.3, 7.1, 20, 7.1) + .lineTo(16.4, 6.6) + .lineTo(12.9, 5.5) + .curveTo(12.8, 5.6, 12.8, 5.6) + .curveTo(12.7, 5.7, 12.7, 5.7) + .curveTo(12.7, 5.8, 12.7, 5.8) + .curveTo(12.7, 5.9, 12.7, 6) + .lineTo(12.5, 6.4) + .lineTo(15.9, 7.7) + .curveTo(19.7, 9.1, 22.1, 12.2) + .curveTo(24.5, 15.3, 24.5, 19.1) + .curveTo(24.5, 23.7, 20.8, 27.5) + .curveTo(16.9, 31.1, 11.9, 31.1) + .curveTo(7.4, 31.1, 4, 27.3) + .closePath() + .moveTo(-7.7, -5.9) + .curveTo(-10.9, -2.7, -10.9, 1.8) + .curveTo(-10.9, 6.3, -7.7, 9.4) + .curveTo(-4.6, 12.5, -0.1, 12.5) + .curveTo(4.4, 12.5, 7.6, 9.4) + .curveTo(10.6, 6.3, 10.6, 1.8) + .curveTo(10.6, -2.7, 7.6, -5.9) + .curveTo(4.4, -9, -0.1, -9) + .curveTo(-4.6, -9, -7.7, -5.9) + .closePath(); + this.addChild(this.shape); + }).prototype = p = new cjs.Container(); + p.nominalBounds = new cjs.Rectangle(-32, -31, 64, 62.2); + (lib.circle = function () { + this.initialize(); + // レイヤー 1 + this.shape = new cjs.Shape(); + this.shape.graphics + .beginFill("#FFFFFF") + .beginStroke() + .drawEllipse(-10.8, -10.8, 21.7, 21.7); + this.shape.setTransform(0, 0, 2.949, 2.949); + this.addChild(this.shape); + }).prototype = p = new cjs.Container(); + p.nominalBounds = new cjs.Rectangle(-32, -32, 64, 64); + (lib.blur_circle = function () { + this.initialize(); + // レイヤー 1 + this.shape = new cjs.Shape(); + this.shape.graphics + .beginRadialGradientFill(["#FFFFFF", "rgba(255,255,255,0)"], [0, 1], 0, 0, 0, 0, 0, 11) + .beginStroke() + .drawEllipse(-10.8, -10.8, 21.7, 21.7); + this.shape.setTransform(0, 0, 3, 3); + this.addChild(this.shape); + }).prototype = p = new cjs.Container(); + p.nominalBounds = new cjs.Rectangle(-32.5, -32.5, 65.1, 65.1); + // stage content: + (lib.assetshapes = function () { + this.initialize(); + // triangle + this.instance = new lib.triangle(); + this.instance.setTransform(323.6, 39.6); + // square + this.instance_1 = new lib.square(); + this.instance_1.setTransform(518, 151.5); + // kirakira2 + this.instance_2 = new lib.kirakira2(); + this.instance_2.setTransform(420.8, 32.6); + // kirakira + this.instance_3 = new lib.kirakira(); + this.instance_3.setTransform(32, 151.5); + // flower + this.instance_4 = new lib.flower(); + this.instance_4.setTransform(396.5, 151.5); + // star_10 + this.instance_5 = new lib.star_10(); + this.instance_5.setTransform(518, 32.6); + // star + this.instance_6 = new lib.star(); + this.instance_6.setTransform(275, 151.5); + // circle + this.instance_7 = new lib.circle(); + this.instance_7.setTransform(226.4, 32.6); + // reverse_blur_circle + this.instance_8 = new lib.reverse_blur_circle(); + this.instance_8.setTransform(153.5, 151.5); + // blur_circle + this.instance_9 = new lib.blur_circle(); + this.instance_9.setTransform(129.2, 32.6); + // heart + this.instance_10 = new lib.heart(); + this.instance_10.setTransform(32, 32.6); + this.addChild(this.instance_10, this.instance_9, this.instance_8, this.instance_7, this.instance_6, this.instance_5, this.instance_4, this.instance_3, this.instance_2, this.instance_1, this.instance); + }).prototype = p = new cjs.Container(); + p.nominalBounds = new cjs.Rectangle(275, 200, 554, 187.5); +})((Assets = Assets || {}), (asset_shapes_images = asset_shapes_images || {}), (asset_shapes_createjs = asset_shapes_createjs || {}), (ss = ss || {})); -var p; // shortcut to reference prototypes - -// library properties: -lib.properties = { - width: 550, - height: 400, - fps: 24, - color: "#999999", - manifest: [] -}; - - - -// symbols: - - - -(lib.triangle = function() { - this.initialize(); - - // レイヤー 1 - this.shape = new cjs.Shape(); - this.shape.graphics.beginFill("#FFFFFF").beginStroke().moveTo(-0.7,-27.8).lineTo(32,27.1).lineTo(-32,27.8).closePath(); - this.shape.setTransform(0,-7); - - this.addChild(this.shape); -}).prototype = p = new cjs.Container(); -p.nominalBounds = new cjs.Rectangle(-32,-34.8,64,55.7); - - -(lib.star_10 = function() { - this.initialize(); - - // レイヤー 1 - this.shape = new cjs.Shape(); - this.shape.graphics.beginFill("#FFFFFF").beginStroke().moveTo(-4.3,18.3).lineTo(-19.9,29.3).lineTo(-14.1,10.3).lineTo(-32,10.3).lineTo(-19.7,0.7).lineTo(-31.2,-8.7).lineTo(-15.2,-8.8).lineTo(-21.7,-26.4).lineTo(-5.4,-16.4).lineTo(-0.2,-31.8).lineTo(4.4,-17.6).lineTo(17.8,-27.4).lineTo(13.1,-8.5).lineTo(30.3,-8.1).lineTo(19.9,0.1).lineTo(32,8.4).lineTo(12.8,9.5).lineTo(18.2,29.8).lineTo(4.9,20).lineTo(1.4,31.8).closePath(); - - this.addChild(this.shape); -}).prototype = p = new cjs.Container(); -p.nominalBounds = new cjs.Rectangle(-32,-31.7,64,63.6); - - -(lib.star = function() { - this.initialize(); - - // レイヤー 1 - this.shape = new cjs.Shape(); - this.shape.graphics.beginFill("#FFFFFF").beginStroke().moveTo(-0.2,17.3).lineTo(-20.2,31.5).lineTo(-13,7.4).lineTo(-32,-8).lineTo(-7.8,-8.4).lineTo(0.3,-32).lineTo(8,-8.2).lineTo(32,-7.4).lineTo(12.8,7.5).lineTo(19.4,32).closePath(); - - this.addChild(this.shape); -}).prototype = p = new cjs.Container(); -p.nominalBounds = new cjs.Rectangle(-32,-32,64,64); - - -(lib.square = function() { - this.initialize(); - - // レイヤー 1 - this.shape = new cjs.Shape(); - this.shape.graphics.beginFill().beginStroke("#FFFFFF").setStrokeStyle(8,1,1).moveTo(-32,-32).lineTo(32,-32).lineTo(32,32).lineTo(-32,32).closePath(); - - this.addChild(this.shape); -}).prototype = p = new cjs.Container(); -p.nominalBounds = new cjs.Rectangle(-36,-36,72,72); - - -(lib.reverse_blur_circle = function() { - this.initialize(); - - // レイヤー 1 - this.shape = new cjs.Shape(); - this.shape.graphics.beginFill().beginStroke("#FFFFFF").setStrokeStyle(8,1,1).moveTo(32,0).curveTo(32,13.2,22.6,22.6).curveTo(13.3,32,0,32).curveTo(-13.2,32,-22.7,22.6).curveTo(-32,13.2,-32,0).curveTo(-32,-13.3,-22.7,-22.7).curveTo(-13.2,-32,0,-32).curveTo(13.3,-32,22.6,-22.7).curveTo(32,-13.3,32,0).closePath(); - - this.addChild(this.shape); -}).prototype = p = new cjs.Container(); -p.nominalBounds = new cjs.Rectangle(-36,-36,72,72); - - -(lib.kirakira2 = function() { - this.initialize(); - - // レイヤー 1 - this.shape = new cjs.Shape(); - this.shape.graphics.beginFill("#FFFFFF").beginStroke().moveTo(-4,9.5).curveTo(-7.8,0,-13.4,-0.1).curveTo(-7.8,-0.2,-4,-9.9).curveTo(-0.1,-19.2,0,-32).curveTo(0.1,-19.2,4,-9.9).curveTo(8,-0.2,13.4,-0.1).curveTo(8,0,4,9.5).curveTo(0.1,19,0,32).curveTo(-0.1,19,-4,9.5).closePath(); - - this.addChild(this.shape); -}).prototype = p = new cjs.Container(); -p.nominalBounds = new cjs.Rectangle(-13.4,-32,26.8,64); - - -(lib.kirakira = function() { - this.initialize(); - - // レイヤー 1 - this.shape = new cjs.Shape(); - this.shape.graphics.beginFill("#FFFFFF").beginStroke().moveTo(-9.6,9.3).curveTo(-18.9,0,-32,-0.1).curveTo(-18.9,-0.2,-9.6,-9.6).curveTo(-0.2,-19,-0.1,-32).curveTo(0,-19,9.4,-9.6).curveTo(18.9,-0.2,32,-0.1).curveTo(18.9,0,9.4,9.3).curveTo(0,18.8,-0.1,32).curveTo(-0.2,18.8,-9.6,9.3).closePath(); - - this.addChild(this.shape); -}).prototype = p = new cjs.Container(); -p.nominalBounds = new cjs.Rectangle(-32,-32,64,64); - - -(lib.heart = function() { - this.initialize(); - - // レイヤー 1 - this.shape = new cjs.Shape(); - this.shape.graphics.beginFill("#FFFFFF").beginStroke().moveTo(-20.2,10).lineTo(-24.8,3.5).curveTo(-27,0.1,-28.5,-3.1).curveTo(-30.1,-6.4,-31.1,-9.5).curveTo(-32,-13,-32,-16).curveTo(-32,-19.7,-30.4,-22.7).curveTo(-29.1,-25.4,-26.6,-27.4).curveTo(-24,-29.1,-21,-30.1).curveTo(-18.1,-31.1,-15,-31.1).curveTo(-11.7,-31.1,-8.8,-29.9).curveTo(-6.4,-29,-4.5,-27.4).curveTo(-3,-25.9,-1.7,-23.9).lineTo(0,-20.8).lineTo(1.7,-23.9).curveTo(3,-25.9,4.5,-27.4).curveTo(6.6,-29.1,8.8,-29.9).curveTo(11.7,-31.1,15.2,-31.1).curveTo(18.4,-31.1,21.3,-30.1).curveTo(24.2,-29.1,26.7,-27.2).curveTo(29.1,-25.3,30.5,-22.6).curveTo(32,-19.7,32,-16.1).curveTo(32,-13.3,31,-9.7).curveTo(30.2,-6.5,28.5,-3.2).curveTo(27.1,0,24.9,3.3).lineTo(20.3,9.7).curveTo(13.4,17.7,9.7,21.6).lineTo(0,31).curveTo(-13.6,18.3,-20.2,10).closePath(); - - this.addChild(this.shape); -}).prototype = p = new cjs.Container(); -p.nominalBounds = new cjs.Rectangle(-32,-31,64,62.1); - - -(lib.flower = function() { - this.initialize(); - - // レイヤー 1 - this.shape = new cjs.Shape(); - this.shape.graphics.beginFill("#FFFFFF").beginStroke().moveTo(4,27.3).curveTo(0.5,23.7,0.5,18.9).lineTo(0.5,15.2).lineTo(-0.5,15.2).lineTo(-0.7,18.9).curveTo(-0.9,24,-4.1,27.6).curveTo(-7.4,31.1,-12.1,31.1).curveTo(-17,31.1,-20.8,27.5).curveTo(-24.7,23.7,-24.7,19.1).curveTo(-24.7,15.3,-22.2,12.1).curveTo(-19.7,8.8,-16.1,7.7).lineTo(-12.5,6.4).lineTo(-12.7,5.8).lineTo(-13,5.4).lineTo(-16.5,6.6).lineTo(-20.2,7.1).curveTo(-25.3,7.1,-28.7,4).curveTo(-32,0.7,-32,-4.1).curveTo(-32,-9.4,-28.7,-13).curveTo(-25.5,-16.8,-20.6,-16.8).curveTo(-17.8,-16.8,-15,-15.4).curveTo(-12.2,-14,-10.5,-11.6).lineTo(-8.4,-8.7).lineTo(-8,-8.8).lineTo(-7.4,-9.3).lineTo(-9.6,-12.2).curveTo(-10.7,-14,-11.3,-15.8).curveTo(-11.9,-17.9,-12,-19.9).curveTo(-12,-24.7,-8.5,-28).curveTo(-5.3,-31.1,-0.1,-31.1).curveTo(5.2,-31.1,8.5,-28).curveTo(11.7,-24.7,11.8,-19.9).curveTo(11.7,-17.7,11.2,-15.7).curveTo(10.7,-13.8,9.5,-12.2).lineTo(7.4,-9.3).lineTo(7.8,-9).lineTo(8.2,-8.7).lineTo(10.5,-11.6).curveTo(12.2,-14,14.8,-15.4).curveTo(17.6,-16.8,20.4,-16.8).curveTo(25.3,-16.8,28.5,-13).curveTo(32,-9.4,32,-4.1).curveTo(32,0.8,28.5,4).curveTo(25.3,7.1,20,7.1).lineTo(16.4,6.6).lineTo(12.9,5.5).curveTo(12.8,5.6,12.8,5.6).curveTo(12.7,5.7,12.7,5.7).curveTo(12.7,5.8,12.7,5.8).curveTo(12.7,5.9,12.7,6).lineTo(12.5,6.4).lineTo(15.9,7.7).curveTo(19.7,9.1,22.1,12.2).curveTo(24.5,15.3,24.5,19.1).curveTo(24.5,23.7,20.8,27.5).curveTo(16.9,31.1,11.9,31.1).curveTo(7.4,31.1,4,27.3).closePath().moveTo(-7.7,-5.9).curveTo(-10.9,-2.7,-10.9,1.8).curveTo(-10.9,6.3,-7.7,9.4).curveTo(-4.6,12.5,-0.1,12.5).curveTo(4.4,12.5,7.6,9.4).curveTo(10.6,6.3,10.6,1.8).curveTo(10.6,-2.7,7.6,-5.9).curveTo(4.4,-9,-0.1,-9).curveTo(-4.6,-9,-7.7,-5.9).closePath(); - - this.addChild(this.shape); -}).prototype = p = new cjs.Container(); -p.nominalBounds = new cjs.Rectangle(-32,-31,64,62.2); - - -(lib.circle = function() { - this.initialize(); - - // レイヤー 1 - this.shape = new cjs.Shape(); - this.shape.graphics.beginFill("#FFFFFF").beginStroke().drawEllipse(-10.8,-10.8,21.7,21.7); - this.shape.setTransform(0,0,2.949,2.949); - - this.addChild(this.shape); -}).prototype = p = new cjs.Container(); -p.nominalBounds = new cjs.Rectangle(-32,-32,64,64); - - -(lib.blur_circle = function() { - this.initialize(); - - // レイヤー 1 - this.shape = new cjs.Shape(); - this.shape.graphics.beginRadialGradientFill(["#FFFFFF","rgba(255,255,255,0)"],[0,1],0,0,0,0,0,11).beginStroke().drawEllipse(-10.8,-10.8,21.7,21.7); - this.shape.setTransform(0,0,3,3); - - this.addChild(this.shape); -}).prototype = p = new cjs.Container(); -p.nominalBounds = new cjs.Rectangle(-32.5,-32.5,65.1,65.1); - - -// stage content: -(lib.assetshapes = function() { - this.initialize(); - - // triangle - this.instance = new lib.triangle(); - this.instance.setTransform(323.6,39.6); - - // square - this.instance_1 = new lib.square(); - this.instance_1.setTransform(518,151.5); - - // kirakira2 - this.instance_2 = new lib.kirakira2(); - this.instance_2.setTransform(420.8,32.6); - - // kirakira - this.instance_3 = new lib.kirakira(); - this.instance_3.setTransform(32,151.5); - - // flower - this.instance_4 = new lib.flower(); - this.instance_4.setTransform(396.5,151.5); - - // star_10 - this.instance_5 = new lib.star_10(); - this.instance_5.setTransform(518,32.6); - - // star - this.instance_6 = new lib.star(); - this.instance_6.setTransform(275,151.5); - - // circle - this.instance_7 = new lib.circle(); - this.instance_7.setTransform(226.4,32.6); - - // reverse_blur_circle - this.instance_8 = new lib.reverse_blur_circle(); - this.instance_8.setTransform(153.5,151.5); - - // blur_circle - this.instance_9 = new lib.blur_circle(); - this.instance_9.setTransform(129.2,32.6); - - // heart - this.instance_10 = new lib.heart(); - this.instance_10.setTransform(32,32.6); - - this.addChild(this.instance_10,this.instance_9,this.instance_8,this.instance_7,this.instance_6,this.instance_5,this.instance_4,this.instance_3,this.instance_2,this.instance_1,this.instance); -}).prototype = p = new cjs.Container(); -p.nominalBounds = new cjs.Rectangle(275,200,554,187.5); - -})( (lib = lib||{}).assets = lib.assets || {} , asset_shapes_images = asset_shapes_images||{}, asset_shapes_createjs = asset_shapes_createjs||{}, ss = ss||{}); - -var assets = lib.assets; // CONCATENATED MODULE: ./src/assets/shape-generator.ts @@ -308,8 +435,7 @@ var shape_generator_ShapeGenerator = /** @class */ (function () { function ShapeGenerator() { } ShapeGenerator.prototype.generateShape = function (id) { - var namespaceObj = assets; - var cls = namespaceObj[id]; + var cls = Assets[id]; return new cls(); }; return ShapeGenerator; @@ -1442,7 +1568,7 @@ var particle_system_ParticleSystem = /** @class */ (function () { /* concated harmony reexport */__webpack_require__.d(__webpack_exports__, "ShapeGenerator", function() { return shape_generator_ShapeGenerator; }); /* concated harmony reexport */__webpack_require__.d(__webpack_exports__, "AlphaCurveType", function() { return AlphaCurveType; }); /* concated harmony reexport */__webpack_require__.d(__webpack_exports__, "ShapeType", function() { return ShapeType; }); -/* concated harmony reexport */__webpack_require__.d(__webpack_exports__, "assets", function() { return assets; }); +/* concated harmony reexport */__webpack_require__.d(__webpack_exports__, "Assets", function() { return Assets; }); diff --git a/libs/particlejs.min.js b/libs/particlejs.min.js index 0521f0d..3596955 100644 --- a/libs/particlejs.min.js +++ b/libs/particlejs.min.js @@ -1 +1 @@ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.particlejs=t():e.particlejs=t()}(window,function(){return function(e){var t={};function i(a){if(t[a])return t[a].exports;var n=t[a]={i:a,l:!1,exports:{}};return e[a].call(n.exports,n,n.exports,i),n.l=!0,n.exports}return i.m=e,i.c=t,i.d=function(e,t,a){i.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:a})},i.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s=1)}([function(e,t,i){"use strict";i.r(t);var a={},n={},r=window.createjs,o={};!function(e,t,i,a){var n;e.properties={width:550,height:400,fps:24,color:"#999999",manifest:[]},(e.triangle=function(){this.initialize(),this.shape=new i.Shape,this.shape.graphics.beginFill("#FFFFFF").beginStroke().moveTo(-.7,-27.8).lineTo(32,27.1).lineTo(-32,27.8).closePath(),this.shape.setTransform(0,-7),this.addChild(this.shape)}).prototype=n=new i.Container,n.nominalBounds=new i.Rectangle(-32,-34.8,64,55.7),(e.star_10=function(){this.initialize(),this.shape=new i.Shape,this.shape.graphics.beginFill("#FFFFFF").beginStroke().moveTo(-4.3,18.3).lineTo(-19.9,29.3).lineTo(-14.1,10.3).lineTo(-32,10.3).lineTo(-19.7,.7).lineTo(-31.2,-8.7).lineTo(-15.2,-8.8).lineTo(-21.7,-26.4).lineTo(-5.4,-16.4).lineTo(-.2,-31.8).lineTo(4.4,-17.6).lineTo(17.8,-27.4).lineTo(13.1,-8.5).lineTo(30.3,-8.1).lineTo(19.9,.1).lineTo(32,8.4).lineTo(12.8,9.5).lineTo(18.2,29.8).lineTo(4.9,20).lineTo(1.4,31.8).closePath(),this.addChild(this.shape)}).prototype=n=new i.Container,n.nominalBounds=new i.Rectangle(-32,-31.7,64,63.6),(e.star=function(){this.initialize(),this.shape=new i.Shape,this.shape.graphics.beginFill("#FFFFFF").beginStroke().moveTo(-.2,17.3).lineTo(-20.2,31.5).lineTo(-13,7.4).lineTo(-32,-8).lineTo(-7.8,-8.4).lineTo(.3,-32).lineTo(8,-8.2).lineTo(32,-7.4).lineTo(12.8,7.5).lineTo(19.4,32).closePath(),this.addChild(this.shape)}).prototype=n=new i.Container,n.nominalBounds=new i.Rectangle(-32,-32,64,64),(e.square=function(){this.initialize(),this.shape=new i.Shape,this.shape.graphics.beginFill().beginStroke("#FFFFFF").setStrokeStyle(8,1,1).moveTo(-32,-32).lineTo(32,-32).lineTo(32,32).lineTo(-32,32).closePath(),this.addChild(this.shape)}).prototype=n=new i.Container,n.nominalBounds=new i.Rectangle(-36,-36,72,72),(e.reverse_blur_circle=function(){this.initialize(),this.shape=new i.Shape,this.shape.graphics.beginFill().beginStroke("#FFFFFF").setStrokeStyle(8,1,1).moveTo(32,0).curveTo(32,13.2,22.6,22.6).curveTo(13.3,32,0,32).curveTo(-13.2,32,-22.7,22.6).curveTo(-32,13.2,-32,0).curveTo(-32,-13.3,-22.7,-22.7).curveTo(-13.2,-32,0,-32).curveTo(13.3,-32,22.6,-22.7).curveTo(32,-13.3,32,0).closePath(),this.addChild(this.shape)}).prototype=n=new i.Container,n.nominalBounds=new i.Rectangle(-36,-36,72,72),(e.kirakira2=function(){this.initialize(),this.shape=new i.Shape,this.shape.graphics.beginFill("#FFFFFF").beginStroke().moveTo(-4,9.5).curveTo(-7.8,0,-13.4,-.1).curveTo(-7.8,-.2,-4,-9.9).curveTo(-.1,-19.2,0,-32).curveTo(.1,-19.2,4,-9.9).curveTo(8,-.2,13.4,-.1).curveTo(8,0,4,9.5).curveTo(.1,19,0,32).curveTo(-.1,19,-4,9.5).closePath(),this.addChild(this.shape)}).prototype=n=new i.Container,n.nominalBounds=new i.Rectangle(-13.4,-32,26.8,64),(e.kirakira=function(){this.initialize(),this.shape=new i.Shape,this.shape.graphics.beginFill("#FFFFFF").beginStroke().moveTo(-9.6,9.3).curveTo(-18.9,0,-32,-.1).curveTo(-18.9,-.2,-9.6,-9.6).curveTo(-.2,-19,-.1,-32).curveTo(0,-19,9.4,-9.6).curveTo(18.9,-.2,32,-.1).curveTo(18.9,0,9.4,9.3).curveTo(0,18.8,-.1,32).curveTo(-.2,18.8,-9.6,9.3).closePath(),this.addChild(this.shape)}).prototype=n=new i.Container,n.nominalBounds=new i.Rectangle(-32,-32,64,64),(e.heart=function(){this.initialize(),this.shape=new i.Shape,this.shape.graphics.beginFill("#FFFFFF").beginStroke().moveTo(-20.2,10).lineTo(-24.8,3.5).curveTo(-27,.1,-28.5,-3.1).curveTo(-30.1,-6.4,-31.1,-9.5).curveTo(-32,-13,-32,-16).curveTo(-32,-19.7,-30.4,-22.7).curveTo(-29.1,-25.4,-26.6,-27.4).curveTo(-24,-29.1,-21,-30.1).curveTo(-18.1,-31.1,-15,-31.1).curveTo(-11.7,-31.1,-8.8,-29.9).curveTo(-6.4,-29,-4.5,-27.4).curveTo(-3,-25.9,-1.7,-23.9).lineTo(0,-20.8).lineTo(1.7,-23.9).curveTo(3,-25.9,4.5,-27.4).curveTo(6.6,-29.1,8.8,-29.9).curveTo(11.7,-31.1,15.2,-31.1).curveTo(18.4,-31.1,21.3,-30.1).curveTo(24.2,-29.1,26.7,-27.2).curveTo(29.1,-25.3,30.5,-22.6).curveTo(32,-19.7,32,-16.1).curveTo(32,-13.3,31,-9.7).curveTo(30.2,-6.5,28.5,-3.2).curveTo(27.1,0,24.9,3.3).lineTo(20.3,9.7).curveTo(13.4,17.7,9.7,21.6).lineTo(0,31).curveTo(-13.6,18.3,-20.2,10).closePath(),this.addChild(this.shape)}).prototype=n=new i.Container,n.nominalBounds=new i.Rectangle(-32,-31,64,62.1),(e.flower=function(){this.initialize(),this.shape=new i.Shape,this.shape.graphics.beginFill("#FFFFFF").beginStroke().moveTo(4,27.3).curveTo(.5,23.7,.5,18.9).lineTo(.5,15.2).lineTo(-.5,15.2).lineTo(-.7,18.9).curveTo(-.9,24,-4.1,27.6).curveTo(-7.4,31.1,-12.1,31.1).curveTo(-17,31.1,-20.8,27.5).curveTo(-24.7,23.7,-24.7,19.1).curveTo(-24.7,15.3,-22.2,12.1).curveTo(-19.7,8.8,-16.1,7.7).lineTo(-12.5,6.4).lineTo(-12.7,5.8).lineTo(-13,5.4).lineTo(-16.5,6.6).lineTo(-20.2,7.1).curveTo(-25.3,7.1,-28.7,4).curveTo(-32,.7,-32,-4.1).curveTo(-32,-9.4,-28.7,-13).curveTo(-25.5,-16.8,-20.6,-16.8).curveTo(-17.8,-16.8,-15,-15.4).curveTo(-12.2,-14,-10.5,-11.6).lineTo(-8.4,-8.7).lineTo(-8,-8.8).lineTo(-7.4,-9.3).lineTo(-9.6,-12.2).curveTo(-10.7,-14,-11.3,-15.8).curveTo(-11.9,-17.9,-12,-19.9).curveTo(-12,-24.7,-8.5,-28).curveTo(-5.3,-31.1,-.1,-31.1).curveTo(5.2,-31.1,8.5,-28).curveTo(11.7,-24.7,11.8,-19.9).curveTo(11.7,-17.7,11.2,-15.7).curveTo(10.7,-13.8,9.5,-12.2).lineTo(7.4,-9.3).lineTo(7.8,-9).lineTo(8.2,-8.7).lineTo(10.5,-11.6).curveTo(12.2,-14,14.8,-15.4).curveTo(17.6,-16.8,20.4,-16.8).curveTo(25.3,-16.8,28.5,-13).curveTo(32,-9.4,32,-4.1).curveTo(32,.8,28.5,4).curveTo(25.3,7.1,20,7.1).lineTo(16.4,6.6).lineTo(12.9,5.5).curveTo(12.8,5.6,12.8,5.6).curveTo(12.7,5.7,12.7,5.7).curveTo(12.7,5.8,12.7,5.8).curveTo(12.7,5.9,12.7,6).lineTo(12.5,6.4).lineTo(15.9,7.7).curveTo(19.7,9.1,22.1,12.2).curveTo(24.5,15.3,24.5,19.1).curveTo(24.5,23.7,20.8,27.5).curveTo(16.9,31.1,11.9,31.1).curveTo(7.4,31.1,4,27.3).closePath().moveTo(-7.7,-5.9).curveTo(-10.9,-2.7,-10.9,1.8).curveTo(-10.9,6.3,-7.7,9.4).curveTo(-4.6,12.5,-.1,12.5).curveTo(4.4,12.5,7.6,9.4).curveTo(10.6,6.3,10.6,1.8).curveTo(10.6,-2.7,7.6,-5.9).curveTo(4.4,-9,-.1,-9).curveTo(-4.6,-9,-7.7,-5.9).closePath(),this.addChild(this.shape)}).prototype=n=new i.Container,n.nominalBounds=new i.Rectangle(-32,-31,64,62.2),(e.circle=function(){this.initialize(),this.shape=new i.Shape,this.shape.graphics.beginFill("#FFFFFF").beginStroke().drawEllipse(-10.8,-10.8,21.7,21.7),this.shape.setTransform(0,0,2.949,2.949),this.addChild(this.shape)}).prototype=n=new i.Container,n.nominalBounds=new i.Rectangle(-32,-32,64,64),(e.blur_circle=function(){this.initialize(),this.shape=new i.Shape,this.shape.graphics.beginRadialGradientFill(["#FFFFFF","rgba(255,255,255,0)"],[0,1],0,0,0,0,0,11).beginStroke().drawEllipse(-10.8,-10.8,21.7,21.7),this.shape.setTransform(0,0,3,3),this.addChild(this.shape)}).prototype=n=new i.Container,n.nominalBounds=new i.Rectangle(-32.5,-32.5,65.1,65.1),(e.assetshapes=function(){this.initialize(),this.instance=new e.triangle,this.instance.setTransform(323.6,39.6),this.instance_1=new e.square,this.instance_1.setTransform(518,151.5),this.instance_2=new e.kirakira2,this.instance_2.setTransform(420.8,32.6),this.instance_3=new e.kirakira,this.instance_3.setTransform(32,151.5),this.instance_4=new e.flower,this.instance_4.setTransform(396.5,151.5),this.instance_5=new e.star_10,this.instance_5.setTransform(518,32.6),this.instance_6=new e.star,this.instance_6.setTransform(275,151.5),this.instance_7=new e.circle,this.instance_7.setTransform(226.4,32.6),this.instance_8=new e.reverse_blur_circle,this.instance_8.setTransform(153.5,151.5),this.instance_9=new e.blur_circle,this.instance_9.setTransform(129.2,32.6),this.instance_10=new e.heart,this.instance_10.setTransform(32,32.6),this.addChild(this.instance_10,this.instance_9,this.instance_8,this.instance_7,this.instance_6,this.instance_5,this.instance_4,this.instance_3,this.instance_2,this.instance_1,this.instance)}).prototype=n=new i.Container,n.nominalBounds=new i.Rectangle(275,200,554,187.5)}((a=a||{}).assets=a.assets||{},n=n||{},r=r||{},o=o||{});var s,c=a.assets,l=function(){function e(){}return e.prototype.generateShape=function(e){return new(0,c[e])},e}(),h=function(){return function(){this.hue=0,this.hueVariance=0,this.saturation=0,this.saturationVariance=0,this.luminance=0,this.luminanceVariance=0}}();!function(e){e[e.Normal=0]="Normal",e[e.Random=1]="Random"}(s||(s={}));var u=function(){function e(e){void 0===e&&(e=null),this.bgColor="",this.width=0,this.height=0,this.emitFrequency=0,this.startX=0,this.startXVariance=0,this.startY=0,this.startYVariance=0,this.initialDirection=0,this.initialDirectionVariance=0,this.initialSpeed=0,this.initialSpeedVariance=0,this.friction=0,this.accelerationSpeed=0,this.accelerationDirection=0,this.startScale=0,this.startScaleVariance=0,this.finishScale=0,this.finishScaleVariance=0,this.lifeSpan=0,this.lifeSpanVariance=0,this.startAlpha=0,this.startAlphaVariance=0,this.finishAlpha=0,this.finishAlphaVariance=0,this.shapeIdList=[""],this.startColor=new h,this.blendMode=!0,this.alphaCurveType=s.Normal,e&&this.importFromJson(e)}return e.prototype.importFromJson=function(e){this.setData(e,function(e){return"width"==e||"height"==e||"bgColor"==e})},e.prototype.importData=function(e){this.setData(e,function(e){return"width"==e||"height"==e||"startX"==e||"startY"==e})},e.checkReflectEnable=function(){try{return!(!Reflect||!Reflect.has)}catch(e){return!1}},e.prototype.setData=function(t,i){if(e.ENABLE_REFLECT){for(var a in t)if(!i(a)&&1==Reflect.has(this,a)){var n=t[a];Reflect.set(this,a,n)}}else{for(var a in t)i(a)||this.hasOwnProperty(a)&&(this[a]=t[a])}},e.ENABLE_REFLECT=e.checkReflectEnable(),e}(),p=function(){return function(){this.assetList=["blur_circle","circle","flower","heart","kirakira","kirakira2","reverse_blur_circle","square","star","star_10","triangle"]}}(),f=function(){function e(){}return e.BLUR_CIRCLE="blur_circle",e.CIRCLE="circle",e.FLOWER="flower",e.HEART="heart",e.KIRAKIRA="kirakira",e.KIRAKIRA2="kirakira2",e.REVERSE_CIRCLE="reverse_blur_circle",e.SQUARE="square",e.STAR="star",e.STAR_10="star_10",e.TRIANGLE="triangle",e}(),d=function(){return function(){this.particleShape=new createjs.Container,this.startColor=new h}}(),g="1.0.0";var T=function(){function e(){this._frameCount=0,this._drawingData=new u,this._particlesPool=[],this._activeParticles=[],this.container=new createjs.Container,this.container.mouseChildren=!1,this.container.mouseEnabled=!1,this._playing=!0,this.shapeGenerator=new l}return e.prototype.isPlaying=function(){return this._playing},e.prototype.setData=function(e){this._drawingData=e},e.prototype.importFromJson=function(e){(function(e){var t=g.split(".");if(t.length<=2)return console.log("バージョン表記エラーが発生しました。"),!1;if(!e)return"0"==t[0]&&"1"==t[1];var i=e.split(".");return t[0]==i[0]&&t[1]==i[1]})(e.VERSION||"")||console.warn("読み込んだJSONファイルとParticleJSのバージョンが異なります。\nhttps://github.com/ics-creative/ParticleJS"),this._drawingData.importFromJson(e)},e.prototype.update=function(){this._playing&&(this.emit(),this.animate(),this.lifeCheck())},e.prototype.animate=function(){for(var e=createjs.Matrix2D.DEG_TO_RAD*this._drawingData.accelerationDirection,t=Math.cos(e)*this._drawingData.accelerationSpeed,i=Math.sin(e)*this._drawingData.accelerationSpeed,a=0;a=e&&(this._frameCount=0)},e.prototype.emitParticle=function(){var e=this.generateParticle();this.container.addChild(e.particleShape),this._activeParticles.push(e)},e.prototype.generateParticle=function(){var e=null;return e=this._particlesPool.length>=1?this._particlesPool.shift():new d,this.setParticleParameter(e),e},e.prototype.setParticleParameter=function(e){e.particleShape.removeAllChildren(),e.isAlive=!0,e.x=this.calcRandomValueWithVariance(this._drawingData.startX,this._drawingData.startXVariance,!1),e.y=this.calcRandomValueWithVariance(this._drawingData.startY,this._drawingData.startYVariance,!1),this.generateShape(e,this._drawingData.shapeIdList),e.totalLife=Math.max(1,this.calcRandomValueWithVariance(this._drawingData.lifeSpan,this._drawingData.lifeSpanVariance,!0)),e.currentLife=e.totalLife;var t=Math.max(0,this.calcRandomValueWithVariance(this._drawingData.initialSpeed,this._drawingData.initialSpeedVariance,!1)),i=createjs.Matrix2D.DEG_TO_RAD*this.calcRandomValueWithVariance(this._drawingData.initialDirection,this._drawingData.initialDirectionVariance,!1);e.vx=Math.cos(i)*t,e.vy=Math.sin(i)*t,e.startAlpha=this.calcRandomValueWithRange(0,1,this.calcRandomValueWithVariance(this._drawingData.startAlpha,this._drawingData.startAlphaVariance,!1)),e.finishAlpha=this.calcRandomValueWithRange(0,1,this.calcRandomValueWithVariance(this._drawingData.finishAlpha,this._drawingData.finishAlphaVariance,!1)),e.startScale=Math.max(0,this.calcRandomValueWithVariance(this._drawingData.startScale,this._drawingData.startScaleVariance,!1)),e.finishScale=Math.max(0,this.calcRandomValueWithVariance(this._drawingData.finishScale,this._drawingData.finishScaleVariance,!1)),e.particleShape.compositeOperation=1==this._drawingData.blendMode?"lighter":null,e.alphaCurveType=this._drawingData.alphaCurveType},e.prototype.generateShape=function(t,i){t.particleShape.removeAllChildren();var a=this._drawingData.startColor;t.startColor.hue=this.calcRandomValueWithVariance(a.hue,a.hueVariance,!1)%360,t.startColor.luminance=this.calcRandomValueWithVariance(a.luminance,a.luminanceVariance,!1),t.startColor.saturation=this.calcRandomValueWithVariance(a.saturation,a.saturationVariance,!1);var n=Number(t.startColor.hue),r=Number(t.startColor.saturation),o=Number(t.startColor.luminance),s="hsl("+n+", "+r+"%, "+o+"%)",c=Math.floor(Math.random()*this._drawingData.shapeIdList.length),l=0==this._drawingData.shapeIdList.length?"":this._drawingData.shapeIdList[c];t.colorCommand=null;var h=this.shapeGenerator.generateShape(l);t.particleShape.addChild(h);var u=h.getChildAt(0);if(null!=u){var p=u.graphics.instructions;if(p&&p.length>0)for(var f=0;f=e&&(this._frameCount=0)},e.prototype.emitParticle=function(){var e=this.generateParticle();this.container.addChild(e.particleShape),this._activeParticles.push(e)},e.prototype.generateParticle=function(){var e=null;return e=this._particlesPool.length>=1?this._particlesPool.shift():new T,this.setParticleParameter(e),e},e.prototype.setParticleParameter=function(e){e.particleShape.removeAllChildren(),e.isAlive=!0,e.x=this.calcRandomValueWithVariance(this._drawingData.startX,this._drawingData.startXVariance,!1),e.y=this.calcRandomValueWithVariance(this._drawingData.startY,this._drawingData.startYVariance,!1),this.generateShape(e,this._drawingData.shapeIdList),e.totalLife=Math.max(1,this.calcRandomValueWithVariance(this._drawingData.lifeSpan,this._drawingData.lifeSpanVariance,!0)),e.currentLife=e.totalLife;var t=Math.max(0,this.calcRandomValueWithVariance(this._drawingData.initialSpeed,this._drawingData.initialSpeedVariance,!1)),i=createjs.Matrix2D.DEG_TO_RAD*this.calcRandomValueWithVariance(this._drawingData.initialDirection,this._drawingData.initialDirectionVariance,!1);e.vx=Math.cos(i)*t,e.vy=Math.sin(i)*t,e.startAlpha=this.calcRandomValueWithRange(0,1,this.calcRandomValueWithVariance(this._drawingData.startAlpha,this._drawingData.startAlphaVariance,!1)),e.finishAlpha=this.calcRandomValueWithRange(0,1,this.calcRandomValueWithVariance(this._drawingData.finishAlpha,this._drawingData.finishAlphaVariance,!1)),e.startScale=Math.max(0,this.calcRandomValueWithVariance(this._drawingData.startScale,this._drawingData.startScaleVariance,!1)),e.finishScale=Math.max(0,this.calcRandomValueWithVariance(this._drawingData.finishScale,this._drawingData.finishScaleVariance,!1)),e.particleShape.compositeOperation=1==this._drawingData.blendMode?"lighter":null,e.alphaCurveType=this._drawingData.alphaCurveType},e.prototype.generateShape=function(t,i){t.particleShape.removeAllChildren();var a=this._drawingData.startColor;t.startColor.hue=this.calcRandomValueWithVariance(a.hue,a.hueVariance,!1)%360,t.startColor.luminance=this.calcRandomValueWithVariance(a.luminance,a.luminanceVariance,!1),t.startColor.saturation=this.calcRandomValueWithVariance(a.saturation,a.saturationVariance,!1);var n=Number(t.startColor.hue),r=Number(t.startColor.saturation),o=Number(t.startColor.luminance),s="hsl("+n+", "+r+"%, "+o+"%)",c=Math.floor(Math.random()*this._drawingData.shapeIdList.length),l=0==this._drawingData.shapeIdList.length?"":this._drawingData.shapeIdList[c];t.colorCommand=null;var h=this.shapeGenerator.generateShape(l);t.particleShape.addChild(h);var u=h.getChildAt(0);if(null!=u){var p=u.graphics.instructions;if(p&&p.length>0)for(var f=0;fnamespaceObj[id]; + const cls = Assets[id]; return new cls(); } } diff --git a/src/particlejs.ts b/src/particlejs.ts index 73bbfcb..9a72b3c 100644 --- a/src/particlejs.ts +++ b/src/particlejs.ts @@ -1,4 +1,4 @@ -import { assets } from "./asset-shapes.js"; +import { Assets } from "./asset-shapes"; import { ShapeGenerator } from "./assets/shape-generator"; import { ColorData } from "./data/data-color"; import { DrawingData } from "./data/data-drawing"; @@ -18,5 +18,5 @@ export { ShapeGenerator, AlphaCurveType, ShapeType, - assets + Assets };