Version: 5.3 (switch to 5.4b)
IdiomaEnglish
  • C#
  • JS

Idioma de script

Selecciona tu lenguaje de programación favorito. Todos los fragmentos de código serán mostrados en este lenguaje.

Keyframe.Keyframe

Sugiere un cambio

¡Éxito!

Gracias por ayudarnos a mejorar la calidad de la documentación de Unity. A pesar de que no podemos aceptar todas las sugerencias, leemos cada cambio propuesto por nuestros usuarios y actualizaremos los que sean aplicables.

Cerrar

No se puedo enviar

Por alguna razón su cambio sugerido no pudo ser enviado. Por favor <a>intente nuevamente</a> en unos minutos. Gracias por tomarse un tiempo para ayudarnos a mejorar la calidad de la documentación de Unity.

Cerrar

Cancelar

Cambiar al Manual
public Keyframe(time: float, value: float)
public Keyframe(float time, float value);

Parámetros

Descripción

Create a keyframe.

	// Make a GameObject follow a Sinus function 
	// Over the X and Y axis.

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,Mathf.Sin(i));

anim = AnimationCurve(ks); }

function Update() { transform.position = Vector3(Time.time,anim.Evaluate(Time.time),0); }
using UnityEngine;
using System.Collections;

public class ExampleClass : 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, Mathf.Sin(i)); i++; } anim = new AnimationCurve(ks); } void Update() { transform.position = new Vector3(Time.time, anim.Evaluate(Time.time), 0); } }

public Keyframe(time: float, value: float, inTangent: float, outTangent: float)
public Keyframe(float time, float value, float inTangent, float outTangent);

Parámetros

Descripción

Create a keyframe.

	// Make a GameObject follow a Sinus function 
	// Over the X and Y axis with vertical tangents.

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,Mathf.Sin(i),90,90); } anim = AnimationCurve(ks); }

function Update() { transform.position = Vector3(Time.time,anim.Evaluate(Time.time),0); }
using UnityEngine;
using System.Collections;

public class ExampleClass : 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, Mathf.Sin(i), 90, 90); i++; } anim = new AnimationCurve(ks); } void Update() { transform.position = new Vector3(Time.time, anim.Evaluate(Time.time), 0); } }