将Pixi.js与Adobe AnimateCC Canvas一起使用-置换贴图

时间:2018-07-25 20:28:48

标签: canvas pixi.js animate-cc

我想知道如何在AnimateCC代码面板中定位ID为'canvas'的现有canvas div?

当前我正在尝试的代码示例,仅输出到其他画布元素

Download example files here

这也是我也尝试针对现有画布的目标...

(function() {


var pixiHolder = document.createElement('pixiHolder');

pixiHolder.width = 300;
pixiHolder.height = 250;

document.getElementById('canvas').appendChild(pixiHolder);

renderer = new PIXI.autoDetectRenderer(pixiHolder.width, 
pixiHolder.height, {

view: pixiHolder,
transparent: false,
backgroundColor: 0x223344

});

谢谢!

1 个答案:

答案 0 :(得分:1)

尝试一下

var renderer = new PIXI.autoDetectRenderer(canvas.width, canvas.height, {
  view: document.getElementById("yourCanvas"),
  transparent: false
});