Sign in to follow this  
Gyldstrand

canvas.getContext('2d');

Recommended Posts

  var canvas = document.getElementById("demo1");
  var ctx = canvas.getContext("2d");

  var light = new Lamp({
    position: new Vec2(200, 150),
    distance: 200
  });
  var disc = new DiscObject({ 
    center: new Vec2(100, 100), 
    radius: 30 
  });
  var rect = new RectangleObject({ 
    topleft: new Vec2(250, 200), 
    bottomright: new Vec2(350, 250) 
  });

  var lighting = new Lighting({
    light: light,
    objects: [ disc, rect ]
  });
  lighting.compute(canvas.width, canvas.height);
  ctx.fillStyle = "black";
  ctx.fillRect(0, 0, canvas.width, canvas.height);
  lighting.render(ctx);

Trying to test out http://greweb.me/illuminated.js/gettingstarted.html but I get errors about the ctx. I tried the renderer.context but nothing changed. Is this something that needs to be rewired for PIXI or is there a simple replacement for the reference?

Share this post


Link to post
Share on other sites
On 1/18/2016 at 10:16 AM, ivan.popelyshev said:

var renderer = PIXI.autoDetectRenderer(800, 600);
var canvas = renderer.view;
var ctx = renderer.context;

Though I dont know how can you use "ctx" for anything, renderer.render(stage) will completely wipe the canvas and do its job.

How about drawing shadowBlur for Canvas objects? I don't know how to do that in PIXI.js.

Share this post


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

Guest
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.

Loading...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.