Declaring the 'asset/s' via the samples in Playcanvas

How do you declare the values of “assets”?

Particles-spark’s example in TS show it is from pc.asset. How should I declare this variable to make the code work via html + js?

The canvas I declare as :

const canvas = document.getElementById(‘application-canvas’);

which provides a small black window to load the sample animations. However, the assets can’t seem to load.

I also checked the TS version of the sample and found it is declared as such:

function example(canvas: HTMLCanvasElement, assets: { spark: pc.Asset }):

How do I delcare this in JS so I can load it via HTML?

A post was merged into an existing topic: Working with the samples in PlayCanvas - canvas and asset not working