用Tween动画简单模拟果冻按钮效果
来源:互联网 发布:韩寒 代笔 知乎 编辑:程序博客网 时间:2024/04/29 18:19
网上有关于果冻效果的插件JellySprites,我呢,只想要一个点击一下按钮,按钮会像果冻一样动一下。没必要弄那么复杂。我就用tween动画写了一下。写出分享给大家。
using UnityEngine;using System.Collections;public class JellyButton : MonoBehaviour { Vector3 m_Scale; void Start() { m_Scale = transform.localScale; } void OnClick() { StartCoroutine(JellyEffect()); } IEnumerator JellyEffect() { TweenScale.Begin(gameObject, 0.05f, new Vector3(m_Scale.x * 1.1f, m_Scale.y * 0.8f, m_Scale.z)); yield return new WaitForSeconds(0.05f); TweenScale.Begin(gameObject, 0.1f, new Vector3(m_Scale.x * 0.8f, m_Scale.y * 1.1f, m_Scale.z)); yield return new WaitForSeconds(0.1f); TweenScale.Begin(gameObject, 0.1f, new Vector3(m_Scale.x * 1.07f, m_Scale.y * 0.85f, m_Scale.z)); yield return new WaitForSeconds(0.1f); TweenScale.Begin(gameObject, 0.15f, new Vector3(m_Scale.x * 0.85f, m_Scale.y * 1.07f, m_Scale.z)); yield return new WaitForSeconds(0.15f); TweenScale.Begin(gameObject, 0.2f, new Vector3(m_Scale.x * 1.05f, m_Scale.y * 0.9f, m_Scale.z)); yield return new WaitForSeconds(0.2f); TweenScale.Begin(gameObject, 0.2f, new Vector3(m_Scale.x * 0.95f, m_Scale.y * 1.035f, m_Scale.z)); yield return new WaitForSeconds(0.2f); TweenScale.Begin(gameObject, 0.25f, m_Scale); }}
阅读全文
0 0
- 用Tween动画简单模拟果冻按钮效果
- 果冻弹簧效果动画
- cocos2d-lua 按钮果冻效果
- 粘性动画以及果冻效果
- Android动画效果Animation之Tween实现简单动画
- Android动画效果Animation之Tween实现简单动画
- android tween 动画效果
- 简单的Tween动画
- 使用CADisplayLink实现果冻效果动画
- Android果冻效果(阻尼动画)
- 粘性动画以及果冻效果的实现
- Android动画Animation之Tween用代码实现动画效果
- 利用html5/css3 动画效果,实现图片果冻抖动效果
- 谈谈iOS中粘性动画以及果冻效果的实现
- IOS粘性动画以及果冻效果的实现
- 谈谈iOS中粘性动画以及果冻效果的实现
- 谈谈iOS中粘性动画以及果冻效果的实现
- 谈谈iOS中粘性动画以及果冻效果的实现
- ROC曲线的理解
- android studio运行Kotilin程序出现Error:(5, 8) Unresolved reference: kotlinx 解决办法
- Golang实战-一个聊天室的实现
- myqldump 导入导出数据库
- CyclicBarrier和CountDownLatch的区别
- 用Tween动画简单模拟果冻按钮效果
- docker(二):Mac docker hello-world
- h5移动开发Ajax上传多张Base64格式图片(前端发送及后端验证)
- 『ORACLE』设置快速恢复区(11g)
- swiper禁止手动滑动
- Mac Nginx 配置 Tomcat 配置 jdk环境变量 Nginx部署服务遇到的坑(1)
- main函数的参数
- LVM配置
- 替换数据库里某个字段里的一段内容的sql写法