[codes] Some Transitions for your characters

A place for Ren'Py tutorials and reusable Ren'Py code.
Forum rules
Do not post questions here!

This forum is for example code you want to show other people. Ren'Py questions should be asked in the Ren'Py Questions and Announcements forum.
Post Reply
Message
Author
User avatar
zankizuna
Veteran
Posts: 412
Joined: Fri May 04, 2012 2:20 am
Projects: Softwar
Deviantart: raseru09
itch: ZanKizuna
Location: Manilaaaaaaaa
Contact:

[codes] Some Transitions for your characters

#1 Post by zankizuna » Fri Feb 03, 2017 10:45 am

some transitions I coded for a little spice.
use with the "at" code.
usable with show codes inside labels,
and images, buttons, imagebuttons at screens.
Zeta copy.png

Code: Select all

label dancing:
  show Character at center with dissolve
  show Character at dance
  "I am dancing."
  show screen Character2
  "She is also dancing."
  return
screen Character2:
   image "Character2.png" anchor(0.5,0.5) pos(0.7,0.5) at dance
We can update this thread for more transitions or modifications to the previously made ones.

Code: Select all


transform dance: #Dancing, flipping left and right
    xanchor 0.5 alpha 1.0
    xzoom 0.95 yzoom 1.02 transform_anchor True
    linear 0.2 xzoom 1.0 yzoom 1.0 transform_anchor True
    linear 0.2 xzoom 0.95 yzoom 1.02 transform_anchor True
    xzoom -0.95 yzoom 1.02 transform_anchor True
    linear 0.2 xzoom -1.0 yzoom 1.0 transform_anchor True
    linear 0.2 xzoom -0.95 yzoom 1.02 transform_anchor True
    repeat

transform dright: # Smooth dissolve with motion at the extreme right, from near side 
    alpha 0.0 xpos 0.9 yalign 1.0 xanchor 0.5 xzoom 1.0
    linear 0.4 alpha 1.0 xanchor 0.5 xpos 0.85 
transform dright2: # Smooth dissolve with motion at the mid right, from near side
    alpha 0.0 xpos 0.7 yalign 1.0 xanchor 0.5 xzoom 1.0
    linear 0.4 alpha 1.0 xanchor 0.5 xpos 0.65 


transform dleft: # Smooth dissolve with motion at the extreme left, from near side
    alpha 0.0 xpos 0.1 yalign 1.0 xanchor 0.5 xzoom -1.0
    linear 0.4 alpha 1.0 xanchor 0.5 xpos 0.15 
transform dleft2: # Smooth dissolve with motion at the mid left, from near side
    alpha 0.0 xpos 0.3 yalign 1.0 xanchor 0.5 xzoom -1.0
    linear 0.4 alpha 1.0 xanchor 0.5 xpos 0.35

transform rsurprise: #surprised and moved backward while facing Right
    alpha 1.0 rotate 0 yanchor 1.0 transform_anchor True
    linear 0.08 rotate 0 transform_anchor True yzoom 1.05 yanchor 0.95 xoffset 70
    linear 0.08 rotate 5 transform_anchor True yzoom 1.1 yanchor 0.95 xoffset 75
    linear 0.2 rotate -10 transform_anchor True yzoom 1.0 yanchor .90 xoffset 100
    linear 0.5 rotate 0 transform_anchor True yanchor 1.0 xoffset .10

transform lsurprise: #surprised and moved backward while facing Left
    alpha 1.0 rotate 0 yanchor 1.0 transform_anchor True
    linear 0.08 rotate -20 transform_anchor True yzoom 1.1 yanchor 0.95 xoffset -50
    linear 0.2 rotate 10 transform_anchor True yzoom 1.0 yanchor .90 xoffset -100
    linear 0.5 rotate 0 transform_anchor True yanchor 1.0 xoffset .10


transform raffirm: #upper body nodding at right
    alpha 1.0 rotate 0 yanchor 1.0 transform_anchor True
    linear 0.25 rotate -10 yanchor 0.9 transform_anchor True yanchor .90 xoffset 50
    linear 0.3 rotate 0 yanchor 1.0 transform_anchor True yanchor 1.0 xoffset 0
    linear 0.25 rotate -10 yanchor 0.9 transform_anchor True yanchor .90 xoffset 50
    linear 0.3 rotate 0 yanchor 1.0 transform_anchor True yanchor 1.0 xoffset 0
transform laffirm: #upper body nodding at left
    alpha 1.0 rotate 0 yanchor 1.0 transform_anchor True
    linear 0.25 rotate 15 yanchor 0.9 transform_anchor True yanchor .95 xoffset -20
    linear 0.3 rotate 0 yanchor 1.0 transform_anchor True yanchor 1.0 xoffset 0
    linear 0.25 rotate 15 yanchor 0.9 transform_anchor True yanchor .95 xoffset -20
    linear 0.3 rotate 0 yanchor 1.0 transform_anchor True yanchor 1.0 xoffset 0
     
        
transform rdown: #brief lowering of body while at right
    alpha 1.0 rotate 0 yanchor 1.0 transform_anchor True         
    linear 0.2 rotate -5 yanchor .95 yzoom 0.9 transform_anchor True
    linear 0.4 rotate 0 yanchor .96 yzoom 0.90  transform_anchor True
    linear 0.5 rotate 0 yanchor 1.0 yzoom 1.0  transform_anchor True
transform ldown: #brief lowering of body while at left
    alpha 1.0 rotate 0 yanchor 1.0 transform_anchor True         
    linear 0.2 rotate 5 yanchor .95 yzoom 0.9 transform_anchor True
    linear 0.4 rotate 0 yanchor .96 yzoom 0.90  transform_anchor True
    linear 0.5 rotate 0 yanchor 1.0 yzoom 1.0  transform_anchor True
            
Last edited by zankizuna on Wed Feb 08, 2017 3:09 am, edited 1 time in total.

User avatar
gas
Miko-Class Veteran
Posts: 718
Joined: Mon Jan 26, 2009 7:21 pm
Contact:

Re: [codes] Some Transitions for your characters

#2 Post by gas » Mon Feb 06, 2017 2:28 pm

Code: Select all

transform boing: #here I am
    yanchor 0.0
    ypos 1.0
    xzoom 1.5
    yzoom 0.5
    linear 0.2 yanchor 1.0 yzoom 0.5 xzoom 1.5
    linear 0.2 yzoom 1.5 xzoom 0.5 yzoom 1.5
    linear 0.2 yzoom 1.0 xzoom 1.0

transform kickedaway: #whaaaaaa
    rotate 0
    zoom 1.0
    yalign 1.0
    parallel:
        rotate 0
        linear 0.2 rotate 360
        repeat
    parallel:
        linear 0.5 zoom 0.0
    parallel:
        linear 0.5 yalign 0.2
transform excitement: #oh my gawd, it's coming!!
    parallel:
        xzoom 1.0
        pause 0.6
        xzoom -1.0
        pause 0.6
        repeat
    parallel:
        linear 0.6 xpos 0.5
        linear 0.6 xpos 0.0
        repeat
    parallel:
        ypos 1.0
        linear 0.3 ypos 1.1
        linear 0.3 ypos 1.0
        repeat
If you want to debate on a reply I gave to your posts, please QUOTE ME or i'll be not notified about.

10 ? "RENPY"
20 GOTO 10

RUN

User avatar
zankizuna
Veteran
Posts: 412
Joined: Fri May 04, 2012 2:20 am
Projects: Softwar
Deviantart: raseru09
itch: ZanKizuna
Location: Manilaaaaaaaa
Contact:

Re: [codes] Some Transitions for your characters

#3 Post by zankizuna » Wed Feb 08, 2017 7:52 am

wow, that's soo coooool! hey... what does parallel do?

User avatar
Donmai
Eileen-Class Veteran
Posts: 1877
Joined: Sun Jun 10, 2012 1:45 am
Completed: Toire No Hanako, Li'l Red [NaNoRenO 2013], The One in LOVE [NaNoRenO 2014], Running Blade [NaNoRenO 2016], The Other Question
Projects: Slumberland
Location: Brazil
Contact:

Re: [codes] Some Transitions for your characters

#4 Post by Donmai » Wed Feb 08, 2017 9:12 am

zankizuna wrote:what does parallel do?
Well... it executes blocks of code in parallel.
https://www.renpy.org/doc/html/atl.html ... -statement
Image
No, sorry! You must be mistaking me for someone else.
TOIRE NO HANAKO (A Story About Fear)

User avatar
indoneko
Miko-Class Veteran
Posts: 528
Joined: Sat Sep 03, 2016 4:00 am
Contact:

Re: [codes] Some Transitions for your characters

#5 Post by indoneko » Wed Feb 08, 2017 2:26 pm

Nice tricks. Thanks for sharing. Keep them coming~ :3
My avatar is courtesy of Mellanthe

User avatar
zankizuna
Veteran
Posts: 412
Joined: Fri May 04, 2012 2:20 am
Projects: Softwar
Deviantart: raseru09
itch: ZanKizuna
Location: Manilaaaaaaaa
Contact:

Re: [codes] Some Transitions for your characters

#6 Post by zankizuna » Thu Feb 09, 2017 6:49 am

Can someone do the really fast side stepping animation that produces duplicates?
just like what Saitama and Koro-sensei did.
probably use alpha and xoffset codes XD

User avatar
Divona
Miko-Class Veteran
Posts: 678
Joined: Sun Jun 05, 2016 8:29 pm
Completed: The Falconers: Moonlight
Organization: Bionic Penguin
itch: bionicpenguin
Contact:

Re: [codes] Some Transitions for your characters

#7 Post by Divona » Thu Feb 09, 2017 10:43 am

zankizuna wrote:Can someone do the really fast side stepping animation that produces duplicates?
just like what Saitama and Koro-sensei did.
probably use alpha and xoffset codes XD
Something like this?

Code: Select all

transform sidesteps_effect(image_path, start_pos, end_pos, duration):
    subpixel True
    contains:
        Image(image_path)
        xalign start_pos alpha 0.2
        easein duration + 0.4 xalign end_pos
    contains:
        Image(image_path)
        xalign start_pos alpha 0.4
        easein duration + 0.3 xalign end_pos
    contains:
        Image(image_path)
        xalign start_pos alpha 0.6
        easein duration + 0.2 xalign end_pos
    contains:
        Image(image_path)
        xalign start_pos alpha 0.8
        easein duration + 0.1 xalign end_pos
    contains:
        Image(image_path)
        xalign start_pos alpha 1
        easein duration xalign end_pos

label start:

    show eileen at sidesteps_effect("eileen.png", 0.0, 1.0, 0.5)

    "Slide to far right!"

    show eileen at sidesteps_effect("eileen.png", 1.0, 0.0, 0.5)

    "Silide to far left!"
Completed:
Image

User avatar
morrie
Regular
Posts: 33
Joined: Mon Aug 01, 2016 11:18 am
Tumblr: morrie-games
Contact:

Re: [codes] Some Transitions for your characters

#8 Post by morrie » Thu Feb 09, 2017 6:16 pm

These are so neat! Now I want to experiment with movements too.....
*perpetual beginner who can't wrap my head around coding....*

User avatar
zankizuna
Veteran
Posts: 412
Joined: Fri May 04, 2012 2:20 am
Projects: Softwar
Deviantart: raseru09
itch: ZanKizuna
Location: Manilaaaaaaaa
Contact:

Re: [codes] Some Transitions for your characters

#9 Post by zankizuna » Fri Feb 10, 2017 2:32 am

@Divona your code is so cool!

I kinda wanted the animation to be repeating sidesteps and i probably forgot to say that
soooooo I used your code and got to do it!!
REPEATED SIDESTEPS!!!!
screenshot0007.png

Code: Select all

transform sidesteps_effect(image_path, start_pos, end_pos, duration):
    subpixel True
    
    contains:
        Image(image_path)
        xalign start_pos alpha 0.2 yalign 1.0
        easein duration + 0.4 xalign end_pos
        block:
         Image(image_path)
         xalign end_pos alpha 0.2 
         easein duration xalign start_pos
         Image(image_path)
         xalign start_pos alpha 0.2 yalign 1.0
         easein duration  xalign end_pos
         repeat
    contains:
        Image(image_path)
        xalign start_pos alpha 0.4 yalign 1.0
        easein duration + 0.3 xalign end_pos
        block:
         Image(image_path)
         xalign end_pos alpha 0.4 yalign 1.0
         easein duration xalign start_pos
         Image(image_path)
         xalign start_pos alpha 0.4 yalign 1.0
         easein duration  xalign end_pos
         repeat     
    contains:
        Image(image_path)
        xalign start_pos alpha 0.6  yalign 1.0
        easein duration + 0.2 xalign end_pos
        block:
         Image(image_path)
         xalign end_pos alpha 0.6 yalign 1.0
         easein duration xalign start_pos
         Image(image_path)
         xalign start_pos alpha 0.6 yalign 1.0
         easein duration  xalign end_pos
         repeat
  
    contains:
        Image(image_path)
        xalign start_pos alpha 0.8 yalign 1.0
        easein duration + 0.1 xalign end_pos
        block:
         Image(image_path)
         xalign end_pos alpha 0.8 yalign 1.0
         easein duration  xalign start_pos
         Image(image_path)
         xalign start_pos alpha 0.8 yalign 1.0
         easein duration  xalign end_pos
         
         repeat

    contains:
        Image(image_path)
        xalign start_pos alpha 1.0 yalign 1.0
        easein duration xalign end_pos 
        Image(image_path)
        xalign end_pos alpha 1.0 yalign 1.0
        easein duration xalign start_pos

        repeat

Code: Select all

show Zeta at sidesteps_effect("Zeta.png", 0.5, 0.1, 0.4)

Post Reply

Who is online

Users browsing this forum: No registered users