0

Is there a way to animate the opacity of a glTF/glb model in a-frame so that it doesn't begin its fade-in until after a specified number of seconds, then remains at full opacity for a specified number of seconds, and then fades out?

Thanks to a really great solution posted by Piotr Adam Milewski in response to a similar question I'm successfully able to fade a model in and out using this script plus the following:-

  <a-entity 
    id="model01" 
    gltf-model="#head01" 
    scale="1 1 1" 
    shadow="receive: true"
    model-opacity animation='property: model-opacity.opacity;from: 1; to: 0; dur: 2500;loop: true; dir: alternate; startEvents: model-loaded'>
  </a-entity>

However, it doesn't quite do what I'm looking for as I'm hoping there's a way to create the delay/timing I've described?

Many thanks for taking the time to read this post (I hope it makes sense )... and thanks, too, in advance, for any help that you might be able to offer

Frannie
  • 27
  • 8
  • 1
    There is a [delay](https://aframe.io/docs/1.3.0/components/animation.html#api_delay) property. If it works only at the beginning of the animation, then I'd separate and daisy chain two animations. Should work, I'll check it out once I'm at my pc – Piotr Adam Milewski Aug 07 '22 at 11:16
  • *Huge thanks* for the suggestion @PiotrAdamMilewski - it's greatly appreciated!!! I'll check it out and post back up here (hopefully flagging up some success ) asap. – Frannie Aug 07 '22 at 16:14
  • The following worked perfectly:- `model-opacity animation__1='property: model-opacity.opacity;from: 1; to: 0; delay: 5000; dur: 2500; loop: false; dir: forward; startEvents: model-loaded' animation__2='property: model-opacity.opacity;from: 0; to: 1; delay: 10000; dur: 2500; loop: false; dir: forward; startEvents: model-loaded'` I had to set loop: false for it to run okay, though. Might there be a way for the animations sequences to be looped as whole? – Frannie Aug 07 '22 at 18:45
  • Ooops, apols... I should have stated dir: normal (not forward). – Frannie Aug 08 '22 at 10:11

0 Answers0