Jump to content

flickering neon light effect

Van Halen

Recommended Posts


For my website i created a neon effect with PixiJS v4 and i'm not happy with the results i was wondering if anyone could improve upon or has a better idea how create a neon effect which works across multiple desktop/mobile devices.

The neon light is a simple transparent png image overlaid on top of static background image. It works for time been 'good enough' for desktop browsers, but i had to disabled it for iPad, etc. because of the slow performance combined with rain (pixi-particles) and fog (custom particle effect).

Live version:


var PIXI;

var Container = PIXI.Container,
	autoDetectRenderer = PIXI.autoDetectRenderer,
	loader = PIXI.loader,
	resources = PIXI.loader.resources,
	Sprite = PIXI.Sprite,
	ParticleContainer = PIXI.particles.ParticleContainer,
	extras = PIXI.extras;

var street = new Container();
var weatherType = new Container();

var renderer = new autoDetectRenderer(3600, 720, {antialias: false, transparent: true, resolution: 1});


renderer.view.style.display = 'block';
renderer.autoResize = true;

var neonSign,
count = 1;

function animateScene() {

	//Animate neonSign
	neonSign.alpha = 0.1;
	count += 2;
	var bright = 2 + Math.sin(count);
	neonFilter.brightness(bright, false);



function setup() {

	//Setup neonSign

	neonSign = new Sprite(resources['images/one-stop-copy-shop_glow.png'].texture);
	neonSign.width = 1200;
	neonSign.height = 300;

	colorMatrix = [
		1, 0, 0, 0,
		0, 1, 0, 0,
		0, 0, 1, 0,
		0, 0, 0, 1

	neonFilter = new PIXI.filters.ColorMatrixFilter();
	neonFilter.matrix = colorMatrix;
	neonSign.filters = [neonFilter];

	//Add neonSign		






Link to comment
Share on other sites

You could achieve much the same effect without using filters. Just have a png of the glow state layered in front of the main text image. Then on a short randomised interval of milliseconds set it to a random alpha, possibly tweening between the alpha values. That would be a much less expensive operation and should only look quite subtly different.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...