unity3d 克服GIF不支持,贴图实现动画效果
来源:互联网 发布:qq飞车修复工具无网络 编辑:程序博客网 时间:2024/05/21 10:02
图片导入成关键帧图片序列,类似(0,1,2...)然后在用脚本根据时间逐帧加载贴图,实现GIF效果,亲测
using UnityEngine;
using System.Collections;public class GIFCS : MonoBehaviour {
// Use this for initialization
//public GameObject plane;
private Texture2D[] anim;
private int nowFram = 0 ;
private int mFrameCount ;
private float fps = 24;
private float time = 0;
private int index;
void Start () {
//在project 下面建立Resources/animation,名字自定义;
anim = Resources.LoadAll<Texture2D>(this.name );
//获取图片数量
mFrameCount = anim.Length;
}
void Update() {
time += Time.deltaTime;
if(time >= 1.0 / fps)
{
nowFram++;
time = 0;
index = nowFram % mFrameCount; //数组的索引,根据时间改变,当前时间乘以fps与总帧数取余,就是播放的当前帧,随着update更新
// anim[index].alphaIsTransparency = true;
this.renderer.material.mainTexture = anim[index]; //渲染这个贴图
}
}
}
0 0
- unity3d 克服GIF不支持,贴图实现动画效果
- unity3d 克服不支持gif,实现动画
- Unity3D 脚本实现动画效果
- gif文件的加载--实现动画效果
- CSS3+PNG实现GIF动画效果
- Android 实现gif动画效果1
- Android 实现gif动画效果2
- iOS的GIF动画效果实现
- 项目中的动画效果,gif实现
- iOS的GIF动画效果实现
- java实现gif动画效果(java显示动态图片)
- 多种方法实现H5网页GIF图片动画效果
- gif动画效果 移动动画效果
- QTextEdit 实现gif动画
- 实现GIF动画缩略图
- GIF动画的实现
- Unity3D动画贴图、滚动纹理、滚动贴图脚本
- 实现播放gif效果
- Flex AdvancedDataGrid 单元格格式
- Win8下tomcat拒绝访问 Unable to open the service 'Tomcat6'
- 四、Python Signal 信号
- mapreduce编程模型学习--1
- 面向对象基础实验-Point类
- unity3d 克服GIF不支持,贴图实现动画效果
- C/C++中static关键字作用总结
- c#使用SharpZipLib压缩和解压缩文件
- JavaWeb 响应请求
- 关于struts2的checkboxlist、select等标签发生
- 阿里巴巴笔试题
- ajaxfileupload.js不支持IE9,IE10的解决方案
- 毕业后的第三年
- mybatis学习- ORM概念