i made function quick , simple ui animation
delegate sub animatedoublesetter(value double) sub animatedouble(setter animatedoublesetter, [from] double, [to] double, durationms double) dim t new system.windows.threading.dispatchertimer {.interval = new timespan(400000)} dim starttime = datetime.now dim diff = [to] - [from] addhandler t.tick, sub() dim ms = (datetime.now - starttime).totalmilliseconds dim fraction = math.min(ms / durationms, 1) if fraction = 1 t.stop() setter([from] + diff * fraction) end sub t.start() end sub
and use this
animatedouble(sub(x double) cbackground.opacity = x, 0, 0.3, 200)
it occurred me though, since cbackground.opacity property, pair of functions consisting of getter/setter. possible extract setter function property pass or maybe property itself?
Comments
Post a Comment