0

I'm trying to create a positioning animation for an image. i need a definite and non-repeating animation so, I've tried this code but, its not working.

<a-marker preset='hiro'  registerevents>

<a-entity cursor="rayOrigin: mouse" >

<a-image position="0 0 0" rotation="-90 0 0" width="1" height="1" position="0 0 0" src="#profile">
</a-image>

<a-animation attribute="position" dur="4000" fill="forwards" to="2 2 0" >
</a-animation>

</a-entity>

</a-marker>
borchvm
  • 3,533
  • 16
  • 44
  • 45
STEVE W
  • 1
  • 4

1 Answers1

0

Don't use a-animation. Instead place the animation component inside the image entity.

Like this:

<a-image position="0 0 0" rotation="-90 0 0" width="1" height="1" position="0 0 0" src="#profile" animation attribute="position" dur="4000" fill="forwards" to="2 2 0">
</a-image>

Thomas Williams
  • 842
  • 6
  • 13
  • @Thomas_Williams ,Thanks for your reply , but the image doesn't change its position. It remains in the same position= 0 0 0 . – STEVE W Oct 01 '19 at 06:16
  • `` may not work with animation position (haven't tested this myself so I can't say for sure). But if you use `` then animation will definitely work. Be sure to set the width and height to the aspect ratio of the source image. If you want to image to appear in screen space, parent it to the camera. You can do this by placing it inside or the entity camera. Generally it is best to only use a-entity, and avoid all the other a-image, a-plane, etc. – Thomas Williams Oct 01 '19 at 19:50