Unity制作点阵视频

您所在的位置:网站首页 unity导出png Unity制作点阵视频

Unity制作点阵视频

2023-03-28 11:37| 来源: 网络整理| 查看: 265

准备资料:AE、视频素材 视频素材地址 https://cloud.189.cn/t/naAviyrY3QVr (访问码:eyz9) 新建合成,导入素材,添加效果颜色键,扣除白色。

为了效果明显,加点位移动画

image.png

ctrl +m 导出 格式选择png序列,降低采样,帧率为5,点击渲染

image.png image.png image.png image.png

导入Unity

image.png

读取单张图片

using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using System; using System.IO; public class GameEnter : MonoBehaviour { const int width = 16*4; const int height = 9*4; public Transform parent; public Image itemPrefab; public Texture2D[] texture; const float padding=3; readonly Vector2 size = new Vector2(23, 23); public int samplingStep = 1; private Image[,] itemList = new Image[width, height]; // Start is called before the first frame update void Start() { itemPrefab.rectTransform.sizeDelta = size; for (int i = 0; i < width; i++) { for (int j = 0; j < height; j++) { var img = GameObject.Instantiate(itemPrefab, new Vector3((i ) * (size.x + padding), (j) * (size.y + padding)),Quaternion.identity,parent); img.gameObject.SetActive(true); itemList[i, j] = img; } } Caculate(texture[30]); } void Caculate(Texture2D texture,int idx) { for (int i = 0; i < colored.Count; i++) { colored[i].color = Color.white; } colored.Clear(); var widthStep = texture.width / samplingStep; var heightStep = texture.height / samplingStep; for (int i = 0; i


【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3