In the canvas example, passing canvas to a canvas method for drawing animations that I have encapsulated won't show up. However, I can use the canvas in the web page to pass it to the encapsulated method, and it will work
Hi all who can tell me why?
Code
<hotspot url="canvas.js" distorted="true" ath="10" atv="10" scale="0.7" ondown="drawing();" />
local.registerplugin = function(krpanointerface, pluginpath, pluginobject)
{
krpano = krpanointerface;
plugin = pluginobject;
// create the HTML5 canvas object
canvas = document.createElement("canvas");
// set the canvas size
canvas.width = canvas_width;
canvas.height = canvas_height;
plugin.registercontentsize(canvas_width, canvas_height);
// add the canvas as 'videoDOM' element to krpano,
// krpano then thinks this is a video-element and updates
// its texture everytime when its currentTime value changes
plugin.videoDOM = canvas;
// fake some video-related properties
plugin.videowidth = canvas_width;
plugin.videoheight = canvas_height;
canvas.readyState = 4;
canvas.videoWidth = canvas_width;
canvas.videoHeight = canvas_height;
canvas.currentTime = 1;
if (plugin.onvideoreadyCB)
plugin.onvideoreadyCB();
// draw something
initCanvasAnimate(canvas); //init canvas methods
// add plugin API actions for doing something
plugin.setsize = action_setsize;
plugin.drawline = action_drawline;
}
function initCanvasAnimate(canvas: HTMLCanvasElement) {
const animate = YuCanvasAnimte.createSDK({
canvas: canvas,
})
throw new Error('not support')
} catch (error) {
console.error(error)
}
}
Display More