Unity3D圣典3.3版本-中文版
文集大纲加载中……
本文档使用 MrDoc 发布
-
+
首页
AnimationCurve.keys 所有键
# [AnimationCurve](AnimationCurve.html).keys **所有键** var *keys* : Keyframe[] *Description* 描述 All keys defined in the animation curve. 在动画曲线中定义的所有键. This lets you clear, add or remove any keys from the array. If keys are not sorted by time, they will be automatically sorted on assignment. 这让你从数组中清理,添加,移除任何键.如果键没有按照时间排序,他们会在赋值的时候自动排序. Note that the array is "by value", i.e. getting keys returns a copy of all keys and setting keys copies them into the curve. 注意:数组是通过值排序.即是:获取键返回一个所有键的副本并设置键的副本到曲线. See Also: [Keyframe](../Keyframe/Keyframe.html) struct, [AddKey](AnimationCurve.AddKey.html), [RemoveKey](AnimationCurve.RemoveKey.html) functions. * [C#](#) * [JavaScript](#) ``` using UnityEngine; using System.Collections; public class example : MonoBehaviour { private AnimationCurve anim; private Keyframe[] ks; void Start() { ks = new Keyframe[50]; int i = 0; while (i < ks.Length) { ks[i] = new Keyframe(i, i * i); i++; } anim = new AnimationCurve(ks); } void Update() { transform.position = new Vector3(Time.time, anim.Evaluate(Time.time), 0); } } ``` ``` // Make a GameObject follow a Cuadratic function // 使一个游戏对象跟随一个Cuadratic函数 // Over the X and Y axis. // 在X,Y轴 private var anim : AnimationCurve; private var ks : Keyframe []; function Start() { ks = new Keyframe [50]; for(var i = 0; i < ks.Length ; i++){ ks[i] = Keyframe (i,i*i); } anim = new AnimationCurve(ks); } function Update() { transform.position = Vector3( Time.time ,anim.Evaluate( Time.time ),0); } ```
da
2022年5月13日 22:16
转发文档
收藏文档
上一篇
下一篇
手机扫码
复制链接
手机扫一扫转发分享
复制链接
关于 MrDoc
觅思文档MrDoc
是
州的先生
开发并开源的在线文档系统,其适合作为个人和小型团队的云笔记、文档和知识库管理工具。
如果觅思文档给你或你的团队带来了帮助,欢迎对作者进行一些打赏捐助,这将有力支持作者持续投入精力更新和维护觅思文档,感谢你的捐助!
>>>捐助鸣谢列表
微信
支付宝
QQ
PayPal
Markdown文件
分享
链接
类型
密码
更新密码