How to make cropped zoom? (solved)

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
User avatar
Vendor_Honyaku
Regular
Posts: 30
Joined: Thu Apr 09, 2009 8:31 am
Projects: Honyaku-Subs translations
Location: Russia, Novosibirsk
Contact:

How to make cropped zoom? (solved)

#1 Post by Vendor_Honyaku » Wed May 26, 2010 12:44 pm

I have 1280x880 image and 640x440 field for scene images.
Image must start downsized, and afterwards zoomed to full size, but image must be left in 640x440 box, and cannot move outside.

I used this code, and many other combinations, but image flowed outside picture box:

Code: Select all

    show op bg27:
        subpixel True
        xpos 80
        ypos 15
        corner1(80,15)
        corner2(720,455)
        size(640,440)
        crop(0,0,640,440)
        zoom(1.0)
        linear 4.0 zoom(5.0)
        linear 4.0 crop(0,0,640,440)
        
    $renpy.pause(4.0)
Last edited by Vendor_Honyaku on Wed May 26, 2010 10:14 pm, edited 1 time in total.
The bear looked on the car, and there was a wild gleam in his eyes. He knew what to do.

User avatar
PyTom
Ren'Py Creator
Posts: 15403
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: How to make cropped zoom?

#2 Post by PyTom » Wed May 26, 2010 4:45 pm

The key is to think about it the other way. Zoom should always be set to 1.0 (or not set at all), and size should be set to (640, 440). You can then adjust the crop so that it only show the portion of the image you want to show - setting the size will scale the crop up.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
"Silly and fun things are important." - Elon Musk
Software > Drama • https://www.patreon.com/renpytom

User avatar
Vendor_Honyaku
Regular
Posts: 30
Joined: Thu Apr 09, 2009 8:31 am
Projects: Honyaku-Subs translations
Location: Russia, Novosibirsk
Contact:

Re: How to make cropped zoom?

#3 Post by Vendor_Honyaku » Wed May 26, 2010 10:14 pm

Thanks, now it works as expected.
The bear looked on the car, and there was a wild gleam in his eyes. He knew what to do.

Post Reply

Who is online

Users browsing this forum: No registered users