George Peter Staplin Sep 24, 2007 - Animngext is a portable Tcl extension that uses
animng and
megaimage. It's available from
megapkgHere's an example demo:
set dir [file dirname [info script]]
source [file join $dir demoarch.tcl]
set fd [open [lindex $argv 0] r]
fconfigure $fd -translation binary
set obj [animng [read $fd]]
close $fd
set frames [$obj gettotalframes]
set images [list]
for {set i 0} {$i < $frames} {incr i} {
set image [list]
lappend image [$obj getframe x y delay]
lappend image $delay
lappend images $image
}
proc next-image {images mobj step} {
lassign [lindex $images $step] data delay
$mobj setdata $data
.f objsetimage $mobj
puts "$step $delay"
incr step
if {$step >= [llength $images]} {
set step 0
}
after $delay [list next-image $images $mobj $step]
}
megaimage.frame .f
.f size 300 300
pack .f -expand 1 -fill both
set mobj [megaimage-blank 1 1]
next-image $images $mobj 0
Note: to destroy an animng instance use:
rename $inst {} Currently there is no support for writing animng files from Tcl. It's hoped that in the future this will be done...