Here's a script that builds an animated spinner:
Code:
blank = BlankClip(length=35, width=96, height=96, pixel_type="RGB32", fps=30, color=$000000)
box = BlankClip(length=120, width=12, height=12, pixel_type="RGB32", fps=30, color=$ffffff)
Overlay(blank, box, x=42, y=10)
Blur(1.0)
Animate(0,35, "Rotate", last,0, last,360)
b = blankclip(last)
ScriptClip("""
b = b.Loop(2,0,0).Overlay(last, mode="lighten")
return b
""")
last+last.Reverse().FlipHorizontal() # 70 frames
last+last+last+last # 280 frames
It has to be run linearly to work correctly. Save the result as spinner.avi.
Here's a function to simulate buffering at an indicated frame, for an indicated length (number of frames). The original video's length is increased by the number of frames.
Code:
function SimulateBuffering(clip c, clip spinner, int start, int length)
{
p1 = c.Trim(0,start)
p2 = c.Trim(start,start).Loop(length,0,0)
p2 = Overlay(p2, spinner, mask=spinner.ColorYUV(cont_y=50), x=c.width/2-spinner.width/2, y=c.height/2-spinner.height/2)
p3 = c.Trim(start+1,0)
p1+p2+p3
}
Use it like this:
Code:
WhateverSource("filename.ext")
spinner = AviSource("spinner.avi").ConvertToYV12()
SimulateBuffering(spinner,1000,125)
SimulateBuffering(spinner,500,100)