电视机关机特效——android
Android-模拟电视屏幕开关机特效
效果图:
布局代码:
activity_main.xml
- <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:tools="http://schemas.android.com/tools"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:background="#000000"
- tools:context=".MainActivity">
- <LinearLayout
- android:id="@+id/LL"
- android:layout_width="wrap_content"
- android:orientation="horizontal"
- android:layout_centerHorizontal="true"
- android:layout_height="wrap_content">
- <Button
- android:background="#ffffff"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:onClick="off"
- android:text="关" />
- <Button
- android:background="#ffffff"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:onClick="on"
- android:text="开" />
- </LinearLayout>
- <LinearLayout
- android:layout_below="@+id/LL"
- android:layout_width="match_parent"
- android:layout_height="match_parent">
- <ImageView
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:id="@+id/imageView"
- android:scaleType="centerCrop"
- android:src="@drawable/aa"/>
- </LinearLayout>
- </RelativeLayout>
MyAnimation.java
- package com.example.yu_longji.android21;
- import android.graphics.Matrix;
- import android.view.animation.AccelerateDecelerateInterpolator;
- import android.view.animation.AccelerateInterpolator;
- import android.view.animation.Animation;
- import android.view.animation.Transformation;
- /**
- * Created by yu_longji on 2015/8/30.
- */
- public class MyAnimation {
- OffAnimation offanim;
- OnAnimation onanim;
- MyAnimation() {
- offanim = new OffAnimation();
- onanim = new OnAnimation();
- }
- public class OffAnimation extends Animation {
- int halfWidth;
- int halfHeight;
- @Override
- public void initialize(int width, int height, int parentWidth, int parentHeight) {
- super.initialize(width, height, parentWidth, parentHeight);
- //设置动画时间为800毫秒
- setDuration(800);
- //设置动画结束后就结束在动画结束的时刻
- setFillAfter(true);
- //保存View的中心点
- halfWidth = width / 2;
- halfHeight = height / 2;
- //设置动画先加速后减速
- setInterpolator(new AccelerateDecelerateInterpolator());
- }
- @Override
- protected void applyTransformation(float interpolatedTime, Transformation t) {
- super.applyTransformation(interpolatedTime, t);
- final Matrix matrix = t.getMatrix();
- //interpolatedTime是从0~1的一个变化,所以我们前80%让动画缩小成一个线,后20%保持线的高度缩小线的宽度
- if (interpolatedTime < 0.8) {
- matrix.preScale(1 + 0.625f * interpolatedTime, 1 - interpolatedTime / 0.8f + 0.01f, halfWidth, halfHeight);
- } else {
- matrix.setScale(7.5f * (1 - interpolatedTime), 0.01f, halfWidth, halfHeight);
- }
- }
- }
- public class OnAnimation extends Animation {
- int halfWidth;
- int halfHeight;
- @Override
- public void initialize(int width, int height, int parentWidth, int parentHeight) {
- super.initialize(width, height, parentWidth, parentHeight);
- //设置动画时间为900毫秒
- setDuration(900);
- //设置动画结束后就结束在动画结束的时刻
- setFillAfter(true);
- //保存View的中心点
- halfWidth = width / 2;
- halfHeight = height / 2;
- setInterpolator(new AccelerateInterpolator());
- }
- @Override
- protected void applyTransformation(float interpolatedTime, Transformation t) {
- super.applyTransformation(interpolatedTime, t);
- final Matrix matrix = t.getMatrix();
- if (interpolatedTime < 0.2) {
- matrix.setScale(0.01f, interpolatedTime * 5.0f, halfWidth, halfHeight);
- } else {
- matrix.setScale((float) Math.pow(interpolatedTime, 4), 1, halfWidth, halfHeight * 2);
- }
- }
- }
- //上下收缩
- // matrix.preScale(1,1-interpolatedTime,halfWidth*2,halfHeight);
- //中间一条线拉伸
- // matrix.setScale(interpolatedTime,0.01f,halfWidth,halfHeight);
- //上下伸展开
- // matrix.preScale(1,-(interpolatedTime),halfWidth*2,halfHeight);
- //左右向中间收缩
- // matrix.preScale(1-interpolatedTime,1,halfWidth,halfHeight*2);
- //上下伸展开
- // matrix.setScale(1, interpolatedTime, width, halfHeight);
- }
- package com.example.yu_longji.android21;
- import android.app.Activity;
- import android.os.Bundle;
- import android.view.View;
- import android.widget.ImageView;
- public class MainActivity extends Activity {
- ImageView imageView;
- MyAnimation myAnimation;
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
- imageView = (ImageView) findViewById(R.id.imageView);
- myAnimation = new MyAnimation();
- }
- //关
- public void off(View view) {
- imageView.startAnimation(myAnimation.offanim);
- }
- //开
- public void on(View view) {
- imageView.startAnimation(myAnimation.onanim);
- }
- }
unity5.6 老电视屏幕效果
2017年08月17日 7.19MB 下载
[Unity3D] 战场电视屏幕抖动扭曲Shader
由于项目需要,弄了一个屏幕抖动Shader,直接看效果吧,UGUI Shader。 注意:使用的时候需要两张噪音贴图 Shader "Effect/SimpleHeadEffect" { ...
unity3d老电视花屏闪烁效果
找到一般都是全屏的闪烁效果 于是就改了一个shader可以用到模型上的 另外添加了一些控制参数 Shader "Custom/Screen" { Properties{ _MainTex...
Android 模拟电视机开关机的动画效果
话不多说先上图: 关机动画public class TVOffAnimation extends Animation { private int halfWidth; private...
Unity Shaders——屏幕特效老电影效果(Old Movie Screen Effect)
本文参考《Unity Shaders and Effects CookBook》。 很多时候我们游戏需要带入不同的场景,比如老电影的那种效果 像这种效果我们怎么实现呢? 下面分析下结构...
Android电视关闭的动画效果
老式电视机关闭的时候画面一闪消失的那个效果: 首先创建一个TVOffAnimation继承于Animation: import android.graphics.Matrix; imp...
android apk自动开关机-接受开机广播后关机
AndroidManifest.xml: xml version="1.0" encoding="utf-8"?> xmlns:android="http://schemas.android.c...
液晶电视面板的类型、等级及鉴别方法
液晶电视面板知识普及,导读 导读 面板在很大程度上决定着显示设备的亮度、对比度、色彩、可视角度等诸多效果,电视机产品亦然,液晶等离子两大主要阵营分别采用不同国籍的LCD和PDP面板,考虑...
模拟google搜索特效
2011年06月08日 2.02MB 下载
Android-导航栏特效-文字缩放-颜色渐变
2015年03月29日 3.14MB 下载
Android-编程权威指南
2018年01月23日 14.79MB 下载
闪电特效算法
转载自: http://blog.****.net/u012945598/article/details/18862091 这部短片使用了中点位移法来模拟闪电。 中点位移法通常是用...
js 特效 html 特效 模拟下雪景象
2011年08月20日 9KB 下载
js 特效 html 特效 模拟太空飞行
2011年08月20日 11KB 下载
js 特效 html 特效 模拟跳舞游戏
2011年08月20日 12KB 下载
互动交流
我的邮箱:
Github:
https://github.com/yuSniper
觉得文章哪里有错或是不妥的地方,恳请大家多多指正。如果博文对你有些帮助,请留个脚印,谢谢。
转载必须注明出处。
最新文章
- Android studio 导入SVN工程文件出现Gradle '' project refresh failed Error:Cause: unknown protocol: c
- Android-使用Timer实现5秒内接收到数据就进行打印,若超过5秒后没有收到数据再打印
- 报错:ViewPager$LayoutParams cannot be cast to android.widget.AbsListView$LayoutParams
- java.lang.IllegalStateException: Recursive entry to executePendingTransactio
- Swift-Swift初体验
个人分类
热门文章
最新评论
-
Android-拦截短信(Broa...
qq_35396724:新版本有什么拦截短信的方法吗
-
Android-客户端上传多张图片...
qq_37495946:很详细,感谢博主
-
Android-客户端上传多张图片...
ou632895904:楼主您好,为什么在gridView1.setAdapter(simpleAdapter);这个地方...
-
Android-客户端上传多张图片...
u013625330:可以,实用易懂。非常好。
-
Android-客户端上传多张图片...
qinyanweiAa:非常好,非常感谢,谢谢!解决了大问题了
效果图:
布局代码:
activity_main.xml
- <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:tools="http://schemas.android.com/tools"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:background="#000000"
- tools:context=".MainActivity">
- <LinearLayout
- android:id="@+id/LL"
- android:layout_width="wrap_content"
- android:orientation="horizontal"
- android:layout_centerHorizontal="true"
- android:layout_height="wrap_content">
- <Button
- android:background="#ffffff"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:onClick="off"
- android:text="关" />
- <Button
- android:background="#ffffff"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:onClick="on"
- android:text="开" />
- </LinearLayout>
- <LinearLayout
- android:layout_below="@+id/LL"
- android:layout_width="match_parent"
- android:layout_height="match_parent">
- <ImageView
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:id="@+id/imageView"
- android:scaleType="centerCrop"
- android:src="@drawable/aa"/>
- </LinearLayout>
- </RelativeLayout>
MyAnimation.java
- package com.example.yu_longji.android21;
- import android.graphics.Matrix;
- import android.view.animation.AccelerateDecelerateInterpolator;
- import android.view.animation.AccelerateInterpolator;
- import android.view.animation.Animation;
- import android.view.animation.Transformation;
- /**
- * Created by yu_longji on 2015/8/30.
- */
- public class MyAnimation {
- OffAnimation offanim;
- OnAnimation onanim;
- MyAnimation() {
- offanim = new OffAnimation();
- onanim = new OnAnimation();
- }
- public class OffAnimation extends Animation {
- int halfWidth;
- int halfHeight;
- @Override
- public void initialize(int width, int height, int parentWidth, int parentHeight) {
- super.initialize(width, height, parentWidth, parentHeight);
- //设置动画时间为800毫秒
- setDuration(800);
- //设置动画结束后就结束在动画结束的时刻
- setFillAfter(true);
- //保存View的中心点
- halfWidth = width / 2;
- halfHeight = height / 2;
- //设置动画先加速后减速
- setInterpolator(new AccelerateDecelerateInterpolator());
- }
- @Override
- protected void applyTransformation(float interpolatedTime, Transformation t) {
- super.applyTransformation(interpolatedTime, t);
- final Matrix matrix = t.getMatrix();
- //interpolatedTime是从0~1的一个变化,所以我们前80%让动画缩小成一个线,后20%保持线的高度缩小线的宽度
- if (interpolatedTime < 0.8) {
- matrix.preScale(1 + 0.625f * interpolatedTime, 1 - interpolatedTime / 0.8f + 0.01f, halfWidth, halfHeight);
- } else {
- matrix.setScale(7.5f * (1 - interpolatedTime), 0.01f, halfWidth, halfHeight);
- }
- }
- }
- public class OnAnimation extends Animation {
- int halfWidth;
- int halfHeight;
- @Override
- public void initialize(int width, int height, int parentWidth, int parentHeight) {
- super.initialize(width, height, parentWidth, parentHeight);
- //设置动画时间为900毫秒
- setDuration(900);
- //设置动画结束后就结束在动画结束的时刻
- setFillAfter(true);
- //保存View的中心点
- halfWidth = width / 2;
- halfHeight = height / 2;
- setInterpolator(new AccelerateInterpolator());
- }
- @Override
- protected void applyTransformation(float interpolatedTime, Transformation t) {
- super.applyTransformation(interpolatedTime, t);
- final Matrix matrix = t.getMatrix();
- if (interpolatedTime < 0.2) {
- matrix.setScale(0.01f, interpolatedTime * 5.0f, halfWidth, halfHeight);
- } else {
- matrix.setScale((float) Math.pow(interpolatedTime, 4), 1, halfWidth, halfHeight * 2);
- }
- }
- }
- //上下收缩
- // matrix.preScale(1,1-interpolatedTime,halfWidth*2,halfHeight);
- //中间一条线拉伸
- // matrix.setScale(interpolatedTime,0.01f,halfWidth,halfHeight);
- //上下伸展开
- // matrix.preScale(1,-(interpolatedTime),halfWidth*2,halfHeight);
- //左右向中间收缩
- // matrix.preScale(1-interpolatedTime,1,halfWidth,halfHeight*2);
- //上下伸展开
- // matrix.setScale(1, interpolatedTime, width, halfHeight);
- }
- package com.example.yu_longji.android21;
- import android.app.Activity;
- import android.os.Bundle;
- import android.view.View;
- import android.widget.ImageView;
- public class MainActivity extends Activity {
- ImageView imageView;
- MyAnimation myAnimation;
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
- imageView = (ImageView) findViewById(R.id.imageView);
- myAnimation = new MyAnimation();
- }
- //关
- public void off(View view) {
- imageView.startAnimation(myAnimation.offanim);
- }
- //开
- public void on(View view) {
- imageView.startAnimation(myAnimation.onanim);
- }
- }