locked
Animating Width and Height RRS feed

  • Question

  • My guess is that to animate and images width and height (as in shrink or grow the image), I need to display it as an object and then manipulate contentWidth/contentHeight.  Is that correct?  Are there other ways to do this?

    Thanks.
    Wednesday, October 25, 2006 11:11 PM

Answers

  • No; set contentWidth="scale-to-fit" and contentHeight="scale-to-fit".

    Then whatever you set width and height to, the backgroundImage will stretch / shrink to fit it.

    Thursday, October 26, 2006 7:18 AM

All replies

  • You can also just specify scale-to-fit for those two properties and then animate width and height as per normal.
    Wednesday, October 25, 2006 11:32 PM
  • By scale-to-fit  you mean declare both width and height as auto?
    Thursday, October 26, 2006 5:40 AM
  • No; set contentWidth="scale-to-fit" and contentHeight="scale-to-fit".

    Then whatever you set width and height to, the backgroundImage will stretch / shrink to fit it.

    Thursday, October 26, 2006 7:18 AM
  • Hmmm.  So which method is more efficient/recommended?

    1)
    document["foo"].style.animateProperty(“contentWidth”,”1920px;1980px”,4)


    2)
    contentWidth="scale-to-fit"
    document["foo"].style.animateProperty(“width”,”1920px;1980px”,4)
    Friday, October 27, 2006 11:04 PM
  • I did a bunch of testing.  I get it now.  The first method is stretching the image but within the boundaries of the image's original width and height.
    Saturday, October 28, 2006 6:19 AM
  • the ",4) " at the end...is that 4 seconds?
    Saturday, October 28, 2006 11:16 AM
  • Yes.  The signature for this method is described on page Z304.  Although not described very well at all :(
    Saturday, October 28, 2006 5:55 PM