porkloin
porkloin

Reputation: 11

Is it possible to use RGBA colors with PlanetaryJS elements?

I'm drawing some points over a planet drawn in planetaryjs, and I'd like to make them semi-transparent using RGBA color.

planet.loadPlugin(function(planet) {
planet.onDraw(function () {
planet.withSavedContext(function (context) {
        var verylow = (function () {
            var verylow = null;
            $.ajax({
                    'async': false,
                    'global': false,
                    'url': 'verylow.json',
                    'dataType': "json",
                    'success': function (data) {
                            verylow = data;
                    }
            });
    return verylow;
    })();


  context.beginPath();
  planet.path.context(context)(verylow);
  context.fillStyle = 'green';
  context.fill();
  //context.stroke();
  context.closePath();
  });
 });
});

context.fillStyle will also take hex codes, i.e.

  context.fillStyle= '#999999';

but it won't take

   context.fillStyle= 'rgba (255, 0, 0, 0.6)';

Is this just a limitation of the way that planetary is designed, or can anyone suggest another way to get any level of transparency?

edit: verylow.json contains a bunch of "Point" objects, FYI.

Upvotes: 0

Views: 123

Answers (1)

Michelle Tilley
Michelle Tilley

Reputation: 159125

You need to remove the space after the rgba.

Upvotes: 0

Related Questions