Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # usage: trim(start,end).SmoothScrollingTitles(shift)
- # to calculate the shift use this formula: (glyph.Ypos.at.bottom - same.glyph.Ypos.at.top) / number.of.frames.between
- function SmoothScrollingTitles( clip c, float shift ) {
- function shiftvert(clip c, float shift) { c.lanczosresize(c.width,c.height,0,shift,c.width,c.height) }
- function m4p(float f) { return ceil(abs(f)/4+0.5)*4 }
- assert(shift>0, "shift should be a positive number")
- overlap = m4p(shift * 10)
- vBackOvr = c.crop(0,0,0,overlap*2)
- vForth = RAverageW(c, 0.2, c.trim(1,0).shiftvert(-shift), 0.2, c.trim(2,0).shiftvert(-shift*2), 0.2, c.trim(3,0).shiftvert(-shift*3), 0.2, c.trim(4,0).shiftvert(-shift*4), 0.2)
- vBack = RAverageW(vBackOvr.duplicateframe(0,0,0,0).shiftvert(shift*4), 0.2,
- \vBackOvr.duplicateframe(0,0,0).shiftvert(shift*3), 0.2, vBackOvr.duplicateframe(0,0).shiftvert(shift*2), 0.2,
- \vBackOvr.duplicateframe(0).shiftvert(shift), 0.2, vBackOvr, 0.2)
- stackvertical(vBack.crop(0,0,0,overlap), vForth.crop(0,overlap,0,0))
- #now fix the first and last 5 frames
- vNNEDI = c.nnedi3()
- function animateme(clip averaged, clip interpolated, float shift) {
- shift4p = m4p(shift)
- shift < 0 ? stackvertical(interpolated.crop(0,0,0,shift4p), averaged.shiftvert(shift).crop(0,shift4p,0,0))
- \ : stackvertical(averaged.shiftvert(shift).crop(0,0,0,averaged.height-shift4p), interpolated.crop(0,interpolated.height-shift4p,0,0))
- }
- freezeframe(0,4,5).animate(0,4,"animateme",vNNEDI,-shift*5,vNNEDI,-shift).trim(0,4)
- \+trim(5,c.framecount-6)
- \+trim(c.framecount-6,0).freezeframe(1,5,0).animate(1,5,"animateme",vNNEDI.trim(c.framecount-6,0),shift,vNNEDI.trim(c.framecount-6,0),shift*5).trim(1,5)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement