Shuttle Space
Following scripts open a roundrect theme, link a video and an image to a fade transform, then play video and change the progress value in between the frames. The progress value is modified to make the image fade in and then fade out like a ghost. You may control the video position to fade in/out an image.
package require media
package require mcllib
_mcl
open media and mcllib packages.
set iname [getPath media image image001.png]
set vname [getPath media video movie.avi]
get image and video name
_theme {
title "Ladybug Studio XP"
orgx 250
orgy 90
width [expr 352]
height [expr 240]
region roundrect
wcorner 10
hcorner 10
mode windowless}
open theme in windowless
while 1 {
set r 0.0
set s 0.01
set downlimit 0.0
set uplimit 0.4
set direction 0
set initial values. r is the progress variable, s is the step variable, downlimit is the down limit of progress, uplimit is the up limit of progress, direction as 0 means increasment (1 means decreament).
_video {name $vname}
_image {name $iname}
_transform {name Fade progress 0.0}
open video, image, and transform
_graph {theme {transform video image}}
set graph links where video and image are transform's inputs, and trnasform's output links to theme.
graph play {from 0 to 1000} {
if {$direction == 0} {
# the ghost image is fade in
set r [expr {$r+$s}]
if {$r >= $uplimit} {
set direction 1
}
"graph play argument internal" will run the objects one after another. The argument may have attributes from and to. The internal is the scripts that may control in each frame. In the above code r is the value for transform progress. Each frame loop will change to a new value with $r added $s (step). When r value is over the up limit, the direction will be changed, so the progress value is decreased.
} else {
# the ghost image is fade out
set r [expr {$r-$s}]
if {$r <= $downlimit} {
set direction 0
}
}
The ghost image is faded out.
!transform {progress $r}
}
set new transform progress value.
graph rewind
rewind video to start position. This rewind is required to play video in loop.
graph_
transform_
image_
video_
}
theme_
mcl_
close graph, transform, image, video, theme, and mcl.
|