I have a logo image inside PlayCanvas project, in the same project I have an HTML script with the Image tag, and I need to pass that logo to the image tag somehow , any idea how ?
You can do that by attaching the HTML asset to the HTML DOM, here is some sample code which you can run in a regular script and also check the HTML examples:
I already checked those tutorials, even tho they are only examples.
Even maybe there is an example but I missed it, I only need how to pass image to src attribute on tag, I was trying to find a link of the image in the project editor, but not successful
So if anyone has a solution to this, i would be grateful
So, if you’ve followed the tutorials and the HTML has been appended to the page DOM then to change the img src you can do this (e.g. using the image id):
var imageElement = document.getElementById('my-image-id'); imageElement.src = 'http://my-image-url.com';
Maybe my English is not good when i try to describe things hah
Let’s use for example this line you wrote
“imageElement.src = ‘http://my-image-url.com’;”
Now, how can i know, what is my link of the image I have inside Playcanvas project, so I can replace it with this 'http://my-image-url.com" link
Find your asset from the asset registry and then use the following method to get the full url:
This is it , thank you @Leonidas