how to make a simple animation

Discussion in 'iOS Programming' started by theprizerevealed, Sep 11, 2017.

  1. theprizerevealed macrumors regular

    Joined:
    Feb 26, 2016
    #1
    I want to make an app with a very simple animation. There will be a static picture and every time a new question is asked the picture will slide to the right a few millimeters or at most a centimeter. How can I do that programmatically? thanks
     
  2. PhoneyDeveloper macrumors 68040

    PhoneyDeveloper

    Joined:
    Sep 2, 2008
    #2
    There are various ways to do this. To move a view you want to change its constraints, or more likely you want to change the constant on one or more of the view's constraints. To animate that movement you want to wrap the change to the constraint constant in an animation block.

    Code:
    UIView.animate(withDuration: 0.2) {
         imageViewLeadingConstraint.constant = newValue
    }
     
  3. theprizerevealed thread starter macrumors regular

    Joined:
    Feb 26, 2016
    #3
    Okay, thank you. Actually I need some suggestions for a good drawing software. I need to create some simple geometric shapes that can be colored differently. I tried the free version of autocad Sketchbook - it seems nice but it requires some adjusting to the tools. There's a bit of a learning curve to it. I wonder if anyone knows of any other graphics software that creates geometric shapes quickly and intuitively.
     
  4. dantastic macrumors 6502a

    dantastic

    Joined:
    Jan 21, 2011

Share This Page

3 September 11, 2017