View中使用Interpolator实现先加速后减速动画

View的成员变量

AccelerateDecelerateInterpolator mInterpolator;

View的构造函数中调用

mInterpolator = new AccelerateDecelerateInterpolator(); 


    public void startAnimate() {
        if (mAnimate) {
            mAnimationFrame = 1;
            mAnimate = false;
            for (int i = 0; i < mDrawList.length; i++) {
                mBackList[i] = mDrawList[i];
                mDrawList[i] = 0;
            }
            mHandler.postDelayed(AnimateRunnable, 100);
        }
    }

  Runnable AnimateRunnable = new Runnable() {

        @Override
        public void run() {
            // TODO Auto-generated method stub
            for (int i = 0; i < mBackList.length; i++) {
                int score = 0;
                float input=(float)mAnimationFrame / ANIMATION_FRAME_COUNT;
                float out = mInterpolator.getInterpolation(input);
                score = (int) (mBackList[i]*out+0.5);
                mDrawList[i] = score;
            }
            mAnimationFrame++;
            invalidate();
            if (mAnimationFrame < ANIMATION_FRAME_COUNT) {
                postDelayed(this, 200);
            }
        }

    };
Image-space simplifications have been used to accelerate the calculation of computer graphic images since the dawn of visual simulation. Texture mapping has been used to provide a means by which images may themselves be used as display primitives. The work reported by this paper endeavors to carry this concept to its logical extreme by using interpolated images to portray three-dimensional scenes. The special-effects technique of morphing, which combines interpolation of texture maps and their shape, is applied to computing arbitrary intermediate frames from an array of prestored images. If the images are a structured set of views of a 3D object or scene, intermediate frames derived by morphing can be used to approximate intermediate 3D transformations of the object or scene. Using the view interpolation approach to synthesize 3D scenes has two main advantages. First, the 3D representation of the scene may be replaced with images. Second, the image synthesis time is independent of the scene complexity. The correspondence between images, required for the morphing method, can be predetermined automatically using the range data associated with the images. The method is further accelerated by a quadtree decomposition and a view-independent visible priority. Our experiments have shown that the morphing can be performed at interactive rates on today’s high-end personal computers. Potential applications of the method include virtual holograms, a walkthrough in a virtual environment, image-based primitives and incremental rendering. The method also can be used to greatly accelerate the computation of motion blur and soft shadows cast by area light sources.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值