File: ImageDissolve.html

package info (click to toggle)
renpy 6.6.2.dfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 8,740 kB
  • ctags: 3,407
  • sloc: python: 22,153; ansic: 3,724; makefile: 138; lisp: 128; sh: 14
file content (121 lines) | stat: -rw-r--r-- 9,346 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
<html><head><title>renpy/doc/reference/functions/ImageDissolve - Ren'Py</title><link href="../../shared.css" rel="stylesheet"><link href="../../monobook.css" rel="stylesheet"><link href="../../common.css" rel="stylesheet"><link href="../../monobook2.css" rel="stylesheet"><link href="../../docs.css" rel="stylesheet" /></link></link></link></link></head><body><div id="bodyContent">
			<p class="docnav"><a href="../../index.html">documentation index</a> &#9702; <a href="../Reference_Manual.html">reference manual</a> &#9702; <a href="../Function_Index.html">function index</a></p><p><a id="ImageDissolve" name="ImageDissolve"></a></p>
<h1><span class="mw-headline">ImageDissolve</span></h1>
<p><span id="ImageDissolve" /></p>
<table>
<tr>
<td valign="top">Function:</td>
<td valign="top"><b><strong class="selflink">ImageDissolve</strong></b></td>
<td valign="top">(image, time, ramplen=8, ramptype='linear', ramp=None, reverse=False, old_widget=None, new_widget=None):</td>
</tr>
</table>
<div class="renpy-doc">
<p>This dissolves the old scene into the new scene, using an image to control the dissolve process.</p>
<p>A list of values is used to control this mapping. This list of values consists 256 fully transparent values, a ramp (of a specified number of steps) from full transparency to full opacity, and 256 fully opaque values. A 256 entry window is slid over this list, and the values found within are used to map the red channel of the image onto the opacity of the new scene.</p>
<p>Basically, this means that white pixels come in first, black last, and the ramp controls the sharpness of the transition.</p>
<p><i>image</i> - The image that will be used to control this transition. The image should be the same size as the scene being dissolved.</p>
<p><i>time</i> - The amount of time the dissolve will take.</p>
<p><i>ramplen</i> - The number of pixels of ramp to use. This defaults to 8.</p>
<p><i>ramptype</i> - Type of alpha ramp. Possible types are: linear, cube, dcube, mcube. Default is linear. Non-linear types must have ramplen &gt;= 8. "cube": Ease in, sharp out. "dcube": Sharp in, sharp out. "mcube": Ease in, ease out.</p>
<p><i>ramp</i> - If given, this is expected to be a sequence of integers in the range 0 to 255. This sequence explicitly gives the ramp to be used. If given, this overrides <i>ramplen</i> and <i>ramptype</i>.</p>
<p><i>reverse</i> - This reverses the ramp and the direction of the window slide. When True, black pixels dissolve in first, and white pixels come in last.</p>
<p><i>alpha</i> - If True, the resulting displayable will have an alpha channel, at the cost of some speed. If False, it will be treated as opaque, but be faster.</p>
</div>
<p><a id="Example" name="Example"></a></p>
<h2><span class="mw-headline">Example</span></h2>
<pre>
<span class="kwa">init</span><span class="sym">:</span>
    $ slowcirciris <span class="sym">=</span> <span class="kwd">ImageDissolve</span><span class="sym">(</span><span class="str">"circiris.png"</span><span class="sym">,</span> <span class="num">5.0</span><span class="sym">,</span> <span class="num">8</span><span class="sym">)</span>
    $ circirisout <span class="sym">=</span> <span class="kwd">ImageDissolve</span><span class="sym">(</span><span class="str">"circiris.png"</span><span class="sym">,</span> <span class="num">1.0</span><span class="sym">,</span> <span class="num">8</span><span class="sym">)</span>
    $ circirisoutramp <span class="sym">=</span> <span class="kwd">ImageDissolve</span><span class="sym">(</span><span class="str">"circiris.png"</span><span class="sym">,</span> <span class="num">3.0</span><span class="sym">,</span> ramp<span class="sym">=[</span> <span class="num">16</span> <span class="sym">*</span> i <span class="kwa">for</span> i <span class="kwa">in</span> <span class="kwb">range</span><span class="sym">(</span><span class="num">0</span><span class="sym">,</span> <span class="num">15</span><span class="sym">) +</span> <span class="kwb">range</span><span class="sym">(</span><span class="num">15</span><span class="sym">,</span> <span class="num">0</span><span class="sym">, -</span><span class="num">1</span><span class="sym">) +</span> <span class="kwb">range</span><span class="sym">(</span><span class="num">0</span><span class="sym">,</span> <span class="num">15</span><span class="sym">) +</span> <span class="kwb">range</span><span class="sym">(</span><span class="num">15</span><span class="sym">,</span> <span class="num">0</span><span class="sym">, -</span><span class="num">1</span><span class="sym">) +</span> <span class="kwb">range</span><span class="sym">(</span><span class="num">0</span><span class="sym">,</span> <span class="num">15</span><span class="sym">)  +</span> <span class="kwb">range</span><span class="sym">(</span><span class="num">15</span><span class="sym">,</span> <span class="num">0</span><span class="sym">, -</span><span class="num">1</span><span class="sym">) +</span> <span class="kwb">range</span><span class="sym">(</span><span class="num">0</span><span class="sym">,</span> <span class="num">15</span><span class="sym">) ] )</span>
    $ circirisin <span class="sym">=</span> <span class="kwd">ImageDissolve</span><span class="sym">(</span><span class="str">"circiris.png"</span><span class="sym">,</span> <span class="num">1.0</span><span class="sym">,</span> <span class="num">8</span><span class="sym">,</span> reverse<span class="sym">=</span><span class="kwa">True</span><span class="sym">)</span>

    $ demotrans <span class="sym">=</span> <span class="kwd">ImageDissolve</span><span class="sym">(</span><span class="str">"demotrans.png"</span><span class="sym">,</span> <span class="num">3.0</span><span class="sym">,</span> <span class="num">16</span><span class="sym">)</span>

e <span class="str">"ImageDissolve allows us to have dissolve transitions that are</span>
<span class="str">   controlled by images."</span>

e <span class="str">"This lets us specify very complex transitions, fairly</span>
<span class="str">   simply."</span>

e <span class="str">"Let's try some, and then I'll show how they work."</span>

e <span class="str">"There are two ImageDissolve transitions present by</span>
<span class="str">   default in the standard config."</span>

<span class="kwa">scene</span> black <span class="kwa">with</span> blinds
<span class="kwa">scene</span> bg washington
<span class="kwa">show</span> eileen happy
<span class="kwa">with</span> blinds

e <span class="str">"The blinds transition opens and closes what looks like</span>
<span class="str">   vertical blinds."</span>

<span class="kwa">scene</span> black <span class="kwa">with</span> squares
<span class="kwa">scene</span> bg washington
<span class="kwa">show</span> eileen happy
<span class="kwa">with</span> squares

e <span class="str">"The squares transition uses these squares to show</span>
<span class="str">   things."</span>

e <span class="str">"I'm not sure why anyone would want to use it, but it</span>
<span class="str">   was used in some translated games, so we added it."</span>

e <span class="str">"There are also a few transitions that aren't in the</span>
<span class="str">   standard config."</span>

e <span class="str">"These ones require images the size of the screen, and</span>
<span class="str">   so we couldn't include them as the size of the screen</span>
<span class="str">   can change from game to game."</span>

e <span class="str">"You can find them defined in the source of the demo</span>
<span class="str">   script."</span>

<span class="kwa">scene</span> black <span class="kwa">with</span> circirisin

e <span class="str">"We can hide things with a circirisin..."</span>

<span class="kwa">with None</span>
<span class="kwa">scene</span> bg washington
<span class="kwa">with</span> circirisout

e <span class="str">"... and show them again with a circirisout."</span>

e <span class="str">"The ramp parameter lets things dissolve in and out</span>
<span class="str">   along the way."</span>

<span class="kwa">scene</span> bg whitehouse <span class="kwa">with</span> circirisoutramp

e <span class="str">"It's even possible to have weird custom transitions."</span>

<span class="kwa">scene</span> circiris <span class="kwa">with</span> demotrans

e <span class="str">"What we're showing here is the picture that's used in</span>
<span class="str">   the circiris transitions."</span>

e <span class="str">"If you take a look, the center of it is white, while</span>
<span class="str">   the edges are darker."</span>

e <span class="str">"When we use an ImageDissolve, the white will dissolve</span>
<span class="str">   in first, followed by progressively darker colors."</span>

e <span class="str">"Let's try it."</span>

<span class="kwa">with None</span>
<span class="kwa">scene</span> bg washington
<span class="kwa">show</span> eileen happy
<span class="kwa">with</span> slowcirciris


e <span class="str">"It's also possible to reverse the transition, so that</span>
<span class="str">   the black pixels are dissolved in first."</span>

</pre>
<p><br /></p>



<div class="visualClear" />
		<hr /><p class="docnav"><a href="../../index.html">documentation index</a> &#9702; <a href="../Reference_Manual.html">reference manual</a> &#9702; <a href="../Function_Index.html">function index</a></p></div>
	</body></html>