> For the complete documentation index, see [llms.txt](https://kinematicsoup.gitbook.io/reactor/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kinematicsoup.gitbook.io/reactor/api-reference/ks.reactor/ks.reactor.kscurve.md).

# Class ksCurve

Namespace: [KS.Reactor](/reactor/api-reference/ks.reactor.md)\
Assembly: KSCommon.dll

Describes a curve defined by keyframes. Each key frame contains information to create two points of a cubic Bezier curve. For a given segement between keyframe k0 and k1 the bezier points are defined to be 0, k0.Value), (k0.OutWeight, k0.OutTangent \* t \* k0.OutWeight + k0.Value), (1 - k1.InWeight, -k1.InTangent \* t \* k1.InWeight + k0.Value), (1, k1.Value) where t is k1.time - k0.time

```csharp
public class ksCurve
```

#### Inheritance

[object](https://learn.microsoft.com/dotnet/api/system.object) ← [ksCurve](/reactor/api-reference/ks.reactor/ks.reactor.kscurve.md)

#### Inherited Members

[object.Equals(object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals\(system-object\)), [object.Equals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals\(system-object-system-object\)), [object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode), [object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype), [object.MemberwiseClone()](https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone), [object.ReferenceEquals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.referenceequals), [object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)

## Properties

### Duration <a href="#ks_reactor_kscurve_duration" id="ks_reactor_kscurve_duration"></a>

Returns the duration of the curve. Sum of all keyframe times.

```csharp
public float Duration { get; }
```

#### Property Value

[float](https://learn.microsoft.com/dotnet/api/system.single)

### EndTime <a href="#ks_reactor_kscurve_endtime" id="ks_reactor_kscurve_endtime"></a>

Gets the time this curve ends.

```csharp
public float EndTime { get; }
```

#### Property Value

[float](https://learn.microsoft.com/dotnet/api/system.single)

### KeyFrameCount <a href="#ks_reactor_kscurve_keyframecount" id="ks_reactor_kscurve_keyframecount"></a>

Returns the number of keyframes in the curve.

```csharp
public int KeyFrameCount { get; }
```

#### Property Value

[int](https://learn.microsoft.com/dotnet/api/system.int32)

### PostWrapMode <a href="#ks_reactor_kscurve_postwrapmode" id="ks_reactor_kscurve_postwrapmode"></a>

Gets/Sets the wrap mode to use when evaluating times past the duration of the curve.

```csharp
public ksCurve.WrapModes PostWrapMode { get; set; }
```

#### Property Value

[ksCurve](/reactor/api-reference/ks.reactor/ks.reactor.kscurve.md).[WrapModes](/reactor/api-reference/ks.reactor/ks.reactor.kscurve/ks.reactor.kscurve.wrapmodes.md)

### PreWrapMode <a href="#ks_reactor_kscurve_prewrapmode" id="ks_reactor_kscurve_prewrapmode"></a>

Gets/Sets the wrap mode to use when evaluating times before the start of the curve.

```csharp
public ksCurve.WrapModes PreWrapMode { get; set; }
```

#### Property Value

[ksCurve](/reactor/api-reference/ks.reactor/ks.reactor.kscurve.md).[WrapModes](/reactor/api-reference/ks.reactor/ks.reactor.kscurve/ks.reactor.kscurve.wrapmodes.md)

### StartTime <a href="#ks_reactor_kscurve_starttime" id="ks_reactor_kscurve_starttime"></a>

Gets the time this curve starts.

```csharp
public float StartTime { get; }
```

#### Property Value

[float](https://learn.microsoft.com/dotnet/api/system.single)

## Methods

### AddKeyframe(Keyframe) <a href="#ks_reactor_kscurve_addkeyframe_ks_reactor_kscurve_keyframe" id="ks_reactor_kscurve_addkeyframe_ks_reactor_kscurve_keyframe"></a>

Adds a keyframe to the curve. Places keyframe at correct position in the keyframe list based on time.

```csharp
public int AddKeyframe(ksCurve.Keyframe keyframe)
```

#### Parameters

`keyframe` [ksCurve](/reactor/api-reference/ks.reactor/ks.reactor.kscurve.md).[Keyframe](/reactor/api-reference/ks.reactor/ks.reactor.kscurve/ks.reactor.kscurve.keyframe.md)

Keyframe.

#### Returns

[int](https://learn.microsoft.com/dotnet/api/system.int32)

Index.

### Clear() <a href="#ks_reactor_kscurve_clear" id="ks_reactor_kscurve_clear"></a>

Removes all keyframes from the curve.

```csharp
public void Clear()
```

### Evaluate(float, EvalModes) <a href="#ks_reactor_kscurve_evaluate_system_single_ks_reactor_kscurve_evalmodes" id="ks_reactor_kscurve_evaluate_system_single_ks_reactor_kscurve_evalmodes"></a>

Gets the curve value at a specific time.

```csharp
public float Evaluate(float time, ksCurve.EvalModes evalMode = EvalModes.Curve)
```

#### Parameters

`time` [float](https://learn.microsoft.com/dotnet/api/system.single)

Time.

`evalMode` [ksCurve](/reactor/api-reference/ks.reactor/ks.reactor.kscurve.md).[EvalModes](/reactor/api-reference/ks.reactor/ks.reactor.kscurve/ks.reactor.kscurve.evalmodes.md)

Evaluation mode (Default EvalModes.Curve).

#### Returns

[float](https://learn.microsoft.com/dotnet/api/system.single)

Curve value.

### RemoveKeyframe(int) <a href="#ks_reactor_kscurve_removekeyframe_system_int32" id="ks_reactor_kscurve_removekeyframe_system_int32"></a>

Removes a keyframe from the curve.

```csharp
public void RemoveKeyframe(int index)
```

#### Parameters

`index` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Keyframe index.
