×
Namespaces

Variants
Actions
(Difference between revisions)

Creating Simple Animations with Java ME

From Nokia Developer Wiki
Jump to: navigation, search
Tomi_ (Talk | contribs)
m (Tomi -)
Tomi_ (Talk | contribs)
m (Tomi -)
Line 94: Line 94:
 
         }
 
         }
 
     }
 
     }
</code>
 
 
Then just let it rip:
 
<code java>
 
        if (_animation.start(from, to, ANIMATION_DURATION, EASING_CURVE))
 
        {
 
            // Animation successfully started!
 
        }
 
        else {
 
            // Failed to start the animation! Handle this situation gracefully.
 
            _animation.stop();
 
        }
 
 
</code>
 
</code>
  
 
== Summary ==
 
== Summary ==

Revision as of 12:59, 27 June 2013

This article explains how to ...

Article Metadata
CompatibilityArticle
Created: (28 Jun 2013)
Last edited: Tomi_ (27 Jun 2013)

Contents

Introduction

Implementation

Architecture

Animation-fw-architecture.png

Easing curves

Usage

public class MyCanvas
extends Canvas
implements AnimationListener
{
// Constants
...
private static final int ANIMATION_DURATION = 500;
private static final int EASING_CURVE = IntAnimation.EASING_CURVE_INOUTQUAD;
 
// Members
...
private IntAnimation _animation = null;
...
 
/**
* Constructor.
*/

public MyCanvas() {
super();
...
_animation = new IntAnimation();
_animation.setListener(this);
...
    /**
* @see AnimationListener#onAnimatedValueChanged(int)
*/

public void onAnimatedValueChanged(int value) {
// Handle the value
...
repaint();
}
 
/**
* @see AnimationListener#onAnimationStateChanged(int)
*/

public void onAnimationStateChanged(int state) {
switch (state) {
case IntAnimation.STATE_RUNNING:
...
break;
case IntAnimation.STATE_STOPPED:
...
break;
case IntAnimation.STATE_FINISHED:
...
break;
default:
break;
}
}

Summary

154 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×