Giter Club home page Giter Club logo

pixi-shim's Introduction

PIXI-SHIM

PIXI.js Back-End "shim". For mocking Canvas in Node.js with ❤️

https://badge.fury.io/js/pixi-shim https://circleci.com/gh/Prozi/pixi-shim https://snyk.io/test/github/Prozi/pixi-shim

Purpouse

  1. Designed for node - it makes you run universal javascript code that is designed with pixi.js on node.js environment

  2. It is very lazy - meaning it won't load anything twice and won't attempt to load it if it's not required

  3. It wont even load itself twice - while including multiple instances of pixi.js can cause Cannot redefine property isJson Error

Lazy loading

with lazy polyfill of

  • DOM
  • Window
  • Canvas
  • PIXI
  • other polyfills (requestAnimationFrame, etc.)

Usage

require("pixi-shim");

Usage if your game/app is feature-heavy:

and it still doesn't work, you might need to

$ yarn add pixi.js-legacy

and then do

require("pixi-shim");
require("pixi.js-legacy");

Installation

$ yarn add pixi-shim

DEBUG

environment flag DEBUG enables DEBUG with progress on which polyfill have been loaded

$ DEBUG=pixi-shim node -r pixi-shim yourscript.js

Canvas.toDataURL()

a bit hackish but works, see:

Tests

Total test suites: 2
Passed test suites: 2
Done in 4.35s.
ites: 0

Total tests: 10
Passed tests: 10
Failed tests: 0

Test Suite - /home/pietal/projects/pixi-shim/index.spec.js
passed - GIVEN pixi-shim THEN requiring it doesnt throw error
passed - GIVEN pixi-shim THEN new PIXI.Application doesnt throw error
passed - GIVEN pixi-shim THEN new PIXI.Sprite from base64 image does *not* work
passed - GIVEN pixi-shim THEN toDataURL does *not* yet work
passed - GIVEN pixi-shim THEN normal PIXI gameLoop works

Test Suite - /home/pietal/projects/pixi-shim/pixi.spec.js
passed - GIVEN pixi-shim/pixi THEN requiring it doesnt throw error
passed - GIVEN pixi-shim/pixi THEN new PIXI.Application doesnt throw error
passed - GIVEN pixi-shim/pixi THEN new PIXI.Sprite from base64 image *should* work
passed - GIVEN pixi-shim/pixi THEN toDataURL *should* work with pixi.js
passed - GIVEN pixi-shim/pixi THEN normal PIXI gameLoop works

https://app.circleci.com/pipelines/github/Prozi/pixi-shim

License

MIT (c) 2020-2022 Jacek Pietal

pixi-shim's People

Contributors

dependabot[bot] avatar prozi avatar snyk-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

pixi-shim's Issues

use demo get stuck

the code

// pixi run on node `test.pixi.js`
const PIXI = require('pixi-shim')
// console.log('PIXI:', PIXI)

// no run the code
var app = new PIXI.Application(800, 600, { backgroundColor: 0x1099bb });
document.body.appendChild(app.view);

var basicText = new PIXI.Text('Basic text in pixi');
basicText.x = 30;
basicText.y = 90;

app.stage.addChild(basicText);

// The official demo
var style = new PIXI.TextStyle({
  fontFamily: 'Arial',
  fontSize: 36,
  fontStyle: 'italic',
  fontWeight: 'bold',
  fill: ['#ffffff', '#00ff99'], // gradient
  stroke: '#4a1850',
  strokeThickness: 5,
  dropShadow: true,
  dropShadowColor: '#000000',
  dropShadowBlur: 4,
  dropShadowAngle: Math.PI / 6,
  dropShadowDistance: 6,
  wordWrap: true,
  wordWrapWidth: 440
});

var richText = new PIXI.Text('Rich text with a lot of options and across multiple lines', style);
richText.x = 30;
richText.y = 180;

app.stage.addChild(richText)

app.view.toDataURL((blob) => {
  console.log('app.view:', blob)
})

image

how to update to run the code, can you help me?, Thanks!!!

Can I export the render from PIXI?

Hi there,

I can get the basic demo working, it prints the FPS and starts correctly and then exits after adding the bunny to the stage.

However, just curious, is there anyway I can export the image data in the canvas? I notice the note in the README:

toDataURL: not ready yet (renders transparent image)

Which is what I get - I get blank PNG outputted from the example in tests/

Is there anyway I can export the render or dump the webgl context at all ?

TypeError: 'addEventListener' called on an object that is not a valid instance of EventTarget.

I face the problem of initializing the PIXI application

My code is that

const PIXI = require("pixi-shim/pixi.js");

const app = new PIXI.Application({ width: 200, height: 200 });

And output

pixi-shim ❤️ DOM
pixi-shim ❤️ Window 1024x768
pixi-shim ❤️ Canvas
WebGL not available for compressed textures. Silently failing.
/Users/kopkap/Desktop/2.learn/3.pixi-node/node_modules/jsdom/lib/jsdom/living/generated/EventTarget.js:101
        throw new globalObject.TypeError(
        ^

TypeError: 'addEventListener' called on an object that is not a valid instance of EventTarget.
    at addEventListener (/Users/kopkap/Desktop/2.learn/3.pixi-node/node_modules/jsdom/lib/jsdom/living/generated/EventTarget.js:101:15)
    at new AccessibilityManager (/Users/kopkap/Desktop/2.learn/3.pixi-node/node_modules/@pixi/accessibility/dist/cjs/accessibility.js:177:20)
    at CanvasRenderer.AbstractRenderer.initPlugins (/Users/kopkap/Desktop/2.learn/3.pixi-node/node_modules/@pixi/core/dist/cjs/core.js:9043:31)
    at new CanvasRenderer (/Users/kopkap/Desktop/2.learn/3.pixi-node/node_modules/@pixi/canvas-renderer/dist/cjs/canvas-renderer.js:419:15)
    at Function.create (/Users/kopkap/Desktop/2.learn/3.pixi-node/node_modules/@pixi/canvas-renderer/dist/cjs/canvas-renderer.js:871:12)
    at Object.autoDetectRenderer (/Users/kopkap/Desktop/2.learn/3.pixi-node/node_modules/@pixi/core/dist/cjs/core.js:9717:21)
    at Object.Application (/Users/kopkap/Desktop/2.learn/3.pixi-node/node_modules/@pixi/app/dist/cjs/app.js:78:30)
    at Object.<anonymous> (/Users/kopkap/Desktop/2.learn/3.pixi-node/index.js:3:18)
    at Module._compile (node:internal/modules/cjs/loader:1099:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)

I guess it's related to jsdom-global

404 when downloading tarball

The install fails when it gets a 404 for the following tarball

https://github.com/chearon/node-canvas-prebuilt/releases/download/v1.6.11/canvas-prebuilt-v1.6.11-node-v67-win32-x64.tar.gz

toDataURL only show canvas backgroundColor?

hello,
My code is below

const PIXI = require("pixi-shim/pixi.js");

const app = new PIXI.Application({ width: 200, height: 200, backgroundColor: 0x061639, preserveDrawingBuffer: true });
const bunny = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABoAAAAlCAYAAABcZvm2AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAWNJREFUeNrsV8sNwjAMbUqBBWACxB2pQ8AKcGALTsAJuDEFB1gBhuDAuWICmICPQh01pXWdJqEFcaglRGRbfonjPLuMc+5QwhjLGEJfZusjxZOL9akZKye9G98vPMfvsAx4qBfKwfzBL9s6uUHpI6U/u7+BKGkNb/H6umtk7MczF0HyfKS4zo/k/4AgTV8DOizrqX8oECgC+MGa8lGJp9sJDiAB8nyqYoglvJOPbP97IqoATGxWVZeXJlMQwYHA3piF8wJIblOVNBBxe3TPMLoHIKtxrbS7AAbBrA4Y5NaPAXf8LjN6wKZ0RaZOnlAFZnuXInVR4FTE6eYp0olPhhshtXsAwY3PquoAJNkIY33U7HTs7hYBwV24ItUKqDwgKF3VzAZ6k8HF+B1BMF8xRJbeJoqMXHZAAQ1kwoluURCdzepEugGEImBrIADB7I4lyfbJLlw92FKE6b5hVd+ktv4vAQYASMWxvlAAvcsAAAAASUVORK5CYII='
function createImage() {
    const image = document.createElement("img");

    image.src = bunny;

    return image;
}
const image = createImage();
const sprite = PIXI.Sprite.from(image.src);
sprite.width = 100
sprite.height = 100
const { width, height } = sprite
console.log(width, height)
app.stage.addChild(sprite);
app.render()

const base64 = app.view.toDataURL("image/png", 1);
const res = base64.replace(/^data:image\/png;base64,/, "")
require("fs").writeFile("out1.png", res, 'base64', (err) =>{
    console.log( err);
})

the result
out1

Is it wrong?

Window is not defined, in Webpack 5 bundle webworker

I'm trying to use this in a webpack 5 bundle for a webworker. I get an error that window is not defined from pixi-shim/polyfills/window.js.

window.js:10 Uncaught (in promise) ReferenceError: window is not defined
    at Object../node_modules/pixi-shim/polyfills/window.js (window.js:10)
    at __webpack_require__ (bootstrap:21)
    at fn (hot module replacement:61)
    at Object../node_modules/pixi-shim/index.js (index.js:4)
    at __webpack_require__ (bootstrap:21)
    at fn (hot module replacement:61)
    at Module../src/RenderStore.ts (Projectile.ts:34)
    at __webpack_require__ (bootstrap:21)
    at fn (hot module replacement:61)
    at Module../src/ClientStore.ts (Camera.ts:7)

I'm totally confused because I thought this module was meant for headless environments like Node why is it looking for a window?

Errors while running tests

I got errors after npm run test.

Pixijs: 5.2.0
Node: v12.16.1
npm: 6.13.4
OS: Linux c941d9eb4574 4.4.0-142-generic #168-Ubuntu SMP Wed Jan 16 21:00:45 UTC 2019 x86_64 GNU/Linux

Output:

npm run test

> [email protected] test /usr/src/app/node_modules/pixi-shim
> node tests

pixi-shim ❤️ DOM
pixi-shim ❤️ Window 1024x768
pixi-shim ❤️ Canvas + WebGL
pixi-shim ❤️ polyfill performance.now
pixi-shim ❤️ polyfill requestAnimationFrame
pixi-shim ❤️ PIXI.js
{ getContext: { type: '2d', contextOptions: {} } }
{ getContext: { type: '2d', contextOptions: {} } }
pixi-shim ❤️ initialized in: 507.297ms
{ getContext: { type: 'webgl2', contextOptions: {} } }
terminate called after throwing an instance of 'std::logic_error'
  what():  basic_string::_M_construct null not valid
Aborted (core dumped)
npm ERR! code ELIFECYCLE
npm ERR! errno 134
npm ERR! [email protected] test: `node tests`
npm ERR! Exit status 134
npm ERR! 
npm ERR! Failed at the [email protected] test script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2020-03-13T13_40_21_577Z-debug.log

base64 images aren't rendered by pixi sprite

I'm trying to get pixi-shim working with images. I'm following the example from the project specs and it will render the pixi canvas correctly but it doesn't show the image from the sprite. Am I missing something? How can I render the canvas as an image?

Dependency versions:

  • pixi-shim: ^2.3.7
  • canvas: ^2.8.0
  • pixi.js-legacy: 6.0.0
const PIXI = require('pixi-shim/pixi.js');
const bunny =
  'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABoAAAAlCAYAAABcZvm2AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAWNJREFUeNrsV8sNwjAMbUqBBWACxB2pQ8AKcGALTsAJuDEFB1gBhuDAuWICmICPQh01pXWdJqEFcaglRGRbfonjPLuMc+5QwhjLGEJfZusjxZOL9akZKye9G98vPMfvsAx4qBfKwfzBL9s6uUHpI6U/u7+BKGkNb/H6umtk7MczF0HyfKS4zo/k/4AgTV8DOizrqX8oECgC+MGa8lGJp9sJDiAB8nyqYoglvJOPbP97IqoATGxWVZeXJlMQwYHA3piF8wJIblOVNBBxe3TPMLoHIKtxrbS7AAbBrA4Y5NaPAXf8LjN6wKZ0RaZOnlAFZnuXInVR4FTE6eYp0olPhhshtXsAwY3PquoAJNkIY33U7HTs7hYBwV24ItUKqDwgKF3VzAZ6k8HF+B1BMF8xRJbeJoqMXHZAAQ1kwoluURCdzepEugGEImBrIADB7I4lyfbJLlw92FKE6b5hVd+ktv4vAQYASMWxvlAAvcsAAAAASUVORK5CYII=';
const image = document.createElement('img');

image.src = bunny;

const app = new PIXI.Application({ backgroundColor: 0x1099bb, preserveDrawingBuffer: true });
const sprite = PIXI.Sprite.from(image.src);

app.stage.addChild(sprite);
app.render();

const base64 = app.view.toDataURL('image/png', 1).replace(/^data:image\/png;base64,/, '');

require('fs').writeFile('test.png', base64, 'base64', (err) => {
  console.log(err);
});

Error: Not implemented: HTMLCanvasElement.prototype.getContext

This simple script fails on node 12.13:

const PIXI = require('pixi-shim')

const app = new PIXI.Application(800, 600, { backgroundColor: 0x1099bb });

with these exceptions:

pixi-shim ❤️ dom
pixi-shim ❤️ canvas
pixi-shim ❤️ pixijs
Error: Not implemented: HTMLCanvasElement.prototype.getContext (without installing the canvas npm package)
    at module.exports (/Volumes/Data/Workspace/touchtech/dsr-mail/node_modules/jsdom/lib/jsdom/browser/not-implemented.js:9:17)
    at HTMLCanvasElementImpl.getContext (/Volumes/Data/Workspace/touchtech/dsr-mail/node_modules/jsdom/lib/jsdom/living/nodes/HTMLCanvasElement-impl.js:42:5)
    at HTMLCanvasElement.getContext (/Volumes/Data/Workspace/touchtech/dsr-mail/node_modules/jsdom/lib/jsdom/living/generated/HTMLCanvasElement.js:50:45)
    at createWhiteTexture (/Volumes/Data/Workspace/touchtech/dsr-mail/node_modules/@pixi/core/lib/core.js:3743:26)
    at Object.<anonymous> (/Volumes/Data/Workspace/touchtech/dsr-mail/node_modules/@pixi/core/lib/core.js:3779:17)
    at Module._compile (internal/modules/cjs/loader.js:956:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)
    at Module.load (internal/modules/cjs/loader.js:812:32)
    at Function.Module._load (internal/modules/cjs/loader.js:724:14)
    at Module.require (internal/modules/cjs/loader.js:849:19) undefined
/Volumes/Data/Workspace/touchtech/dsr-mail/node_modules/@pixi/core/lib/core.js:3745
    context.fillStyle = 'white';
                      ^

TypeError: Cannot set property 'fillStyle' of null
    at createWhiteTexture (/Volumes/Data/Workspace/touchtech/dsr-mail/node_modules/@pixi/core/lib/core.js:3745:23)
    at Object.<anonymous> (/Volumes/Data/Workspace/touchtech/dsr-mail/node_modules/@pixi/core/lib/core.js:3779:17)
    at Module._compile (internal/modules/cjs/loader.js:956:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)
    at Module.load (internal/modules/cjs/loader.js:812:32)
    at Function.Module._load (internal/modules/cjs/loader.js:724:14)
    at Module.require (internal/modules/cjs/loader.js:849:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/Volumes/Data/Workspace/touchtech/dsr-mail/node_modules/@pixi/extract/lib/extract.js:12:12)
    at Module._compile (internal/modules/cjs/loader.js:956:30)

It looks like the installed dependencies are:
PixiJS 5.2.0
canvas 2.6.0

Cannot get tests to work

Hi Prozi—I followed all the instructions to install pixi-shim via yarn but when I run the tests I get the following output

raphdamico@Raphs-MacBook-Pro-2 pixi-shim-master-2 % node tests
pixi-shim ❤️ DOM
pixi-shim ❤️ Window 1024x768
pixi-shim ❤️ polyfill performance.now
pixi-shim ❤️ polyfill requestAnimationFrame
pixi-shim ❤️ PIXI.js
{ 'PIXI.Application': true }
{
  canvas: {
    getContext: [Function: getContext],
    toDataURL: [Function: toDataURL]
  }
}
{
  image: HTMLImageElement {
    [Symbol(SameObject caches)]: [Object: null prototype] { style: [CSSStyleDeclaration] }
  },
  context: {}
}
{ 'sprite dimensions': { width: 16, height: 16 } }
{ 'PIXI.Sprite.from': true }
{ base64: '', toDataURL: true }
{ FPS: '0.00' }
raphdamico@Raphs-MacBook-Pro-2 pixi-shim-master-2 % 

It just looks like it's silently failing. It doesn't seem like I'm missing anything so any help figuring out this issue would be incredibly appreciated.

What is the expected output for this test?

(I'm hoping to use pixi via pixi-shim to generate an animation on the server, export the frames and stitch them together into an animated GIF. Do you think pixi via pixi-shim has the basic features needed to make that work?)

Provide full examples showcasing PIXI's features running in node

If we provide developers with rich examples that they can use as a starting point, it's more likely devs will be able to pick up this library easily, which can ultimately help with gaining contribution efforts.

The README and test.js files currently show very minimal examples. It would be great if they showcased the extents of what can be achieved with PIXI in a node environment.

How to use pixi layers with pixi shim?

I tried to use pixi layers with pixi shims, but I always get this error:

Error: Cannot find module '@pixi/display'

I tried to import it with require:

const PIXI = require("pixi-shim");
const layers = require("@pixi/layers")

Error loading EGL entry points. (Segmentation fault)

Hello!
I try to run,but can't run.
step:
npm install pixi-shim

✔ Installed 1 packages
✔ Linked 216 latest versions
[1/2] scripts.install [email protected] › node-gles@* run "node scripts/install.js", root: "/root/node_modules/[email protected]@node-gles"
* Downloading ANGLE
[==============================] 5699402/bps 100% 0.0s
* Building ANGLE bindings
[1/2] scripts.install [email protected] › node-gles@* finished in 7s
[2/2] scripts.install [email protected] › canvas@^2 run "node-pre-gyp install --fallback-to-build", root: "/root/node_modules/[email protected]@canvas"
node-pre-gyp WARN Using request for node-pre-gyp https download 
node-pre-gyp http GET https://cdn.npm.taobao.org/dist/node-canvas-prebuilt/v2.6.1/canvas-v2.6.1-node-v83-linux-glibc-x64.tar.gz
node-pre-gyp http 200 https://cdn.npm.taobao.org/dist/node-canvas-prebuilt/v2.6.1/canvas-v2.6.1-node-v83-linux-glibc-x64.tar.gz
[canvas] Success: "/root/node_modules/[email protected]@canvas/build/Release/canvas.node" is installed via remote
[2/2] scripts.install [email protected] › canvas@^2 finished in 2s
✔ Run 2 scripts
peerDependencies WARNING [email protected][email protected] › ws@^7.2.3 requires a peer of bufferutil@^4.0.1 but none was installed
peerDependencies WARNING [email protected][email protected] › ws@^7.2.3 requires a peer of utf-8-validate@^5.0.2 but none was installed
deprecate [email protected][email protected] › request@^2.88.2 request has been deprecated, see https://github.com/request/request/issues/3142
Recently updated (since 2020-07-11): 2 packages (detail see file /root/node_modules/.recently_updates.txt)
✔ All packages installed (234 packages installed from npm registry, used 13s(network 4s), speed 112.82kB/s, json 217(459.76kB), tarball 0B)

cd node_modules/pixi-shim/tests/
node index.js

pixi-shim ❤️ DOM
pixi-shim ❤️ Window 1024x768
pixi-shim ❤️ Canvas + WebGL
pixi-shim ❤️ polyfill performance.now
pixi-shim ❤️ polyfill requestAnimationFrame
pixi-shim ❤️ PIXI.js
{ getContext: { type: '2d', contextOptions: {} } }
{ getContext: { type: '2d', contextOptions: {} } }
pixi-shim ❤️ initialized in: 954.64ms
{ getContext: { type: 'webgl2', contextOptions: {} } }
Error loading EGL entry points.
Segmentation fault

How can I solve it?

Run a test suite continually

A test suite can run on a CI like travis-ci.org, and can be configured to run against many different versions of node and/or pixi.js.

The tests should cover a range of PIXI's features.

Here's an example of fabricjs doing this: https://travis-ci.org/fabricjs/fabric.js

This will both provide a working example, and give confidence to developers wanting to use the library in node.

Can't get Spring.from or Texture.from working

I'm trying to display some images and then view them via a data uri export of the canvas.

I can do text, shapes etc, but when I interact with the Loader, it either hangs (if I try to make it load) or it just has nothing on screen. Not sure where to look...

const PIXI = require('pixi-shim')
const app = new PIXI.Application({
      backgroundColor: 0x1099bb,
      width: 1000,
      height: 1000
    });
// pulled from old issue, breaks immediately with "app.stage.addChild(new (require('pixi-shim') as any).Sprite.fromImage('cas.png'));"
// app.stage.addChild(new (require('pixi-shim') as any).Sprite.fromImage('cas.png'));
// executes, but I get nothing on the canvas
app.stage.addChild(PIXI.Sprite.from(tex));

// Some random thing, this works ok
const graphics = new PIXI.Graphics();
graphics.beginFill(0xDE3249);
graphics.drawRect(500, 50, 100, 100);
graphics.endFill();
app.stage.addChild(graphics);

app.render() // not seen in any examples, but if this isn't here, the canvas is blank

const data = app.view.toDataURL("image/png", 1); // works, but only shows the geometry

Not sure what I'm doing wrong, as this feels like it should work. Is there a race or requirements I've missed somewhere?

Error: Could not locate the bindings file

Trying a simple case, but I'm getting a "binding" error.

pixi-shim ❤️ DOM
pixi-shim ❤️ Window 1024x768
/var/www/html/node-character/node_modules/bindings/bindings.js:135
  throw err;
  ^

Error: Could not locate the bindings file. Tried:
 → /var/www/html/node-character/node_modules/node-gles/build/nodejs_gl_binding.node
 → /var/www/html/node-character/node_modules/node-gles/build/Debug/nodejs_gl_binding.node
 → /var/www/html/node-character/node_modules/node-gles/build/Release/nodejs_gl_binding.node
 → /var/www/html/node-character/node_modules/node-gles/out/Debug/nodejs_gl_binding.node
 → /var/www/html/node-character/node_modules/node-gles/Debug/nodejs_gl_binding.node
 → /var/www/html/node-character/node_modules/node-gles/out/Release/nodejs_gl_binding.node
 → /var/www/html/node-character/node_modules/node-gles/Release/nodejs_gl_binding.node
 → /var/www/html/node-character/node_modules/node-gles/build/default/nodejs_gl_binding.node
 → /var/www/html/node-character/node_modules/node-gles/compiled/10.16.2/linux/x64/nodejs_gl_binding.node
 → /var/www/html/node-character/node_modules/node-gles/addon-build/release/install-root/nodejs_gl_binding.node
 → /var/www/html/node-character/node_modules/node-gles/addon-build/debug/install-root/nodejs_gl_binding.node
 → /var/www/html/node-character/node_modules/node-gles/addon-build/default/install-root/nodejs_gl_binding.node
 → /var/www/html/node-character/node_modules/node-gles/lib/binding/node-v64-linux-x64/nodejs_gl_binding.node
    at bindings (/var/www/html/node-character/node_modules/bindings/bindings.js:126:9)
    at Object.<anonymous> (/var/www/html/node-character/node_modules/node-gles/dist/index.js:4:15)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at Object.<anonymous> (/var/www/html/node-character/node_modules/pixi-shim/lib/node/canvas.js:9:5)

Why doesn't `canvas.toDataURL()` work?

This one is too hacky. It won't be able to render complex use cases:

module.exports.toDataURL = function toDataURL(app) {

Can you answer why the result of getDataURL() only includes the canvas color and not the sprites?
Is there something that we have to change so that the server renders all graphics on to the canvas?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.