Search Results

Search found 1 results on 1 pages for 'gamedev123'.

Page 1/1 | 1 

  • How can I run an android frame animation without it skewing?

    - by GameDev123
    I have a small state machine that runs a series of frame by frame animations in an ImageView, in a nested hierarchy of layouts. There is more than adequate space to display each frame of the animation. Each frame of the animation is cropped to fit the minimum amount of area, in order to save memory. If a frame only contains 50x50 worth of pixels then the png is 50x50. There is no transparent padding to keep them the same size. The ImageView is directly within a RelativeLayout, and is anchored to the bottom left with some padding. The general idea being that the character in the animation performs some action, which results in individual frames of the animation growing or shrinking. The issue is that individual frames of animation are skewed, and there does not appear to be any way of preventing this. If I set the source of the imageview directly to one of the frames of animation, it displays fine in the layout manager. I have tried this with Adjust View Bounds set to true, false, and undefined. I have tried using the background and the src attribute of imageview to set the animation drawable, I have tried every configuration of layout manager and setting minimum/maximum size that I can think of, and it still stretches the character on various frames depending on the size of the source png. In essence, all I want to do is say "I want this ImageView to anchor in the bottom left and then display any frame that happens to be in it without stretching or skewing it in any way aside from that which occurred when the frame png's were loaded." Seems simple, but I have yet to come across any way of doing it. Here is the layout of the imageview as of my last test, I had to remove bits of the XML to get it to display but nothing pertinent: RelativeLayout android:orientation="horizontal" android:layout_above="@+id/MenuOptions" android:layout_width="fill_parent" android:id="@+id/AnimationLayout" android:clipChildren="false" android:minHeight="180dp" android:layout_height="fill_parent" android:layout_below="@+id/GameBarLayout" ImageView android:id="@+id/animatedImg" android:layout_height="wrap_content" android:layout_width="wrap_content" android:visibility="visible" android:baselineAlignBottom="true" android:minHeight="180dp" android:minWidth="200dp" android:adjustViewBounds="true" android:layout_alignParentBottom="true" android:paddingLeft="30dp" android:paddingBottom="10dp" android:src="@drawable/idle01"/ImageView /RelativeLayout Here is how an animation is set up: animationDrawable = new AnimationDrawable(); animationDrawable.addFrame(res.getDrawable(R.drawable.idle01), 16); animationDrawable.addFrame(res.getDrawable(R.drawable.idle02), 16); animationDrawable.addFrame(res.getDrawable(R.drawable.idle03), 16);

    Read the article

1