当前位置: 首页 > news >正文

温州免费建站河南郑州做网站的公司

温州免费建站,河南郑州做网站的公司,wordpress 当前页面名称,广东省农业农村厅班子一、预览动画 可以放很多图,可以自己往后加,可以调图片x轴和y轴间距,可以调图片飞出方向,可以调堆叠方向。 图1 图片堆叠动画预览 二、纯净代码 有粉丝问我这个效果,最近很忙,没有时间细写,先…

一、预览动画

可以放很多图,可以自己往后加,可以调图片x轴和y轴间距,可以调图片飞出方向,可以调堆叠方向。

图1 图片堆叠动画预览

二、纯净代码

有粉丝问我这个效果,最近很忙,没有时间细写,先发上来给有需要的朋友用。

如果帮到你了,请给我一个赞,预制体同步上传

using System.Collections;
using UnityEngine;
using UnityEngine.EventSystems;public class CardStack2D : MonoBehaviour,IPointerDownHandler,IPointerUpHandler
{//卡片移动速度[SerializeField] private float cardMoveSpeed = 8f;//按钮冷却时间private bool canUseHorizontalAxis = true;[SerializeField] private float buttonCooldownTime = 5f;//x轴间隔[SerializeField] private int xPowerDifference;//y轴间隔[SerializeField] private int cardYMultiplier = 32;//z轴间隔[SerializeField] private int cardZMultiplier = 32;//调整终点X[SerializeField] private int endXPos = 1280;//卡片[SerializeField] private int cardIndex;[SerializeField] private Transform[] cards;public bool isLeftGroup = true;[SerializeField] private Vector3[] cardPositions;//鼠标拖拽private bool isDraggingCard;private float lastMouseX;private float deltaX;private void Start(){//xPowerDifference = 9 - cards.Length;//卡片位置共有  x*2-1个cardPositions = new Vector3[cards.Length * 2 - 1];//左半部分卡片for (int i = cards.Length; i > -1; i--){if (i < cards.Length - 1){float positionX;if (isLeftGroup){positionX = -xPowerDifference+ cardPositions[i + 1].x;}else{positionX = xPowerDifference+ cardPositions[i + 1].x;}//设置卡片的初始位置cardPositions[i] = new Vector3(positionX, cardYMultiplier * Mathf.Abs(i + 1 - cards.Length), cardZMultiplier * Mathf.Abs(i + 1 - cards.Length));}else{cardPositions[i] = Vector3.zero;}}//右半部分卡片for (int i = cards.Length; i < cardPositions.Length; i++){cardPositions[i] = new Vector3(endXPos + 4 * (i - cards.Length), 0, -2 + -2 * (i - cards.Length));}}private void Update(){for (int i = 0; i < cards.Length; i++){cards[i].localPosition = Vector3.Lerp(cards[i].localPosition, cardPositions[i + cardIndex],Time.deltaTime * cardMoveSpeed);if (Mathf.Abs(cards[i].localPosition.x - cardPositions[i + cardIndex].x) < 0.01f){cards[i].localPosition = cardPositions[i + cardIndex];if (cards[i].localPosition.x == 0){cards[i].gameObject.GetComponent<CanvasGroup>().interactable = true;}else{cards[i].gameObject.GetComponent<CanvasGroup>().interactable = false;}}}}private void LastCard(){if (!canUseHorizontalAxis||(cardIndex-1)<0) return;cardIndex--;StartCoroutine(ButtonCooldown());}private void NextCard(){if (!canUseHorizontalAxis||(cardIndex+1)>=cards.Length) return;cardIndex++;StartCoroutine(ButtonCooldown());}private IEnumerator ButtonCooldown(){canUseHorizontalAxis = false;yield return new WaitForSeconds(buttonCooldownTime);canUseHorizontalAxis = true;}public void OnPointerDown(PointerEventData eventData){isDraggingCard = true;lastMouseX = Input.mousePosition.x;}public void OnPointerUp(PointerEventData eventData){if(!isDraggingCard) return;isDraggingCard = false;deltaX = Input.mousePosition.x - lastMouseX;Debug.Log(deltaX);switch (deltaX){case > 50:NextCard();break;case < -50:LastCard();break;}}private void OnDisable(){cardIndex = 0;}
}

http://www.hkea.cn/news/363667/

相关文章:

  • 弄个做网站公司产品宣传
  • 商品房建设信息网站googleplay商店
  • 菏泽 网站建设优化工具箱
  • 网站建设找哪家公司百度搜索热度
  • 网页设计论文引言北海百度seo
  • 网站空间哪家做的好网络营销的常用工具
  • 网站开发具体问题优化营商环境
  • wordpress4.5 火车头廊坊seo培训
  • 怎么做多个网站单点登录艺考培训
  • 网站怎么做双语种seo关键词如何设置
  • 用java做的游戏下载网站有哪些内容成都网络推广优化
  • 慈溪市网站建设google官网
  • 网站建设计划seo网站排名优化软件是什么
  • 大连网站建设谁家好郴州网站定制
  • 网站建设背景怎么写一个企业该如何进行网络营销
  • 为女朋友做的表白网站百度大数据分析工具
  • 上海高端网站建设服务公seo推广公司
  • 找人合伙做网站平台仿站定制模板建站
  • 深圳市网站建设科技公司腾讯网网站网址
  • wordpress语言文件夹seo销售好做吗
  • 河北建设集团官网西安网站seo
  • 在外汇局网站做登记报告恢复原来的百度
  • 做外贸做的很好的网站全国疫情突然又严重了
  • 开发app需要什么样的团队百度seo优化培训
  • ftp上传网站之后软文什么意思范例
  • 询广西南宁网站运营推广系统
  • wordpress侧边栏小工具佛山网站优化
  • 用vs做网站原型企业培训课程有哪些内容
  • wordpress评论自定义百度刷排名seo
  • 四川建设网官网登录入口泉州seo外包