The following script create the panorama-ss style to use in your program, you can use it this way:
view layout [
styles panorama-ss
panorama http://www.maxvessi.net/rebsite/images/newupperporch360.jpg 500x500
]
Here a demo video:
Here is the source:
REBOL [
Title: "'Panoramatic image' style"
Date: 22-May-2002/22:28:36+2:00
Version: 1.0.0
File: %panorama-ss.r
Author: "Oldes"
Purpose: "Style for scrolling (panoramatic) images"
Email: oliva.david@seznam.cz
]
panorama-ss: stylize [
panorama: box 320x120 with [
rate: 30 m-pos: 0 mov: 1
p-img: w: w2: ofs1: ofs2: old-rate: none
effect: [draw [image ofs1 p-img image ofs2 p-img]]
init: [
p-img: first facets
switch type?/word p-img [
file! [p-img: load p-img]
url! [p-img: load read-thru p-img]
]
w: p-img/size/x w2: 2 * w
ofs1: 0x0 ofs2: to-pair reduce [w 0]
]
feel/engage: func [face action event][
switch action [
down [face/m-pos: event/offset/x face/mov: 0
if face/rate [face/old-rate: face/rate]
face/rate: none
]
over [
face/mov: event/offset/x - face/m-pos face/rate: face/old-rate
show face
]
time [face/my-draw face]
]
]
my-draw: func[face][
ofs1/x: ofs1/x + mov
ofs2/x: ofs2/x + mov
either mov > 0 [
if ofs1/x >= w [ofs1/x: ofs1/x - w2]
if ofs2/x >= w [ofs2/x: ofs2/x - w2]
][
if (0 - ofs1/x) >= w [ ofs1/x: ofs1/x + w2]
if (0 - ofs2/x) >= w [ofs2/x: ofs2/x + w2]
]
show face
]
]
]
Build scrolling in panorama control
ReplyDelete