LiVES rendered effect plugin script
------------------------------------

<define>
|1.7
</define>

<name>
dream
</name>

<version>
2
</version>

<author>
Salsaman|
</author>

# Menu entry|Action description|min_frames|num_channels|
<description>
Dream|Dreamifying|1|1|
</description>

# requirements (list)
<requires>
composite
</requires>


<params>
diffmax|_Diffmax|num0|10|0|100|
rand|_Randomness|num0|5|0|100
fade|_Fade level|num0|70|0|100
</params>

<param_window>
</param_window>

# properties/capabilities (bitmap field)
# 0x0001 == slow (hint to GUI)
<properties>
0x0000
</properties>

# 0xF0 == LiVES-perl
<language_code>
0xF0
</language_code>

# pre loop code (list)
<pre>
$diff=0;
$pc_start=$p2; # fade amount
</pre>

# loop code (list)
<loop>
# merge frame from diff frames ago at 90%
$from=&mkname(int($frame-$diff));
if (-f "$from$out_ext") {
    $fromimg="$from$out_ext";
}
else {
    if (-f "$from$img_ext") {
        $fromimg="$from$img_ext";
    }
    else {
        # must make sure we have an input image
        $fromimg=$in;
    }
}

`$composite_command -compose plus -dissolve $pc_start $fromimg -size $width!x$height! $in $out >/dev/null 2>&1`;

# make the diff grow at the beginning and shrink at the end
$diff+=(rand ($p1*2+1))-$p1+1;

if ($diff<1) {
    $diff+=$p1/2+1;
}
if ($frame-$diff<$start||$diff+$frame>$end||$diff>$p0) {
    $diff-=$p1/2+1;
}
</loop>

# post loop code (list)
<post>
</post>

<onchange>
</onchange>
