aboutsummaryrefslogtreecommitdiff
path: root/demos/tkZincLogo.tcl
diff options
context:
space:
mode:
authorlecoanet2003-03-30 09:09:44 +0000
committerlecoanet2003-03-30 09:09:44 +0000
commit839c6cd06b3fccc2e6dc227746e58b3544a70b22 (patch)
tree9a1ca213fcdf9dc4e4dfa93d6b52698f1b0cf28b /demos/tkZincLogo.tcl
parentd6a7dbb3a6090cc7d8007237f0b4f75c1d3f0112 (diff)
downloadtkzinc-839c6cd06b3fccc2e6dc227746e58b3544a70b22.zip
tkzinc-839c6cd06b3fccc2e6dc227746e58b3544a70b22.tar.gz
tkzinc-839c6cd06b3fccc2e6dc227746e58b3544a70b22.tar.bz2
tkzinc-839c6cd06b3fccc2e6dc227746e58b3544a70b22.tar.xz
Mise � jour interm�diaire
Diffstat (limited to 'demos/tkZincLogo.tcl')
-rw-r--r--demos/tkZincLogo.tcl24
1 files changed, 13 insertions, 11 deletions
diff --git a/demos/tkZincLogo.tcl b/demos/tkZincLogo.tcl
index 6db4031..2e72f36 100644
--- a/demos/tkZincLogo.tcl
+++ b/demos/tkZincLogo.tcl
@@ -34,7 +34,7 @@ pack $w.buttons.dismiss $w.buttons.code -side left -expand 1
#######################
####################
-text $w.text -relief sunken -borderwidth 2 -height 5
+text $w.text -relief sunken -borderwidth 2 -height 7
pack $w.text -expand yes -fill both
$w.text insert end {This tkZinc logo should used openGL for a correct rendering!
@@ -53,9 +53,9 @@ zinc $w.zinc -width 350 -height 250 -render 1 -font 10x20 \
-borderwidth 3 -relief sunken
pack $w.zinc
-set group [$w.zinc add group 1]
+set topGroup [$w.zinc add group 1]
-set logo [zincLogo::create $w.zinc $group 800 40 70 0.6 0.6]
+set logo [zincLogo::create $w.zinc $topGroup 800 40 70 0.6 0.6]
#
# Controls for the window transform.
@@ -64,6 +64,8 @@ bind $w.zinc <ButtonPress-1> "press motion %x %y"
bind $w.zinc <ButtonRelease-1> release
bind $w.zinc <ButtonPress-2> "press zoom %x %y"
bind $w.zinc <ButtonRelease-2> release
+bind $w.zinc <ButtonPress-3> "press mouseRotate %x %y"
+bind $w.zinc <ButtonRelease-3> release
#
# Controls for alpha and gradient
@@ -122,10 +124,10 @@ proc zoom {x y} {
}
proc mouseRotate {x y} {
- global w curAngle topGroup
+ global w curAngle logo
set lAngle [expr atan2($y, $x)]
- $w.zinc rotate $topGroup [expr -($lAngle - $curAngle)]
+ $w.zinc rotate $logo [expr $lAngle - $curAngle]
set curAngle $lAngle
}
@@ -136,21 +138,21 @@ proc release {} {
}
proc modifyAlpha {x y} {
- global w
+ global w topGroup
set xRate [expr double($x) / [$w.zinc cget -width]]
set xRate [expr ($xRate < 0) ? 0 : ($xRate > 1) ? 1 : $xRate]
- set alpha [expr $xRate * 100]
+ set alpha [expr int($xRate * 100)]
- $w.zinc itemconfigure $group -alpha $alpha
+ $w.zinc itemconfigure $topGroup -alpha $alpha
}
proc modifyGradient {x y} {
global w
- set yRate [expr double($ly) / [$w.zinc cget -height]]
+ set yRate [expr double($y) / [$w.zinc cget -height]]
set yRate [expr ($yRate < 0) ? 0 : ($yRate > 1) ? 1 : $yRate]
- set gradientPercent [expr int($yRate * 100)]
+ set gradPercent [expr int($yRate * 100)]
- $w.zinc itemconfigure letters -fillcolor => "=axial 270|#ffffff;100 0 28|#66848c;100 $gradientpercent|#7192aa;100 100"
+ $w.zinc itemconfigure letters -fillcolor "=axial 270|#ffffff;100 0 28|#66848c;100 $gradPercent|#7192aa;100 100"
}