观看动画(调整大小球) [英] View Animation (Resizing a Ball)

查看:134
本文介绍了观看动画(调整大小球)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图做到这一点:

1),用户长触摸屏,
2)一个圆/球弹起(围绕用户的手指居中),并且只要生长在大小作为用户正在触摸屏
3)一旦用户放开手指,球(目前已进入最后的大小)会跳来跳去。

1) user long touches the screen, 2) a circle/ball pops up (centered around the user's finger) and grows in size as long as the user is touching the screen 3) once the user lets go of the finger, the ball (now in its final size) will bounce around.

我觉得我有蹦跳着​​从DivideAndConquer例子搞清楚,但我不知道如何动画球的增长。我看着各种观点的鳍状肢象这样的例子:

i think i have the bouncing around figure out from the DivideAndConquer example, but i am not sure how to animate the ball's growth. i looked at various view flipper examples such as this:

HTTP://www.inter-fuser。 COM / 2009/08 / Android的动画-3D-flip.html

但似乎认为鳍最适合交换两个静态图片。我没能找到比其他的鳍好景色动画的例子。另外,我想preFER使用图像,而不是仅仅一个圆圈。可有人点我在正确的方向?

but it seems like view flipper is best for swapping two static pictures. i wasn't able to find a good view animator example other than the flippers. also, i would prefer to use images as opposed to just a circle. can someone point me in the right direction?

感谢。

推荐答案

下面是两个简单的教程,以帮助您开始使用绘图基本的动画,包括触摸输入:的球在屏幕并的基本拖放

Here are two simple tutorials to help you get started with drawing basic animations including touch input: balls bouncing randomly around the screen and basic drag and drop.

在简短:你说得对,ViewFlipper真的不适合这个。你想通过自己的自定义视图在画布绘制。这是2D图形的基本框架。画布,让你画的图像文件,纯色等东西到屏幕上,同时应用转换在同一时间加时赛他们。处理用户输入(即屏幕上的手指)通过onTouchEvent(...)方法,它可以让你做一些事情,当手指触摸屏幕,在屏幕上移动,或升空做。有这两个教程的发挥,他们应该给你的基础知识。

In brief: You're right, ViewFlipper is really not suited for this. You want to draw on a Canvas by making your own custom View. This is the basic framework for 2D graphics. Canvases let you draw image files, solid colors and other things to the screen, while applying transformations ot them at the same time. Handling the user input (i.e. the finger on the screen) is done via the onTouchEvent(...) method, which lets you do something when the finger touches the screen, moves on the screen or lifts off. Have a play with those two tutorials, they should give you the basics.

这篇关于观看动画(调整大小球)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆