Hi,

actually I've got some problems, getting an animation running. Please have 
a look to following sketch:

<https://lh3.googleusercontent.com/-aijnx80AVmw/WFbY8cn-VuI/AAAAAAAAAYk/Z8Ua3fsk4DgcfucQ6063uxKFIl21K1E9gCLcB/s1600/animation-sketch.jpg>



   - I have a GridLayout 3x3, that contains a custom Field Class (extends 
   FrameLayout)  --> I'm new to Android native development and unsure, if the 
   chosen layout-types are the right one for my use case.
   - At bottom left there is a figure (circle) set as a child of the field
   - Now I want to move the figure to the top middle field. *This should be 
   animated*
      - Here some "hacky/testing" code for the first prototype:
      - 
      
      public class Board extends RelativeLayout {
      
          
          private Map<String, Field> fields = new HashMap<>();
      
      ...
      
      public void placeFigure(AbstractFigure figure, String fieldCoord) {
          final Field field = fields.get(fieldCoord);
          field.setFigure(figure);
      }
      
          public void moveFigure(final String fromCoord, final String 
      toCoord) {
              final Field from = fields.get(fromCoord); // EXTENDS 
      FrameLayout
              final Field to = fields.get(toCoord); // EXTENDS FrameLayout
              final AbstractFigure figure = from.leaveFigure(); // EXTENDS 
      ImageView 
                    //leaveFigure will also remove the Android parent 
      relation between the FrameLayout(Field) and the ImageView (Figure)
      
              if (figure != null) {
                  Log.i("BOARD", "FOUND FIGURE = " + figure);
                  // ready to perform movement ;-) 
      
                  Scene scene = new Scene(to, figure);
      
      //            scene.setExitAction(new Runnable() {
      //                @Override
      //                public void run() { // is actually not performed?!
      //                    Log.i("SCENE", "setExitAction --> placeFigure 
      to new position...");
      //                    placeFigure(figure, toCoord);
      //                }
      //            });
      
                  final TransitionSet transitionSet = new TransitionSet();
      
                  ChangeTransform changeTransform = new ChangeTransform();
      //            changeTransform.setReparent(true);
      //            changeTransform.setDuration(3000);
      
                  transitionSet.addTransition(new ChangeBounds());
                  transitionSet.addTransition(new ChangeTransform());
      
                  transitionSet.setDuration(1000);
                  transitionSet.setInterpolator(new 
      FastOutSlowInInterpolator());
                  final ArcMotion pathMotion = new ArcMotion();
                  pathMotion.setMaximumAngle(50);
                  transitionSet.setPathMotion(pathMotion);
      
                  //TransitionManager.beginDelayedTransition(to);
                  TransitionManager.go(scene, transitionSet);
      
              }
      ...
      }
      
      - 
      - For this I thought to use the Transition Framework of the Android 
      SDK, but sadly it is not working.
      - *I will see the figure at the desired field but without an animated 
      movement?!*
      - 
      - 
      
It would be great, if someone can give me a hint or snippet, link or so for 
a similar use case.

Thanks a lot!

Cheers!

Christian

-- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
To post to this group, send email to android-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-developers/6721bd55-f919-4181-ae59-4d105312f20a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to