English 中文(简体)
Android:bit
原标题:Android: tween animation of a bitmap

我通过在我看来使用<代码>onDraw():

  canvas.drawBitmap(sprite.getBitmap(), sprite.getX(), sprite.getY(), null);

该仪器是一次物理模拟,迄今为止已经做了大量工作。 但是,现在,我想通过在出现某些事件时对间谍图像进行变形,来提高 an觉。

For example- when a collision happens, I would like to play an animation of an explosion. My idea was to replace the usual sprite bitmap with that of an explosion PNG, and use Android "tween animation" to make the explosion grow larger.

但是,tween animation example假设你有一个Image,在你的XML组合中做了一些静态界定。

是否有办法利用tw异的推测,对载于onDraw(的比照图进行校正? 或者,我需要转换我的间谍,以使用某种<代码>。 图像文件 如果是这样的话,你能否把我引向一个在安康进行适当的间谍活动的例子?

Thanks

最佳回答

我在java建造了一座通用的Tween发动机,你可以用来清洗任何东西,包括你的间谍。 该公司优化了乐团和游戏,因为它没有在运行时间分配任何东西,以避免任何垃圾收集。 此外, Tweens被集中起来,实实在是:根本没有收集垃圾!

www.un.org/Depts/DGACM/index_spanish.htm 你们可以看到一个完整的“:here作为和roid申请,或here,作为“GLhtml”网页(resss)上<>。

页: 1 TweenAccessor 接口,以增加Tween对你所有间谍活动的支持。 您甚至不必改变您的品行,只是创设一个<条码>。 执行<代码>TweenAccessor<Sprite>的班级,并在初始阶段登记到发动机。 仅看;

logo

I m还建立了一个可纳入任何申请的视觉时间表编辑。 它将有一个类似于闪电发件工具和Blend(银灯泡工具)的时间表。

整个发动机都有大量文件记录(所有公共方法和班级都有详细的javadoc),而yn子与闪电世界使用的Greensock s TweenMax/TweenLite发动机相当相似。 请注意,它支持每个罗伯特·佩内尔的缓解公式。

// Arguments are (1) the target, (2) the type of interpolation, 
// and (3) the duration in seconds. Additional methods specify  
// the target values, and the easing function. 

Tween.to(mySprite, Type.POSITION_XY, 1.0f).target(50, 50).ease(Elastic.INOUT);

// Possibilities are:

Tween.to(...); // interpolates from the current values to the targets
Tween.from(...); // interpolates from the given values to the current ones
Tween.set(...); // apply the target values without animation (useful with a delay)
Tween.call(...); // calls a method (useful with a delay)

// Current options are:

yourTween.delay(0.5f);
yourTween.repeat(2, 0.5f);
yourTween.repeatYoyo(2, 0.5f);
yourTween.pause();
yourTween.resume();
yourTween.setCallback(callback);
yourTween.setCallbackTriggers(flags);
yourTween.setUserData(obj);

// You can of course chain everything:

Tween.to(...).delay(1.0f).repeat(2, 0.5f).start();

// Moreover, slow-motion, fast-motion and reverse play is easy,
// you just need to change the speed of the update:

yourTween.update(delta * speed);

当然,如果不提供建立强大序列的途径,任何tw的发动机都不会完成:

Timeline.createSequence()
    // First, set all objects to their initial positions
    .push(Tween.set(...))
    .push(Tween.set(...))
    .push(Tween.set(...))

    // Wait 1s
    .pushPause(1.0f)

    // Move the objects around, one after the other
    .push(Tween.to(...))
    .push(Tween.to(...))
    .push(Tween.to(...))

    // Then, move the objects around at the same time
    .beginParallel()
        .push(Tween.to(...))
        .push(Tween.to(...))
        .push(Tween.to(...))
    .end()

    // And repeat the whole sequence 2 times
    // with a 0.5s pause between each iteration
    .repeatYoyo(2, 0.5f)

    // Let s go!
    .start();

我希望你相信: 有许多人已经利用发动机进行游戏或进行roid蒸。

问题回答

您可以不使用<条码>,从Xml文档中提取的“tageView,但事实上,这确实需要成为你的等级。

您在<代码>Canvas上所作的引文,见上层。 我认为,你有两个选择:

  1. Overlay an ImageView on top of your custom view and animate that using tween animations.
  2. Use Canvas draw routines to animate your explosion.

I d say that using Canvas routines, along with their maxtrix transformations, makes sense given that you probably already have an animation thread in your app.

您可在Adobeky中提取和证实您的爆炸,使用swfSheet。 http://developer.android.com/guide/topics/resources/animation-resource.html#Frame”rel=“nofollow” Frame animation

如果你正在创造游戏,你可以利用Verctors(Mathematical)更新你的图像,然后用SapX和Y获得。 你们应该通过某种速度,以某种方向更新和更新这一病媒。

这些病媒不是本土的(Game APs有)。

你们需要 lo,更新和更新职位,然后重新拟定。

就游戏而言,用图像表达方式来进行估算并不是一个好的想法。 他们需要这个制度,以反复地缩小所有布局。





相关问题
Android - ListView fling gesture triggers context menu

I m relatively new to Android development. I m developing an app with a ListView. I ve followed the info in #1338475 and have my app recognizing the fling gesture, but after the gesture is complete, ...

AsyncTask and error handling on Android

I m converting my code from using Handler to AsyncTask. The latter is great at what it does - asynchronous updates and handling of results in the main UI thread. What s unclear to me is how to handle ...

Android intent filter for a particular file extension?

I want to be able to download a file with a particular extension from the net, and have it passed to my application to deal with it, but I haven t been able to figure out the intent filter. The ...

Android & Web: What is the equivalent style for the web?

I am quite impressed by the workflow I follow when developing Android applications: Define a layout in an xml file and then write all the code in a code-behind style. Is there an equivalent style for ...

TiledLayer equivalent in Android [duplicate]

To draw landscapes, backgrounds with patterns etc, we used TiledLayer in J2ME. Is there an android counterpart for that. Does android provide an option to set such tiled patterns in the layout XML?

Using Repo with Msysgit

When following the Android Open Source Project instructions on installing repo for use with Git, after running the repo init command, I run into this error: /c/Users/Andrew Rabon/bin/repo: line ...

Android "single top" launch mode and onNewIntent method

I read in the Android documentation that by setting my Activity s launchMode property to singleTop OR by adding the FLAG_ACTIVITY_SINGLE_TOP flag to my Intent, that calling startActivity(intent) would ...

From Web Development to Android Development

I have pretty good skills in PHP , Mysql and Javascript for a junior developer. If I wanted to try my hand as Android Development do you think I might find it tough ? Also what new languages would I ...

热门标签