Skip to content

Commit

Permalink
Merge pull request #18 from Feu-Secret/tokenmagic-dev
Browse files Browse the repository at this point in the history
Update v0.2.1
  • Loading branch information
Feu-Secret authored Aug 5, 2020
2 parents 0bebbc6 + 102958c commit 2ab222a
Show file tree
Hide file tree
Showing 34 changed files with 4,885 additions and 326 deletions.
Binary file modified .vs/Tokenmagic/v16/.suo
Binary file not shown.
7 changes: 3 additions & 4 deletions .vs/VSWorkspaceState.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@
"\\tokenmagic",
"\\tokenmagic\\fx",
"\\tokenmagic\\fx\\filters",
"\\tokenmagic\\fx\\filters\\proto",
"\\tokenmagic\\fx\\glsl",
"\\tokenmagic\\fx\\glsl\\fragmentshaders",
"\\tokenmagic\\fx\\glsl\\vertexshaders",
"\\tokenmagic\\libs",
"\\tokenmagic\\fx\\presets",
"\\tokenmagic\\module",
"\\tokenmagic\\module\\proto",
"\\tokenmagic\\updates"
],
"SelectedNode": "\\tokenmagic\\fx\\glsl\\fragmentshaders\\glowoh.js",
"SelectedNode": "\\tokenmagic\\module\\tokenmagic.js",
"PreviewInSolutionExplorer": false
}
Binary file modified .vs/slnx.sqlite
Binary file not shown.
159 changes: 159 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,162 @@
# Token Magic FX - Update v0.2.1-alpha

*Added :*
- An option to allow non-GM players to add, modify or delete FX on tokens which they do not own.
- Mirror-images filter overhaul with new properties :
- number of images
- alpha properties on images and character
- movement amplitude along the X and Y axis.
- 2 new macro in the portfolio (with an emphasis on new properties)
- Library of stored FX presets :
- comes with a default library (the same as in the portfolio)
- functions to add or delete presets in your library
- functions to export presets from your library into a json file
- functions to import presets into your library (local or URL)
- Added smooth edges on Force Field filter

*New FX :*
- A pixelate filter (sample added in the portfolio)

*Fixed issues :*
- Added the v0.2.0 missing macros in the portfolio.
- X-rays, liquid and x-glow macros
- Force field filter had a brightness and contrast problem.
- The colors are now more vivid.
- You may have to review your macros by adjusting color intensity.
- The Force field macros have been rewritten.
- Corrected some performances issues in the shaders
- Some animations could freeze with a large video or texture (animated tokens, etc.)

*Thanks :*
- special thanks to @tposney

## Managing Presets

*Added new functions :*

To add a preset in your library :
```javascript
(async) TokenMagic.addPreset(<presetName>,<params>,optional <silent>)

// Example
// You don't need to add a filterId when creating a preset. The filterId is created with the preset name.
// In the example below, the filterId will be equal to "FunnyGlow"
let params =
[{
filterType: "glow",
color: Math.floor(Math.random() * 16777215)
}];
TokenMagic.addPreset("FunnyGlow",params);
```
To delete a preset in your library :
```javascript
(async) TokenMagic.deletePreset(<presetName>,optional <silent>);
```
To get a preset from your library :
```javascript
TokenMagic.getPreset(<presetName>);
```

To export your library in a json file
```javascript
TokenMagic.exportPresetLibrary(optional <exportName>);
```

To import presets into your library (open a file picker dialog)
```javascript
(async) TokenMagic.importPresetLibrary();
```

To import presets into your library from a local path
```javascript
(async) TokenMagic.importPresetLibraryFromPath(<path>);
```

To import presets into your library from an URL
```javascript
(async) TokenMagic.importPresetLibraryFromURL(<URL>);
```

To reset the preset library with the default presets (confirmation is requested)
```javascript
(async) TokenMagic.resetPresetLibrary();
```

*A new option in the module option panel allow overwrite of duplicates (by preset name) on import.
By default, duplicates are ignored.*

### Functions updates

You can use presets with those functions below, by replacing the params with a preset name :
```javascript
TokenMagic.addFilters
TokenMagic.addFiltersOnSelected
TokenMagic.addFiltersOnTargeted
TokenMagic.addUpdateFiltersOnSelected
TokenMagic.addUpdateFiltersOnTargeted
TokenMagic.updateFiltersOnSelected
TokenMagic.updateFiltersOnTargeted
TokenMagic.updateFiltersByPlaceable

// Example
TokenMagic.addFiltersOnTargeted("dead");
```

### Default presets library content

```javascript
0: {name: "bevel", params: Array(1)}
1: {name: "adjustment", params: Array(1)}
2: {name: "dropshadow", params: Array(1)}
3: {name: "outline", params: Array(1)}
4: {name: "glow", params: Array(1)}
5: {name: "bloom", params: Array(1)}
6: {name: "distortion", params: Array(1)}
7: {name: "oldfilm", params: Array(2)}
8: {name: "twist", params: Array(1)}
9: {name: "bulge", params: Array(1)}
10: {name: "blur", params: Array(1)}
11: {name: "zoomblur", params: Array(1)}
12: {name: "shockwave", params: Array(1)}
13: {name: "zapshadow", params: Array(1)}
14: {name: "rays", params: Array(1)}
15: {name: "fog", params: Array(1)}
16: {name: "fumes", params: Array(1)}
17: {name: "electric", params: Array(1)}
18: {name: "fire", params: Array(1)}
19: {name: "waves", params: Array(1)}
20: {name: "flood", params: Array(1)}
21: {name: "smoke", params: Array(1)}
22: {name: "images", params: Array(1)}
23: {name: "chaos-images", params: Array(1)}
24: {name: "spectral-images", params: Array(1)}
25: {name: "hexa-field", params: Array(1)}
26: {name: "fire-field", params: Array(1)}
27: {name: "smoke-field", params: Array(1)}
28: {name: "earth-field", params: Array(1)}
29: {name: "earth-field-top", params: Array(1)}
30: {name: "air-field", params: Array(1)}
31: {name: "magic-field", params: Array(1)}
32: {name: "chromatic-field", params: Array(1)}
33: {name: "water-field", params: Array(1)}
34: {name: "evil-field", params: Array(1)}
35: {name: "grid-field", params: Array(1)}
36: {name: "warp-field", params: Array(1)}
37: {name: "color-field", params: Array(1)}
38: {name: "sunburst", params: Array(1)}
39: {name: "clover", params: Array(1)}
40: {name: "scan", params: Array(1)}
41: {name: "blue-rays", params: Array(1)}
42: {name: "spectral-body", params: Array(1)}
43: {name: "mantle-of-madness", params: Array(1)}
44: {name: "drift-in-plans", params: Array(2)}
45: {name: "fire-aura", params: Array(2)}
46: {name: "glacial-aura", params: Array(2)}
47: {name: "anti-aura", params: Array(2)}
48: {name: "pure-fire-aura", params: Array(3)}
49: {name: "pure-fire-aura-2", params: Array(3)}
50: {name: "pure-ice-aura", params: Array(3)}
```
# Token Magic FX - Update v0.2.0-alpha

*Added :*
Expand Down
Binary file modified Tokenmagic.zip
Binary file not shown.
20 changes: 0 additions & 20 deletions tokenmagic/fx/filters/FilterColorMatrix.js

This file was deleted.

6 changes: 4 additions & 2 deletions tokenmagic/fx/filters/FilterElectric.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@ export class FilterElectric extends PIXI.Filter {

this.animated = {};
this.setTMParams(params);
this.anime = new Anime(this);
this.normalizeTMParams();
if (!this.dummy) {
this.anime = new Anime(this);
this.normalizeTMParams();
}

this.quality = 0.5;
}
Expand Down
6 changes: 4 additions & 2 deletions tokenmagic/fx/filters/FilterFire.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@ export class FilterFire extends PIXI.Filter {

this.animated = {};
this.setTMParams(params);
this.anime = new Anime(this);
this.normalizeTMParams();
if (!this.dummy) {
this.anime = new Anime(this);
this.normalizeTMParams();
}
}

get time() {
Expand Down
6 changes: 4 additions & 2 deletions tokenmagic/fx/filters/FilterForceField.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,10 @@ export class FilterForceField extends PIXI.Filter {

this.animated = {};
this.setTMParams(params);
this.anime = new Anime(this);
this.normalizeTMParams();
if (!this.dummy) {
this.anime = new Anime(this);
this.normalizeTMParams();
}
}

get time() {
Expand Down
6 changes: 4 additions & 2 deletions tokenmagic/fx/filters/FilterGleamingGlow.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@ export class FilterGleamingGlow extends PIXI.Filter {

this.animated = {};
this.setTMParams(params);
this.anime = new Anime(this);
this.normalizeTMParams();
if (!this.dummy) {
this.anime = new Anime(this);
this.normalizeTMParams();
}
}

get time() {
Expand Down
65 changes: 52 additions & 13 deletions tokenmagic/fx/filters/FilterMirrorImages.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,26 @@ export class FilterMirrorImages extends PIXI.Filter {
let {
time,
blend,
alpha,
alphaImg,
alphaChr,
nbImage,
ampX,
ampY
} = Object.assign({}, FilterMirrorImages.defaults, params);

// using specific vertex shader and fragment shader
super(customVertex2D, mirrorImages);

//this.uniforms.color = new Float32Array([1.0, 1.0, 1.0]);
//this.uniforms.scale = new Float32Array([1.0, 1.0]);

Object.assign(this, {
time, blend, alpha
time, blend, alphaImg, alphaChr, nbImage, ampX, ampY
});

this.animated = {};
this.setTMParams(params);
this.anime = new Anime(this);
this.normalizeTMParams();
if (!this.dummy) {
this.anime = new Anime(this);
this.normalizeTMParams();
}
}

get time() {
Expand All @@ -36,12 +39,28 @@ export class FilterMirrorImages extends PIXI.Filter {
this.uniforms.time = value;
}

get alpha() {
return this.uniforms.alpha;
get alphaImg() {
return this.uniforms.alphaImg;
}

set alphaImg(value) {
this.uniforms.alphaImg = value;
}

get alphaChr() {
return this.uniforms.alphaChr;
}

set alphaChr(value) {
this.uniforms.alphaChr = value;
}

get nbImage() {
return this.uniforms.nbImage;
}

set alpha(value) {
this.uniforms.alpha = value;
set nbImage(value) {
this.uniforms.nbImage = Math.floor(value);
}

get blend() {
Expand All @@ -51,12 +70,32 @@ export class FilterMirrorImages extends PIXI.Filter {
set blend(value) {
this.uniforms.blend = Math.floor(value);
}

get ampX() {
return this.uniforms.ampX;
}

set ampX(value) {
this.uniforms.ampX = value;
}

get ampY() {
return this.uniforms.ampY;
}

set ampY(value) {
this.uniforms.ampY = value;
}
}

FilterMirrorImages.defaults = {
time: 0,
blend: 2,
alpha: 0.5,
blend: 4,
alphaImg: 0.5,
alphaChr: 1.0,
nbImage: 4,
ampX: 0.15,
ampY: 0.15
};


Expand Down
36 changes: 36 additions & 0 deletions tokenmagic/fx/filters/FilterPixelate.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { Anime } from "../Anime.js";
import "./proto/FilterProto.js";

export class FilterPixelate extends PIXI.filters.PixelateFilter {
constructor(params) {
super();
this.enabled = false;
this.animated = {};
this.sizeX = 5;
this.sizeY = 5;
this.setTMParams(params);
this.anime = new Anime(this);
this.normalizeTMParams();
}

//get sizeX() {
// return this.size.x;
//}

//set sizeX(value) {
// this.size.x = value;
//}

//get sizeY() {
// return this.size.y;
//}

//set sizeY(value) {
// this.size.y = value;
//}

handleTransform() {
this.size.x = this.sizeX * this.placeableImg.parent.worldTransform.a;
this.size.y = this.sizeY * this.placeableImg.parent.worldTransform.a;
}
}
Loading

0 comments on commit 2ab222a

Please sign in to comment.