- 
                Notifications
    
You must be signed in to change notification settings  - Fork 31
 
Description
I have been trying to build some unique visuals in Hubble, and some of them I have been generating on the fly. I have called these dynamicDeckLayers on my end, and I have gotten inspiration from the code powering the terrain example.
The way I got it to work is by doing something like this:
  const layers = [...] //terrain, trips layer
  const dynamicDeckLayers = (t: number) => [...] // scenegraph, geojson layers with dynamic position/datasets based on time
  const updateMapProps = () => {
    ...
    const layerKeyframes = [
      ...(layers ?? []),
      ...(dynamicDeckLayers && currentTime
        ? dynamicDeckLayers(currentTime)
        : []),
    ];
    // @ts-expect-error this is a DeckAnimation, which has setGetLayers defined
    adapter.animationManager.getAnimation("deck").setGetLayers((a) => {
      return a.applyLayerKeyframes(layerKeyframes);
    });
  };
  useEffect(() => {
    if (setCurrentTime) setCurrentTime(adapter.videoCapture.timeMs);
    updateMapProps();
  }, [adapter.videoCapture.timeMs, setCurrentTime]);This implementation worked for a while, but I am now removign the basemap from my Deck implementation in favor of the TerrainExtension functionality, to support draping, and its throwing my implementations down the drain.
As you can currently see in the terrain example on the site, turning on rainbow toggle throws errors. I dont know if this is a deck or hubble error, but I am seeing similar (lack of) behavior when I use the TerrainLayer within the setGetLayer call.
Furthermore, I dont use the TerrainLayer dynamically, like I do other layers, so I was curious about approaching this by separating the stable from the dynamic layers?
I am slowly getting involved after a lot of time buried in unrelated, non-geo work, so I would love to have some discussions about maturing and simplifying the external api of this library with you.
Looking forward to conversing again soon @chrisgervang