Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat | DONATE
Resizing images on the fly? — Gideros Forum

Resizing images on the fly?

______ Member
edited August 2012 in General questions
I must be missing something small here, but how do I set an image's width and height, so that it's scaled to that width and height?

And how efficient would this probably be if I make the width, height increase/decrease by a pixel, on each enterFrame?
People call me "underscore".
Tagged:

Comments

  • ar2rsawseenar2rsawseen Maintainer
    edited August 2012 Accepted Answer
    Something like this should work:
    function Bitmap:setDimensions(width, height)
        self:setScale(width/self:getWidth(), height/self:getHeight())
    end
    And I'd better use GTween for resize animation, much easier and cleaner, and lots of additional options
  • GregBUGGregBUG Guru
    edited August 2012
    Sprite:setScale()
    Sprite:setScaleX()
    Sprite:setScaleY()

    but the use percentage value no pixels

    so
    Sprite:setScale(1.2) will bew Width*1.2and Height*1.2

    they are fast!

    :)
    TNT ENGiNE for Gideors Studio - Particle Engine, Virtual Pad, Animator Studio, Collision Engine - DOWNLOAD NOW !!! IT'S FREE!!! -
    www.tntengine.com
  • ______ Member
    @ar2rsawseen

    Thanks!

    I don't actually know how long to resize, it would be based on touch. I don't suppose GTween will be more efficient than a simple width++, height++?
    People call me "underscore".
  • @___
    Then yes, it would probably be better to use onEnterFrame event. But you probably would not want to increase size on every enter frame, but control resize speed using some kind of a count variable, and only when it reaches a certain amount reset it to 0 and add a bit to the size of the image.
Sign In or Register to comment.