I have nine image elements in my scene that I want to apply one of six textures to at random. I have two arrays created, one for the image assets and one for the image elements. How would I apply the selected textures to the elements?
So far I’ve tried:
RandomImage.attributes.add('images', {type: 'asset', assetType: 'texture', array: true, title: 'Images'});
// initialize code called once per entity
RandomImage.prototype.initialize = function()
{
var image;
var planes = this.app.root.findByTag("symbol"); //Image elements in scene
for(i=0;i<planes.length;i++)
{
image = this.images[Math.floor(Math.random()*this.images.length)];
console.log(image.name);
planes[i].element.texture = image;
}
};
But planes[i].element.texture = image;
returns a seemingly endless amount of errors/warnings.