-
Auto-slide Null to position on marker
Hi everyone,
I’m having difficulties getting the expression right for the following setup:
Imagine a timetable with lots of different agenda items from top to bottom. Each agenda item is in it’s own layer precomposed and sequencially played in my main timetable comp (see attached photo). So every x seconds a new agenda item is shown at the bottom. Because I can only show two items at the time I have all items linked to a Null “Content Position” which position moves on the y-axis upwards for x pixels so that the top item slides out.
What I want to archieve is to place markers on the Null and each time a marker is reached it reads the index of the marker, looks up the according agenda item (e. g. marker[1] -> “DI_01”) checks the height of the content within that comp (contentHeight = comp(“DI_01”).layer(“Content”).sourceRectAtTime().height) + margin) and moves Null “Content Position” up on the y-axis for the according amount of pixels. So it subtracts contentHeight from the current y-position.
Here’s what I’ve got so far, but it’s not properly working. Can you push me into the right direction? (PS: I was also thinking about adding a slide controller to handle the offset but I don’t really know if that’s the best way to do it)
<pre class=””>
<br></pre><p>day = "DI_";<br>layer = day;<br>margin = thisComp.layer("Content Position").effect("Margin")("ADBE Slider Control-0001");<br>offset = thisLayer.effect("Offset")("ADBE Slider Control-0001");<br>m = marker;<br>transitionTime = .5;<br>n = 0;<br>if (m.numKeys > 0){<br> n = m.nearestKey(time).index;<br> if (time < m.key(n).time) n--;<br>}<br>if (n > 0){<br> if(n < 10) {<br> layer = day + "0" + n;<br> } else {<br> layer = day + n;<br> }<br> s = eval('comp("' + layer +'").layer("Programm").sourceRectAtTime();');<br> addHeight = s.height + margin;<br> offset = addHeight;<br> t = time - m.key(n).time;<br> y = ease(time, n, transitionTime, value[1], addHeight);<br> value - [0,y]<br>} else<br> value</p><pre class="">
Thanks a lot!