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

企业网站首页设计原则semiconductor

企业网站首页设计原则,semiconductor,自己可以做电子商务网站,网站系统怎么做的一、预览动画 可以放很多图,可以自己往后加,可以调图片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.laogonggong.com/news/3729.html

相关文章:

  • 网站开发公司报价怎么营销一个产品
  • 天津百度网站快速优化好的竞价账户托管外包
  • 做网站用b s和c s长沙官网seo收费
  • 长沙网站建设专家seo的基本步骤是什么
  • wordpress4.9 php版本安卓优化清理大师
  • 网站备案如何注销谷歌浏览器网页版入口
  • 公司网站建设吧个好chatgpt网站
  • 政府部门网站建设负责部门seo优化广告
  • 网站上传 空间 数据库seo服务建议
  • 网站上传 空间 数据库seo服务建议
  • 聚焦伟业网站怎么做推广今日时政新闻热点
  • 自己的电脑做网站可以吗今日国内新闻头条大事
  • 学校怎么做网站html做一个简单的网页
  • 做网站需要什么特色晨阳seo
  • 网络科技公司网站模板关键词
  • wordpress 后台页面不正常seo sem是啥
  • 网站建设倒计时模板如何做好平台推广
  • 乐客vr加盟费用要多少求职seo推荐
  • 官方网站管理办法百度首页登录入口
  • 广州艾迪网站建设推广类软文案例
  • 成都网站建设科技公司网络营销是什么?
  • 汽车之家网站做的很烂seo网站编辑是做什么的
  • 凡科做的网站怎么改壁纸常州网站建设书生商友
  • 深圳手机网站制作公司潍坊seo外包平台
  • 国外比较好的建筑设计网站快速整站优化
  • 网站开发标准sem是什么专业
  • 网站建设如何账务处理爱用建站官网
  • 域名怎么进入网站北京seo关键词
  • 做电影网站视频放在那里整合营销策划名词解释
  • 用php做图书管理网站站长之家seo