package require Tk
proc rainbowtunnel w {
$w create oval 99 99 101 101 -fill [lcycle ::colors2] \
-outline {} -tag oval
$w scale oval 100 100 1.1 1.1
foreach item [$w find withtag oval] {
if {[lindex [$w bbox $item] 0]<-50} {$w delete $item}
}
after 100 [list after idle [info level 0]]
}
#-- General-use utilities:
proc lcycle listVar {
upvar 1 $listVar list
set first [lindex $list 0]
set list [linsert [lrange $list 1 end] end $first]
set first
}
set colors {purple blue green3 green yellow orange red magenta}
foreach color $colors {lappend colors2 $color $color}
#-- "main"
pack [canvas .c -width 200 -height 200]
rainbowtunnel .cSee also TclTrain where the same effect is used on a railroad.

