File: indepth_transitions.rpy

package info (click to toggle)
renpy 8.0.3%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 81,768 kB
  • sloc: python: 44,587; ansic: 13,708; javascript: 308; makefile: 41; sh: 13
file content (547 lines) | stat: -rw-r--r-- 12,874 bytes parent folder | download | duplicates (4)
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
# This file demonstrates the built-in transitions which are defined in
# common/definitions.rpy, and also the new transitions given above.

example slow_dissolve:
    define slow_dissolve = Dissolve(1.0)

example flashbulb:
    define flashbulb = Fade(0.2, 0.0, 0.8, color='#fff')

# Imagedissolve Transitions.

example circleirisout:
    define circleirisout = ImageDissolve("imagedissolve circleiris.png", 1.0, 8)

example circleirisin:
    define circleirisin = ImageDissolve("imagedissolve circleiris.png", 1.0, 8 , reverse=True)

example circlewipe:
    define circlewipe = ImageDissolve("imagedissolve circlewipe.png", 1.0, 8)

example dream:
    define dream = ImageDissolve("imagedissolve dream.png", 2.0, 64)

example teleport:
    define teleport = ImageDissolve("imagedissolve teleport.png", 1.0, 0)

image bg circleiris = "imagedissolve circleiris"
image bg teleport = "imagedissolve teleport"

example alphadissolve:

    image alpha_control:
        "spotlight.png"

        anchor (.5, .5)

        parallel:
            zoom 0
            linear .5 zoom .75
            pause 2
            linear 1.0 zoom 4.0

        parallel:
            xpos 0.0 ypos .6
            linear 1.5 xpos 1.0
            linear 1.0 xpos .5 ypos .2

        pause .5
        repeat

    define alpha_example = AlphaDissolve("alpha_control", delay=3.5)


label demo_transitions:

    e "Ren'Py ships with a large number of built-in transitions, and also includes classes that let you define your own."

    menu demo_transitions_menu:

        e "What kind of transitions would you like demonstrated?"

        "Simple Transitions":

            call demo_simple_transitions from _call_demo_simple_transitions_1

        "ImageDissolve Transitions":

            call demo_imagedissolve_transitions from _call_demo_imagedissolve_transitions_1

        "MoveTransition Transitions":

            call demo_movetransition from _call_demo_movetransition_1

        "CropMove Transitions":

            call demo_cropmove_transitions from _call_demo_cropmove_transitions_1

        "PushMove Transitions":

            call demo_pushmove_transitions from _call_demo_pushmove_transitions_1

        "AlphaDissolve Transitions":

            call demo_alphadissolve from _call_demo_alphadissolve

        "How about something else?":

            return

    jump demo_transitions_menu


label demo_simple_transitions:

    e "Okay, I can tell you about simple transitions. We call them simple because they don't take much in the way of configuration."

    e "But don't let that get you down, since they're the transitions you'll probably use the most in a game."

    example:
        show bg whitehouse
        with dissolve

    e "The 'dissolve' transition is probably the most useful, blending one scene into another."

    example slow_dissolve small:
        show bg washington
        with slow_dissolve

    e "The 'Dissolve' function lets you create your own dissolves, taking a different amount of time."


    example:
        show bg whitehouse
        with fade

    e "The 'fade' transition fades to black, and then fades back in to the new scene."

    e "If you're going to stay at a black screen, you'll probably want to use 'dissolve' rather than 'fade'."

    example flashbulb small:
        with flashbulb

    e "You can use 'Fade' to define your own fades. By changing the timing and the color faded to, you can use this for special effects, like flashbulbs."

    example:
        show bg washington
        with pixellate

    e "The 'pixellate' transition pixellates out the old scene, switches to the new scene, and then unpixellates that."

    e "It's probably not appropriate for most games, but we
       think it's kind of neat."

    e "You can use 'Pixellate' to change the details of the pixellation."

    e "Motions can also be used as transitions."

    "..."

    "......"

    example:
        play audio "punch.opus"
        with vpunch

    e "Hey! Pay attention."

    e "I was about to demonstrate 'vpunch'... well, I guess I just did."

    example:
        play audio "punch.opus"
        with hpunch

    e "We can also shake the screen horizontally, with 'hpunch'. These were defined using the 'Move' function."

    e "There's also the 'move' transition, which is confusingly enough defined using the 'MoveTransition' function."

    example:
        show eileen happy at right
        with move
        show eileen happy at center
        with move

    e "The 'move' transition finds images that have changed placement, and slides them to their new place. It's an easy way to get motion in your game."

    hide example

    e "That's it for the simple transitions."

    return


label demo_imagedissolve_transitions:

    e "Perhaps the most flexible kind of transition is the ImageDissolve, which lets you use an image to control a dissolve."

    e "This lets us specify very complex transitions, fairly simply. Let's try some, and then I'll show you how they work."

    e "There are two ImageDissolve transitions built into Ren'Py."


    example:
        scene black
        with blinds

        scene bg washington
        show eileen happy
        with blinds


    e "The 'blinds' transition opens and closes what looks like vertical blinds."

    example:
        scene black
        with squares

        scene bg washington
        show eileen happy
        with squares

    e "The 'squares' transition uses these squares to show things."

    e "I'm not sure why anyone would want to use it, but it was used in some translated games, so we added it."

    hide example

    e "The most interesting transitions aren't in the standard library."

    e "These ones require an image the size of the screen, and so we couldn't include them as the size of the screen can change from game to game."

    example circleirisin small:
        scene black
        with circleirisin

    e "We can hide things with a 'circleirisin'..."

    example circleirisout small:
        scene bg washington
        with circleirisout

    e "... and show them again with a 'circleirisout'."

    example circlewipe small:
        show bg whitehouse
        with circlewipe

    e "The 'circlewipe' transitions changes screens using a circular wipe effect."

    example dream small:
        scene bg washington
        with dream

    e "The 'dream' transition does this weird wavy dissolve, and does it relatively slowly."

    example teleport small:
        show eileen happy
        with teleport

    e "The 'teleport' transition reveals the new scene one line at a time."

    show example circleirisout small

    scene bg circleiris
    with dissolve

    e "This is the background picture used with the circleirisout transition."

    e "When we use an ImageDissolve, the white will dissolve in first, followed by progressively darker colors. Let's try it."

    show bg washington
    with circleirisout

    show example circleirisout small

    e "If we give ImageDissolve the 'reverse' parameter, black areas will dissolve in first."

    show bg circleiris
    with circleirisin

    e "This lets circleirisin and circleirisout use the same image."

    show example teleport small

    show bg teleport
    with dissolve

    e "The teleport transition uses a different image, one that dissolves things in one line at a time."

    show bg washington
    with teleport

    e "A dissolve only seems to affect parts of the scene that have changed..."

    show eileen happy
    with teleport

    e "... which is how we apply the teleport effect to a single character."

    hide example

    return

label demo_cropmove_transitions:

    e "The CropMove transition class provides a wide range of transition effects. It's not used very much in practice, though."

    show eileen happy at offscreenleft
    with move

    e "I'll stand offscreen, so you can see some of its modes. I'll read out the mode name after each transition."

    example:
        scene bg whitehouse
        with wiperight

    e "We first have wiperight..."

    example:
        scene bg washington
        with wipeleft

    e "...followed by wipeleft... "

    example:
        scene bg whitehouse
        with wipeup

    e "...wipeup..."

    example:
        scene bg washington
        with wipedown

    e "...and wipedown."

    e "Next, the slides."

    example:
        scene bg whitehouse
        with slideright

    e "Slideright..."

    example:
        scene bg washington
        with slideleft

    e "...slideleft..."

    example:
        scene bg whitehouse
        with slideup

    e "...slideup..."

    example:
        scene bg washington
        with slidedown

    e "and slidedown."

    e "While the slide transitions slide in the new scene, the
       slideaways slide out the old scene."

    example:
        scene bg whitehouse
        with slideawayright

    e "Slideawayright..."

    example:
        scene bg washington
        with slideawayleft

    e "...slideawayleft..."

    example:
        scene bg whitehouse
        with slideawayup

    e "...slideawayup..."

    example:
        scene bg washington
        with slideawaydown

    e "and slideawaydown."

    e "We also have a couple of transitions that use a
       rectangular iris."

    example:
        scene bg whitehouse
        with irisout

    e "There's irisout..."

    example:
        scene bg washington
        show eileen happy
        with irisin

    e "... and irisin."

    hide example

    e "It's enough to make you feel a bit dizzy."

    return

label demo_pushmove_transitions:

    e "The PushMove transitions use the new scene to push the old one out. Let's take a look."

    example:

        show bg whitehouse
        hide eileen
        with pushright

    "There's pushright..."

    example:

        show bg washington
        with pushleft

    "...pushleft..."


    example:

        show bg whitehouse
        with pushdown

    "...pushdown..."

    example:

        show bg washington
        show eileen happy
        with pushup

    "... and pushup. And that's it the for the PushMove-based transitions."

    hide example
    pause .5

    return

label demo_movetransition:


    e "The most common MoveTransition is move, which slides around images that have changed position on the screen."

    example move:

        show eileen happy at left
        with move


    e "Just like that."

    show example moveinout

    e "There are also the moveout and movein transitions."

    e "The moveout transitions (moveoutleft, moveoutright, moveouttop, and moveoutbottom) slide hidden images off the appropriate side of the screen."

    e "The movein transitions (moveinleft, moveinright, moveintop, and moveinbottom) slide in new images."

    e "Let's see them all in action."

    hide example
    pause .5

    example moveinout hide:
        hide eileen happy
        with moveoutleft

        show eileen happy
        with moveinbottom

        hide eileen happy
        with moveoutbottom

        show eileen happy
        with moveinright

        hide eileen happy
        with moveoutright

        show eileen happy:
            yzoom -1
            xalign 0.5
            yalign 0.0


        with moveintop

        hide eileen happy
        with moveouttop

        show eileen happy
        with moveinleft

    e "That's it for the moveins and moveouts."

    e "Finally, there are the zoomin and zoomout transitions, which show and hide things using a zoom."

    example:

        hide eileen happy
        with zoomout

        show eileen happy
        with zoomin

    e "And that's all there is."

    hide example
    pause .5

    return

label demo_alphadissolve:

    e "The AlphaDissolve transition lets you use one displayable to combine two others. Click, and I'll show you an example."

    scene black
    with dissolve

    example alphadissolve large:
        scene bg washington
        show eileen happy at center
        with alpha_example

    e "The AlphaDissolve displayable takes a control displayable, usually an ATL transform."

    scene
    show alpha_control

    e "To be useful, the control displayable should be partially transparent."

    e "During an AlphaDissolve, the old screen is used to fill the transparent areas of the image, while the new screen fills the opaque areas."

    scene black

    e "For our spotlight example, the old screen is this all-black image."

    scene bg washington
    show eileen happy at center

    e "The new screen is me just standing here."

    scene black
    with dissolve
    scene bg washington
    show eileen happy at center
    with alpha_example

    e "By combining them using AlphaDissolve, we can build a complicated effect out of simpler parts."

    hide example
    pause .5

    return