After some digging, I figured out a way to make this happen. Its not perfect, but I saw a few similar questions that had gone unanswered, so I figured I'd post it here for any future passers-by.
Getting each individual feature can be done by calling layer.queryFeatures() on the layer. This returns a FeatureSet , which is essentially a collection of Graphics . There is no way to control the opacity of a Graphic. However, you can create an array of new layers from the FeatureSet, each with a singular graphic representing one point:
let layerView;
let flFromResults;
view.whenLayerView(torchRelay).then((lv) => {
torchRelay.queryFeatures().then(function (results) {
// create a new feature layer for each feature in the original layer
flFromResults = results.features.map((feature) => {
const layer = new FeatureLayer({
objectIdField: "OBJECTID",
source: [feature],
fields: results.fields,
popupTemplate: feature.popupTemplate,
renderer
});
// listen for layer to be created, then call animation function
layer.on("layerview-create", () => {
fadeVisibilityOn(layer);
});
return {
time: feature.attributes.Time,
onmap: false,
shouldBeAdded: false,
layer
};
});
});
layerView = lv;
layerView.filter = {
where: `Time <= 'nope'`
};
});
timeSlider.watch("timeExtent", function (value) {
const dateString = value.end.getTime();
flFromResults && flFromResults.forEach((p) => {
if (p.time <= dateString) {
p.shouldBeAdded = true;
} else {
p.shouldBeAdded = false;
}
if (!p.onmap && p.shouldBeAdded) {
map.add(p.layer);
p.onmap = true;
}
if (p.onmap && !p.shouldBeAdded) {
map.remove(p.layer);
p.onmap = false;
}
});
});
These if else statements will check the date of the timeslider against the date of each layer, and add and remove layers accordingly. And voila, a fade in effect:
Working codepen
The codepen has a bit of a wierd flash effect going on, but that is not occuring on my local machine.
This method is probably not optimal, as it requires the creation of a new layer for every feature, but I can't find a way to set opacity on individual features. Perhaps using a new GraphicsLayer instead of new FeatureLayer would be more optimal. But it does work. Hopefully this helps someone else in the future.