Van Halen

flickering neon light effect

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});


//View = '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		






Share this post

Link to post
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.

Share this post

Link to post
Share on other sites

So you are moving your canvas element to simulate looking around? That's a wrong approach, renderer size should not be larger than the screen, invisible pixels still eat up performance. You should just move your sprites instead.

Share this post

Link to post
Share on other sites

Yes, the header is moved around by dragging with a jQuery Slider script, and when it rains or when there is a fog/mist the whole canvas is loaded at 3600 px.

First time ever i used something like PixiJS or Particles effects.

Thanks for the tip, Fatalist.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.