Hey all,
I'm playing around with GSAP trying to get a Guitar Hero-style effect work. The note div gets added to the tracks (the four vertical columns) successfully at the right time (with tl.call and tl.set), but tl.fromTo isn't working as the element can't be found. Any idea why?
Thanks for the assist.
function addToDom(track, i) {
var innerDiv = document.createElement('div');
innerDiv.className = 'note';
innerDiv.setAttribute("id", "note" + i);
const iDiv = document.getElementById("track" + track)
iDiv.appendChild(innerDiv);
}
function addtoTL() {
for (i = 0; i < this.testNoteTrack.length; i++) {
tl.call(addToDom, [this.testNoteTrack[i].track, i], null, this.testNoteTrack[i].time);
var elementName = "note" + i;
tl.set(elementName, {top: -150}, this.testNoteTrack[i].time);
tl.fromTo(elementName, {top: -150}, {top: this.viewHeight + 150, duration: 2, ease: "none"});
}
tl.play();
}