set grad [$w gradient create linear -stops \ {{0.0 #00bb00} {0.35 #00bb00} {0.35 #ffff00} {0.50 #ffff00} \ {0.50 #ff6600} {0.65 #ff6600} {0.65 #dd0000} {0.8 #dd0000} \ {0.8 #3366cc} {1.0 #3366cc}} \ -lineartransition {0 0 0 1}] $w create path "M 0 0 C 20 0 40 -20 70 -20 S 130 30 130 60 \ 110 200 60 200 20 180 0 180 \ -10 200 -60 200 -130 90 -130 60 \ -110 -20 -70 -20 -20 0 0 0 z \ M 0 -10 Q -10 -60 50 -80 Q 50 -20 0 -10 z" \ -fill $grad -stroke "" -tags apple $w move apple 200 120 |
|
$w create path "M 20 350 l 50 -25 \ a 25 25 -30 0 1 50 -25 l 50 -25 \ a 25 50 -30 0 1 50 -25 l 50 -25 \ a 25 75 -30 0 1 50 -25 l 50 -25 \ a 25 100 -30 0 1 50 -25 l 50 -25" \ -stroke red -strokewidth 2 $w create path "M 30 350 h 100 a 25 200 0 0 1 50 0 h 200" \ -stroke blue -strokewidth 2 $w create path "M 100 100 a 25 25 -30 0 1 50 -25 z" \ -fill yellow -strokewidth 2 $w create path "M 180 100 a 25 25 30 0 1 50 25 z" \ -fill yellow -strokewidth 2 |
|
$wclk create path \ "M $pt2(1) L $pt1(1) M $pt2(2) L $pt1(2) \ M $pt3(3) L $pt1(3) \ M $pt2(4) L $pt1(4) M $pt2(5) L $pt1(5) \ M $pt3(6) L $pt1(6) \ M $pt2(7) L $pt1(7) M $pt2(8) L $pt1(8) \ M $pt3(9) L $pt1(9) \ M $pt2(10) L $pt1(10) M $pt2(11) L $pt1(11) \ M $pt3(12) L $pt1(12)" \ -tags clock -strokewidth 4 -strokelinecap round $wclk create path \ "M 0 4 L $r4 4 $r4 10 $r2 0 $r4 -10 $r4 -4 0 -4 z" \ -stroke "" -fill gray50 -tags pointer $wclk move clock 200 200 $wclk move pointer 200 200 .. set phi [expr $secs*2.0*3.14159/60.0] set m [tkp::transform rotate $phi 200 200] $wclk itemconfig pointer -m $m |
|
$w create path \ "M 10 10 h 80 v 80 h -80 z m 20 20 h 40 v 40 h -40 z" \ -fill green -fillrule nonzero set id [$w create path \ "M 10 10 h 80 v 80 h -80 z m 20 20 h 40 v 40 h -40 z" \ -fill blue -fillrule evenodd] $w move $id 100 0 |
|
set g1 [$w gradient create linear \ -stops {{0 lightblue} {1 blue}}] $w create path "M 10 10 h 200 v 50 h -200 z" \ -fill $g1 set g2 [$w gradient create linear \ -stops {{0 #f60} {1 #ff6}}] $w create path "M 10 70 h 200 v 50 h -200 z" \ -fill $g2 set g5 [$w gradient create linear \ -stops {{0 lightgreen} {1 green}}] $w create path "M 10 130 h 200 v 50 h -200 z" \ -fill $g5 set g3 [$w gradient create linear \ -stops {{0 #f60} {1 #ff6}} -lineartransition {0 0 0 1}] $w create path "M 40 200 q 60 -200 120 0 z" \ -fill $g3 ... set g8 [$w gradient create radial \ -stops {{0 white} {1 black}} \ -radialtransition {0.6 0.4 0.8 0.7 0.3}] $w create circle 340 330 -r 50 \ -fill $g8 -stroke "" |
|
set id [$w create path \ "M 20 20 L 120 20 v 30 h -20 z"] $w bind $id |
|
foreach col {red green blue} { $w create path \ "M 0 0 A $r $r 0 1 0 0 $d A $r $r 0 1 0 0 0 z" \ -stroke "" -fill $col -fillopacity $opacity -tags $col } $w move all 200 [expr 200-$r] ... set m [list {1 0} {0 1} [list $tx $ty]] $w itemconfig red -matrix $m |
|
$w create text 160 80 \ -text "Quadratic spline" -anchor w $w create text 160 100 \ -text "M 20 100 Q 80 20 140 100" -anchor w $w create path "M 20 100 L 80 20 140 100" \ -stroke blue -strokewidth 1 $w create path "M 20 100 Q 80 20 140 100" \ -stroke black -strokewidth 3 $w create path "M 15 100 h 10 m -5 -5 v 10" \ -stroke red $w create path "M 75 20 h 10 m -5 -5 v 10" \ -stroke red $w create path "M 135 100 h 10 m -5 -5 v 10" \ -stroke red $w create text 160 220 \ -text "Cubic spline" -anchor w $w create text 160 240 \ -text "M 20 250 C 60 140 100 380 140 250" -anchor w $w create path "M 20 250 L 60 140 100 380 140 250" \ -stroke blue -strokewidth 1 $w create path "M 20 250 C 60 140 100 380 140 250" \ -stroke black -strokewidth 3 $w create path "M 15 250 h 10 m -5 -5 v 10" -stroke red $w create path "M 55 140 h 10 m -5 -5 v 10" -stroke red $w create path "M 95 380 h 10 m -5 -5 v 10" -stroke red $w create path "M 135 250 h 10 m -5 -5 v 10" -stroke red |
|
$w create ptext 200 360 -text X -fontsize 400 -fill "" \ -stroke gray -strokewidth 2 -textanchor middle $w create ptext 0 0 -text Coccinella \ -fontfamily Helvetica -fontsize 64 \ -fill white -fillopacity 0.7 \ -matrix {{1 0.3} {-0.3 1} {50 80}} \ -stroke gray -strokewidth 2 $w create ptext 200 300 -text "Made by Mats" \ -fontfamily Times -fontsize 40 \ -fill white -textanchor middle |
|
See the demos directory tiger.tcl for the complete code.
NB: This tiger seems to have originated as a postscript demo many years ago, but unfortunately I don't know who the original author is. |
|
set mskewx1 [tkp::transform skewx 0.3] set mskewx2 [tkp::transform skewx 0.5] set mrot [tkp::transform rotate \ [expr 3.1415/4] 100 100] set g1 [$w gradient create linear \ -stops {{0 lightblue} {1 blue}}] $w create path "M 10 10 h 200 v 50 h -200 z" \ -fill $g1 -matrix $mskewx1 set g2 [$w gradient create linear \ -stops {{0 #f60} {1 #ff6}}] $w create path "M 10 70 h 200 v 50 h -200 z" \ -fill $g2 -matrix $mrot set g4 [$w gradient create linear \ -stops {{0 white} {0.5 black} {1 white}}] $w create path "M 10 220 h 200 v 50 h -200 z" \ -fill $g4 -matrix $mskewx2 |
|
$w create circle 60 60 -r 32 \ -stroke "#c8c8c8" -fill "#e6e6e6" $w create circle 200 60 -r 32 \ -stroke "#a19de2" -fill "#d6d6ff" ... $w create ellipse 200 280 -rx 20 -ry 60 \ -stroke "#999999" $w create ellipse 100 260 -rx 60 -ry 20 \ -stroke "#666666" -strokewidth 3 -fill "#bdbdbd" |
|
$w create pimage $x $y -image $name set m [tkp::transform rotate 0.5] lset m {2 0} 220 lset m {2 1} -120 $w create pimage 100 100 -image $name -matrix $m set m [tkp::transform scale 2 0.8] $w create pimage 10 300 -image $name -matrix $m |
|
$w create pline 20 20 180 20 $w create pline 200 20 260 20 -stroke blue ... $w create polyline 150 200 200 120 150 120 200 200 \ -stroke gray50 -strokewidth 4 $w create polyline 220 200 270 120 220 120 270 200 \ -stroke gray50 -strokewidth 4 -fill gray80 ... |
|
$w create prect 20 20 180 80 -rx 6 \ -stroke "#c8c8c8" -fill "#e6e6e6" $w create prect 200 20 260 80 -rx 6 \ -stroke "#a19de2" -fill "#d6d6ff" ... |