FlatFX - 2D effects

FlatFX is a pack of customizable geometry-based 2D effects.

Get FlatFX here.

Features

  • Five different effects each with its own customizable colors, size, duration and few more settings.
  • Setting can be modified in editor or from code, stored and loaded from external file.
  • The geometry (mesh) is generated by a C# script, no sprites are used. This way FlatFX don’t take additional video memory and allows to scale effects to any size and set any duration.
  • Supports sorting layers in the same way sprites do.

A friendly reminder
If you bought this asset and liked it, why not give it a rating or write a short, one-sentence review! This would really help to popularize this asset and speed up the development of new features.

Hi,

The effect is working fine when I test it in the editor view. It animates and it clears. However when running the game in the editor the effect does not animate or clear. This happens both when I programmatically add an effect and when I hit the Test button while the game is running.

I notice that the triangle count and effect counts keeps increasing. If I keep running it I eventually wind up with a filled circle.

Is there something I’m missing?

Here’s my code:

FlatFX fx = warnAnimation.GetComponent<FlatFX>();
fx.gameObject.transform.localScale = new Vector3(100, 100, 100);
RectTransform rt = GetComponent<RectTransform>();
Bounds b = GetRectTransformBounds(rt);
fx.AddEffect(b.center, 2);

The FlatFX object is a child of a canvas object. Here’s the JSON of my object:

{
  "selectedEffect": 2,
  "settings": [
    {
      "type": 0,
      "sectorCount": 30,
      "lifetime": 0.699999988079071,
      "easing": 11,
      "randomizePosition": 1.0,
      "start": {
        "position": {
          "x": 0.0,
          "y": 0.0
        },
        "size": 2.0,
        "thickness": 3.0,
        "rotation": 159.8514404296875,
        "innerColor": {
          "r": 1.0,
          "g": 0.43448272347450259,
          "b": 0.0,
          "a": 1.0
        },
        "outerColor": {
          "r": 1.0,
          "g": 0.18620696663856507,
          "b": 0.0,
          "a": 1.0
        },
        "seed": 0.0
      },
      "end": {
        "position": {
          "x": 0.0,
          "y": 0.0
        },
        "size": 3.0,
        "thickness": 0.0,
        "rotation": 159.8514404296875,
        "innerColor": {
          "r": 0.4852941036224365,
          "g": 0.37824392318725588,
          "b": 0.37824392318725588,
          "a": 1.0
        },
        "outerColor": {
          "r": 0.4485294222831726,
          "g": 0.4485294222831726,
          "b": 0.4485294222831726,
          "a": 1.0
        },
        "seed": 0.0
      }
    },
    {
      "type": 1,
      "sectorCount": 30,
      "lifetime": 2.0,
      "easing": 11,
      "randomizePosition": 0.5,
      "start": {
        "position": {
          "x": 0.0,
          "y": 0.0
        },
        "size": 0.0,
        "thickness": 1.0,
        "rotation": 117.05316925048828,
        "innerColor": {
          "r": 0.0,
          "g": 0.7103447914123535,
          "b": 1.0,
          "a": 1.0
        },
        "outerColor": {
          "r": 0.0,
          "g": 0.7098039388656616,
          "b": 1.0,
          "a": 1.0
        },
        "seed": 0.0
      },
      "end": {
        "position": {
          "x": 0.0,
          "y": 0.0
        },
        "size": 6.0,
        "thickness": 0.0,
        "rotation": 117.05316925048828,
        "innerColor": {
          "r": 0.0,
          "g": 0.7098039388656616,
          "b": 1.0,
          "a": 0.0
        },
        "outerColor": {
          "r": 0.0,
          "g": 0.7098039388656616,
          "b": 1.0,
          "a": 0.0
        },
        "seed": 0.0
      }
    },
    {
      "type": 2,
      "sectorCount": 10,
      "lifetime": 0.5,
      "easing": 12,
      "randomizePosition": 0.0,
      "start": {
        "position": {
          "x": 0.0,
          "y": 0.0
        },
        "size": 6.0,
        "thickness": 4.0,
        "rotation": 274.034912109375,
        "innerColor": {
          "r": 1.0,
          "g": 0.5611366629600525,
          "b": 0.4784313440322876,
          "a": 1.0
        },
        "outerColor": {
          "r": 1.0,
          "g": 0.6781498789787293,
          "b": 0.4784313440322876,
          "a": 1.0
        },
        "seed": 0.0
      },
      "end": {
        "position": {
          "x": 0.0,
          "y": 0.0
        },
        "size": 2.0,
        "thickness": 0.0,
        "rotation": 274.034912109375,
        "innerColor": {
          "r": 1.0,
          "g": 0.0,
          "b": 0.1030879020690918,
          "a": 1.0
        },
        "outerColor": {
          "r": 1.0,
          "g": 0.4784313440322876,
          "b": 0.8786624073982239,
          "a": 1.0
        },
        "seed": 0.0
      }
    },
    {
      "type": 3,
      "sectorCount": 4,
      "lifetime": 0.30000001192092898,
      "easing": 0,
      "randomizePosition": 0.0,
      "start": {
        "position": {
          "x": 0.0,
          "y": 0.0
        },
        "size": 20.0,
        "thickness": 20.0,
        "rotation": 49.638118743896487,
        "innerColor": {
          "r": 1.0,
          "g": 1.0,
          "b": 1.0,
          "a": 1.0
        },
        "outerColor": {
          "r": 1.0,
          "g": 1.0,
          "b": 1.0,
          "a": 1.0
        },
        "seed": 0.0
      },
      "end": {
        "position": {
          "x": 0.0,
          "y": 0.0
        },
        "size": 20.0,
        "thickness": 20.0,
        "rotation": 49.638118743896487,
        "innerColor": {
          "r": 1.0,
          "g": 1.0,
          "b": 1.0,
          "a": 1.0
        },
        "outerColor": {
          "r": 1.0,
          "g": 1.0,
          "b": 1.0,
          "a": 1.0
        },
        "seed": 0.0
      }
    },
    {
      "type": 4,
      "sectorCount": 16,
      "lifetime": 2.0,
      "easing": 0,
      "randomizePosition": 0.0,
      "start": {
        "position": {
          "x": 0.0,
          "y": 0.0
        },
        "size": 10.0,
        "thickness": 9.0,
        "rotation": 344.0030517578125,
        "innerColor": {
          "r": 1.0,
          "g": 0.9215686917304993,
          "b": 0.01568627543747425,
          "a": 1.0
        },
        "outerColor": {
          "r": 1.0,
          "g": 0.9215686321258545,
          "b": 0.01568627543747425,
          "a": 0.0
        },
        "seed": 0.0
      },
      "end": {
        "position": {
          "x": 0.0,
          "y": 0.0
        },
        "size": 10.0,
        "thickness": 9.0,
        "rotation": 224.0030517578125,
        "innerColor": {
          "r": 1.0,
          "g": 0.9215686917304993,
          "b": 0.01568627543747425,
          "a": 1.0
        },
        "outerColor": {
          "r": 1.0,
          "g": 0.9215686917304993,
          "b": 0.01568627543747425,
          "a": 0.0
        },
        "seed": 0.0
      }
    }
  ],
  "sortingLayer": 0,
  "orderInLayer": 0
}

First thing that comes to mind is that your game’s time scale is set to 0. If it’s not, it may still have something to do with time settings.

That’s it; I’m setting time scale to 0 to pause the game. However I’m using FlatFX to animate the UI. Do you know anyway I might be able to pause one, but not the other?

It makes sense for me to add the checkbox to the asset to allow it to be TimeScale-independent. I’ll add this feature and will update the asset on the asset store. It usually takes few days before they approve and make the new version public. If you give me your email (or email me) I’ll send you the updated asset personally as soon as I’ll add this feature.

UPDATE. I’ve already added this feature and it’s on the way to the asset store. Still if you need it right now, I can send the updated asset to you.

Thanks! That’s a great turn around. Really appreciate it!

1 Like

The new version is live.
Here’s the new feature:

5026775--492614--Screenshot_2.png

If you check this box, FlatFX won’t get paused and will ignore TimeScale setting.

Perfect, thank you! Works a charm.

1 Like

Hello.

I am using this asset and works fine. Congratulations.

I have placed the Flat FX script in an empty gameobject and invoke it using this code:

flatEffect.AddEffect( Vector2.zero, 1 );

It works perfectly, but I have detected that if the user clicks on a specific part of the screen, the effect runs alone.

I am doing something wrong?

Thanks for your time.

Hi and thanks a lot for choosing my asset! I don’t quite understand what you mean but as far as I understant, the effect gets triggered on a click somewhere on the screen without you intending it to worklike this. There’s nothing in code of this asset that reacts on click. From a first glance it looks to me that the issue you’re having is caused outside of the code of the asset.

Hey Andrii.

I bought FlatFX asset and love it.
Do you plan to had other FXs soon?
It would be awesome.

Thanks a lot!
It’s not in my plans at the moment. But which effects would you like to see added, that would work with the parameters that are already there?

Other simple effect in the same style (anime/flat).
Like speed lines for instance!

EDIT: Also, I was wondering out of curiosity:
How come the line flatfx.AddEffect(transform.position, 0)
is executed when i spawn a prefab with this script since the line is in “void Start” function?
( It behave like OnEnable, I thought “void Start” means “start of the Scene” ).

That’s an interesting idea. Still I don’t know if I’ll have time to try and implement this anytime soon.

The Start method is actually called when object is initialized, not the start of the scene.

Hello, just one quick question, can I change the material of the effects? or do I need to use the material it has by default?

The material the asset is using is in FlatFX > Resources > FlatFXDefault
Your first option is to edit it or replace it with another material but it has to be named FlatFXDefault. Since the script loads it using this name.

The second option at the moment is placing another material in a Resources folder anywhere in your project and then editing the script in FlatFX > scripts > FlatFX.cs, line 35 where it loads “FlatFXDefault” and changing it to the name of your material. It’s important for it to be in a Resources folder tobe available at runtime.

I hope this works for you. I can add a setting to use custom material, if you need a cleaner way to do this but I’m not sure how useful that would be.

1 Like

I think that would be it, I was thinking in buying the VFX but for my game I´m currently using a custom shader for managing some color palettes and stuff like that, and I was afraid, that my material could not be applied to the meshes respectively, but now that you tell me that everything is ok, I´, going to buy the asset, thx

Is there a way to spawn a flat fx at a custom point? ie I have an object that moves around that I would like to spawn a flat fx as a child object but am having a hard time with the Z position. It doesn’t seem to want to spawn at different z positions.

Edit: I guess the question is is there a way to get flatfx working in a 3d space?

Hi there, I’m really loving the asset, although like WoWPerrorDev I would also like to use a custom material, and I would like to ideally be able to use multiple different materials (so no hardcoding). It seems in FlatFX.cs I can’t just set the material to public and edit SetMaterial because of the Editor code. Any advice or snippets to help achieve this?