Keys and Curves

This document contains an overview of how to work with keys and curves within the Timeline editor in Blueprints.

Windows
MacOS
Linux

This document contains an overview of how to work with keys and curves within the Timeline editor in Blueprints.

Choose your implementation method:

Blueprints

C++

A Curve defines a track of interpolated points to evaluate over a given range. Curves can be vectors, floats, and colors. Each track can have any number of keys that define a time and value. The data can be interpolated between these keys to calculate the value at any point during the Timeline.

Working with Keys and Curves

In this example, you will create a Curve Float that defines a curve of interpolated float points to evaluate over a given range.

  1. In the editor, Create a new Actor Blueprint that contains a Timeline Component.

  2. Double-click your timeline component to open the Timeline Editor.

  3. Click the Add Float Track button to add a CurveFloat to your Timeline Component.

image alt text

Adding Keys

Keys are added by holding the Shift key and clicking on the gray bar, or by right clicking on the gray bar and selecting the action Add Key To CurveFloat from the drop down menu.

image alt text

Editing Keys

The time and value of the key can be set by clicking the key and entering the values into the time and value fields near the top of the track.

image alt text

Deleting Keys

Selected keys can be deleted by pressing the Delete key on the keyboard.

Moving Keys

To move a key along the timeline, select the key, then drag it. Multiple keys can be selected using the Ctrl key. Dragging horizontally will update the Time value of the key, while dragging vertically will update the Value.

Key Interpolation

By right-clicking a key, a drop down menu will appear for you to choose the interpolation type for that key.

image alt text

Key interpolation only affects the curve between the key you interpolate for and the next key after that. For example, with all other keys set to Linear, and the center key set to Cubic-Auto, the track will look similar to the image below.

image alt text

Available interpolation types are:

  • Auto

    image alt text

  • User

    image alt text

  • Break

    image alt text

  • Linear

    image alt text

  • Constant

    image alt text

External Curves

To the left of the main key area is a field where you can add an external curve asset from the Content Browser to that track.

image alt text

External Curve Icon

Description

image alt text

Use the curve selected in the Content Browser for this track.

image alt text

Browse in the Content Browser to select a curve for this track.

image alt text

Convert an imported external curve to an internal curve so that keys and curves can be edited.

You can also right-click any curve (with at least one key selected) and choose Create External Curve. This brings up a context window in which you can edit the path for where the curve asset will be saved. In doing this, you can then use this curve again on other timelines.

image alt text

A Curve (UCurveBase) defines a track of interpolated points to evaluate over a given range. Curves can be vectors, floats, and colors. Each track can have any number of keys that define a time and value. The data can be interpolated between these keys to calculate the value at any point during the Timeline.

Working with Keys and Curves

In this example, you will create a UCurveFloat that defines a curve of interpolated float points to evaluate over a given range.

To create and instantiate a UCurveFloat to a Timeline Component, follow the steps below:

  1. Create an Actor class that contains a UTimelineComponent.

    // Copyright 1998-2021 Epic Games, Inc. All Rights Reserved.
    
    #pragma once
    
    #include "CoreMinimal.h"
    #include "GameFramework/Actor.h"
    #include "Components/TimelineComponent.h"
    #include "MyActor.generated.h"
    
    UCLASS()
    class UTIMELINEKEYSCURVESEXAMPLE_API AMyActor : public AActor
    {
        GENERATED_BODY()
    
    public: 
        // Sets default values for this actor's properties
        AMyActor();
    
    protected:
        // Called when the game starts or when spawned
        virtual void BeginPlay() override;
        UPROPERTY(EditAnywhere, BlueprintReadWrite)
            UTimelineComponent* ExampleTimelineComp;
    
    public: 
        // Called every frame
        virtual void Tick(float DeltaTime) override;
    
    };

    For more detailed steps on how to create a UTimelineComponent, see Creating Timelines.

  2. From the class definition of your TimelineActor.h file, declare the following:

    public:
      UPROPERTY(EditAnywhere)
        UCurveFloat* ExampleTimelineCurve;
  3. Compile your code in the Unreal Editor.

  4. From the Content Browser, select Add/Import > Miscellaneous > Curve > CurveFloat, then name your CurveFloat Asset ExampleFloatTrack.

    image alt text

  5. Create a Blueprint class based on the Actor that contains your UTimelineComponent.

  6. Open the class defaults and assign your Example Timeline Curve with your ExampleFloat Track.

    image alt text

  7. Double-click your Example Float Track from the Content Browser to open the Timeline Editor.

Adding Keys

Keys are added by holding the Shift key and clicking on the gray bar, or by right clicking on the gray bar and selecting the action Add Key To CurveFloat from the drop down menu.

image alt text

Editing Keys

The time and value of the key can be set by clicking the key and entering the values into the time and value fields near the top of the track.

image alt text

Deleting Keys

Selected keys can be deleted by pressing the Delete key on the keyboard.

Moving Keys

To move a key along the timeline, select the key, then drag it. Multiple keys can be selected using the Ctrl key. Dragging horizontally will update the Time value of the key, while dragging vertically will update the Value.

Key Interpolation

By right-clicking a key, a drop down menu will appear for you to choose the interpolation type for that key.

image alt text

Key interpolation only affects the curve between the key you interpolate for and the next key after that. For example, with all other keys set to Linear, and the center key set to Cubic-Auto, the track will look similar to the image below.

image alt text

Available interpolation types are:

  • Auto

    image alt text

  • User

    image alt text

  • Break

    image alt text

  • Linear

    image alt text

  • Constant

    image alt text

External Curves

To the left of the main key area is a field where you can add an external curve asset from the Content Browser to that track.

image alt text

External Curve Icon

Description

image alt text

Use the curve selected in the Content Browser for this track.

image alt text

Browse in the Content Browser to select a curve for this track.

image alt text

Convert an imported external curve to an internal curve so that keys and curves can be edited.

You can also right-click any curve (with at least one key selected) and choose Create External Curve. This brings up a context window in which you can edit the path for where the curve asset will be saved. In doing this, you can then use this curve again on other timelines.

image alt text

Tags
Select Skin
Light
Dark
Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss

Welcome to the new Unreal Engine 4 Documentation site!

We're working on lots of new features including a feedback system so you can tell us how we are doing. It's not quite ready for use in the wild yet, so head over to the Documentation Feedback forum to tell us about this page or call out any issues you are encountering in the meantime.

We'll be sure to let you know when the new system is up and running.

Post Feedback