Animating a UIImage or UIImageView?

前端 未结 6 664
刺人心
刺人心 2021-02-09 06:18

I\'m trying to animate an image\'s height (from height of 0 pixels to 480 pixels) to create the effect of the image being rendered top-down.

With an UIImageView i notice

6条回答
  •  孤街浪徒
    2021-02-09 06:40

    Just a suggestion, assume you have two images: A and X (the X-ray image):

    +-------+               +-------+
    |       |               |       |
    |       |               |       |
    |   A   |               |   X   |
    |       |               |       |
    |       |               |       |
    +-------+               +-------+
    

    Dynamically you can create a one-pixel high image (temp), copy the content from X partially, put it on top of A:

    +-------+   +-------+   +-------+
    |       |   | temp1 | < |       |
    |       |   +-------+   |       |
    |   A   |               |   X   |
    |       |               |       |
    |       |               |       |
    +-------+               +-------+
    

    In a loop, dynamically create/resize the temp image, and copy more content from X:

    +-------+   +-------+   +-------+
    |       |   | temp2 | < |       |
    |       |   |       |   |       |
    |   A   |   +-------+   |   X   |
    |       |               |       |
    |       |               |       |
    +-------+               +-------+
    
    +-------+   +-------+   +-------+
    |       |   | temp3 | < |       |
    |       |   |       |   |       |
    |   A   |   |       |   |   X   |
    |       |   +-------+   |       |
    |       |               |       |
    +-------+               +-------+
    +-------+   +-------+   +-------+
    |       |   | temp4 | < |       |
    |       |   |       |   |       |
    |   A   |   |       |   |   X   |
    |       |   |       |   |       |
    |       |   +-------+   |       |
    +-------+               +-------+
    
    +-------+   +-------+   +-------+
    |       |   | tempX | < |       |
    |       |   |       |   |       |
    |   A   |   |       |   |   X   |
    |       |   |       |   |       |
    |       |   |       |   |       |
    +-------+   +-------+   +-------+
    

提交回复
热议问题