using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
public class CenterOnTurnPage : MonoBehaviour,IPointerUpHandler,IBeginDragHandler,IEndDragHandler{
//滚动视图
ScrollRect scrollRect;
//获取内容
RectTransform content;
//判断是否结束拖动
bool isDrag = false;
//目标的进度:滑动条
float targetP = -1;
//保存每页进度:0,0.25,0.5,0.75,1 每页进度:1/(总页数-1)*(页数-1);
//每页进度=单个宽度*(页数-1)/(总宽度-单个宽度)
float[] pageProgressList;
[SerializeField]
private float Speed;
// Use this for initialization
void Start () {
scrollRect = this.GetComponent<ScrollRect>();
content = scrollRect.content;
UGUI-Scroll View实现图片翻页效果
最新推荐文章于 2024-08-03 13:37:33 发布
本文详细介绍了如何使用Unity的UGUI Scroll View组件创建图片翻页效果。通过调整Scroll View的设置和利用Rect Transform,实现了流畅的滚动和平滑过渡,为用户提供了类似图书翻页的交互体验。
摘要由CSDN通过智能技术生成