Attributes – src (Images)
Displaying Images and Videos
It is possible to add an image or a video (via the path or an inline URL) to entities:
<a-box id="box_square" position="-1 0.5 -3" rotation="0 45 0" color="#FFF" src="images/bulbasaur.gif" ></a-box> <a-box id="box_rect" position="0 1.25 -5" height="1" width="5" depth="1" rotation="0 45 0" color="#FF0" src="images/bulbasaur.gif" ></a-box>
- The image is repeated on all areas of the entity. This can be changed by using the tag
<a-image>
. The image primitive then shows an image on a flat plane. - As you can see, the
color
property will act as the base color and multiplies per pixel with the texture. Set it to#fff
to maintain the original colors of the texture. If the entity should not be seen, addtransparent= "true"
. - The images should have the same dimension as the image, otherwise there is a distortion. The can be changed with the
repeat
attribute
Repeat Attribute
The repeat
attribute allows to control, how many times the image is repeated on each side. If you just want to see an image which is not visible on all sides of the entity, use the tag <a-image>
.
<a-box id="box_rect" position="0 1.25 -5" height="1" width="5" depth="1" rotation="0 45 0" color="#FFF" src="images/bulbasaur.gif" repeat="5 1" ></a-box>
Example
Use this example to test.
Previous TopicNext Topic