What am I doing wrong?
[1/5] from: pwoodward:cncdsl at: 9-Mar-2002 19:24
OK -
all I want to do is load an image, and be able to pan around on it... I
figured I could do this using the crop effect to make a "viewport" to the
image. Unfortunately I seem to be braindead, and cannot seem to make this
work out. Here's a rough script I've been fiddling with:
rebol []
imagefile: %test.gif ;a 320x200 gif
imagedata: to-image load imagefile
imageoffs: 0x0
imagesize: 160x100
mylayout: layout [
at 0x0
imagedisp: image imagedata rate 15 size 160x100
]
imagedisp/feel: make imagedisp/feel [
engage: func [f a e] [
either imageoffs/x < 100 [
imageoffs/x: imageoffs/x + 1
][
imageoffs/x: 0
print "back to zero"
]
f/effect: [crop imageoffs imagesize]
hide/show [imagedisp]
show f
]
]
view mylayout
What am I doing wrong?
- Porter Woodward
[2/5] from: greggirwin:mindspring at: 9-Mar-2002 20:36
Hi Porter,
I know I've seen a really nice scrolling/zooming demo on a reb site, but I
can't find it now. I found a scrolling demo on Code-Conscious/examples, but
I know there's more. Maybe someone else will jump in who knows.
--Gregg
[3/5] from: petr:krenzelok:trz:cz at: 10-Mar-2002 10:39
Gregg Irwin wrote:
>Hi Porter,
>
>I know I've seen a really nice scrolling/zooming demo on a reb site, but I
>can't find it now. I found a scrolling demo on Code-Conscious/examples, but
>I know there's more. Maybe someone else will jump in who knows.
>
>--Gregg
>
Hi,
you can try my old example:
do http://www.rebol.cz/~can/cyklo.r
-pekr-
[4/5] from: pwoodward::cncdsl::com at: 10-Mar-2002 9:22
Petr,
thanks, that did it. I guess just "probing" around the layout and face
structures a bit more would have revealed it. The /View docs can be so
frustrating at times. But, just using img/offset easily allows me to scroll
around or animate something without using crop at all.
- Porter Woodward
[5/5] from: philb:upnaway at: 10-Mar-2002 23:09
Hi Porter,
Was there a reson why were you using the crop effect?
You could use the offset of the face .... below is an update to your program to demonstrate
(I changed the gif to a png, but you could change it back).
rebol []
imagefile: %bigsky.png ;a 320x200 png
imagedata: to-image load imagefile
imageoffs: 0x0
imagesize: 160x100
mylayout: layout [
at 0x0
imagedisp: image imagedata rate 30 size 160x100
]
imagedisp/feel: make imagedisp/feel [
engage: func [f a e] [
either imageoffs/x < 100
[imageoffs/x: imageoffs/x + 1]
[imageoffs/x: 0 print "back to zero"]
imagedisp/offset: - imageoffs
show imagedisp
]
]
view mylayout
Cheers Phil
=== Original Message ===
OK -
all I want to do is load an image, and be able to pan around on it... I
figured I could do this using the crop effect to make a "viewport" to the
image. Unfortunately I seem to be braindead, and cannot seem to make this
work out. Here's a rough script I've been fiddling with:
rebol []
imagefile: %test.gif ;a 320x200 gif
imagedata: to-image load imagefile
imageoffs: 0x0
imagesize: 160x100
mylayout: layout [
at 0x0
imagedisp: image imagedata rate 15 size 160x100
]
imagedisp/feel: make imagedisp/feel [
engage: func [f a e] [
either imageoffs/x < 100 [
imageoffs/x: imageoffs/x + 1
][
imageoffs/x: 0
print "back to zero"
]
f/effect: [crop imageoffs imagesize]
hide/show [imagedisp]
show f
]
]
view mylayout
What am I doing wrong?
- Porter Woodward