BlendMode playground

Hi, this is something I’ve had at the back of my head for at least a year now, but since I don’t seem to ever find the time to implement it, I thought maybe I’d at least share the idea here. Please feel free to run with the idea — I’d love to see it made into an actual webapp.

Background

BlendMode is powerful. It enables a ton of visual effects that would be hard or impossible to make otherwise. Some of them are subtle (like the “wipe” effect below), others can be pure eye candy.

blendmode-large

In either case, using blend mode is often also the most performant way to achieve an effect.

Problem

It takes time to internalize, or “grok”, blend mode and its many variants. The API docs provide a nice visualization for each value, but since that visualization needs to show the whole effect of every blendmode with a single non-animated picture, it’s hard to read, and it’s even harder to mentally apply the blend mode to something the developer wants to achieve (the “aha, I can use it to do a wipe!” moment).

This means there are a lot of Flutter engineers who don’t use blend mode, or who only use it in a rote way (copypasta from somewhere, without understanding what’s going on).

Proposal

Build a (web) app that lets people experiment with blend modes. I call this the BlendMode Playground.

Prior art (for CSS):

Ideally, BlendMode Playground would have these features:

  • A number of sane picture presets for the background and the foreground. For example,
    • For background: a nature photo, a colorful rainbow, a picture with transparency, a light texture, a dark texture.
    • For foreground: light text, dark text, white circle with transparency, white circle on black, black circle on white, white-to-black gradient, white-to-transparent gradient, black-to-transparent gradient, red-to-transparent gradient, animated versions of these gradients, Dash with transparency, Dash on black, Dash on white, …
  • Ability to quickly switch between blend modes and pictures. Ideally, one-click (so no dropdowns).
  • Ability to see several blend modes at once, so people can really internalize the difference between screen and overlay and lighten, for example.

If anybody here is looking for a project that could have big reach and impact (even beyond Flutter, to be honest, since blend mode algorithms are everywhere), then I think this is a good prompt. In an ideal world, this would be something the Flutter (DevRel) team provides — but of course that team has limited bandwidth and there’s so much more other work for them that needs to be done and is higher priority.

20 Likes

Can we connect?

I absolutely see why this would be usefull! I would love to collaborate on this.

2 Likes

Hi @amal, please feel free to go ahead with this. I’m currently not in a position to collaborate or synchronize on this. (If I did, I’d probably just implement it myself, as this kind of thing actually sounds fun to work on.) Cheers!

2 Likes

Hey @amal

Are you working on this? If so, could you open source it when you get the time. Would love to help out.

If not I can start it off and drop a link here for anyone who would like to contribute. Like filip said this does sound really fun to work on

5 Likes

A long time ago I experimented painting over images using blend modes. I come up with a package but I never improved. There should also be a web example.

Whoa, that’s probably better than what I’m suggesting! Is it possible to publish this on github pages or somewhere similar?

Yes, here a web demo. A suggestion to start trying is to shrink the browser horizontally to have a portrait AR and then press the image button to load the sample.
But as I said, it made it just for fun and for example, when painting, you will paint hover places already painted and some glitches occurs (for some blend modes), if I remember well.

1 Like