pinterf / AviSynthPlus

AviSynth with improvements
http://avs-plus.net
208 stars 24 forks source link

added assignment operator := #21

Closed addewyd closed 5 years ago

addewyd commented 6 years ago

Added very useful operator which returns a value

Some examples:

-------------------------------------------------

w := h := 256

b := blankclip(width=w * 2, height = h * 3, length=40, pixel_type="yv12")
bm = blankclip(width=w, height = w).letterbox(2,0,2,0, color=$ff)
b

for(j = 0, 1, 1) {
    for(i = 0, 1, 1) {
        e = 0 + i * 16 + j * 16 * 4
        ce = string(e)
        c = bm.subtitle("Y = 0x" + hex(e) + " " + ce)
        eval("c" + string(i) + string(j) + " := c")
        b := b.overlay(c, x = i * w, y = j * h)
    }
}

cx = c00.trim(0, 9) + c01.trim(0, 9) + c10.trim(0, 9) + c11.trim(0, 9) 

b := overlay(cx, x = 0, y = w * 2)

 /* defined NEW_AVSVALUE at build */

array = [99, 101, "303", cnt := 4]

for(j = 0, cnt - 1, 1) {
    b := subtitle(string(array[ind := j]), x = 100, y=(j+1) * 20)
}

g := b.tstfunc(kf := "first", ks := "second")

g := subtitle((s := 4) > 0 ? t := "left" : t := "right", y = 100)
g := subtitle(string(s) + " " + t + " " + ks, y = 150)

eval("""h := g.subtitle("G", x=200, y = 20)""")

h.subtitle("H " + string(ind), x = 300, y = 20)

function tstfunc(c, d, e) {
    if (f := 1 < 2) {
        c.subtitle(string(f) + e, y = 50)
    } else {
        c.subtitle(d, y = 50)
    }
}
pinterf commented 5 years ago

Thanks for your patience, just a quick acknowledgement that I've seen it, will look at it soon (=definitely not months).