Skip to content

V2Animation

Aeroluna edited this page Jul 12, 2022 · 1 revision

You can find the script and map used to generate all the examples in the documentation here.

Event Types

Tracks

Tracks are a powerful tool integrated by Heck that allow you to group objects together and control them.

_track is a string property in the _customData of the object you want to give said track to. It can be placed on any object in the _obstacles or _notes arrays.

This example will add the note to the ExampleTrack track. These tracks are a way of identifying which objects that the custom events should affect.

"_notes": [
  {
    "_time": 8.0,
    "_lineIndex": 2,
    "_lineLayer": 0,
    "_type": 1,
    "_cutDirection": 1,
    "_customData": {
      "_track": "ExampleTrack"
    }
  }
]

Point Definitions

Point definitions are used to describe what happens over the course of an animation, they are used slightly differently for different properties. They consist of a collection of points over time.

Here is an example of one being defined to animate _position: (See: AnimateTrack)

{
  "_time": 3.0,
  "_type": "AnimateTrack",
  "_data": {
    "_track": "ZigZagTrack",
    "_duration": 1,
    "_position": [
      [0, 0, 0, 0],
      [1, 0, 0, 0.25],
      [-1, 0, 0, 0.75],
      [0, 0, 0, 1]
    ]
  }
}

A point definition usually follows the pattern of [data, time, "optional easing", "optional spline"],

  • Data can be multiple points of data, this part of a point varies per property,
  • Time is a float from 0 - 1, points must be ordered by their time values
  • "optional easing" is an optional field, with any easing from easings.net (with the addition of easeLinear and easeStep). This is the easing that will be used in the interpolation from the last point to the one with the easing defined on it.
  • "optional spline" is an optional field, with any spline implemented, currently only "splineCatmullRom". It acts like easings, affecting the movement from the last point to the one with the spline on it. Currently only positions and rotations support splines.
// Example of splines and easings being used
"_position": [
  [0, 0, 0, 0],
  [1, 5, 0, 0.5, "easeInOutSine"],
  [6, 0, 0, 0.75, "splineCatmullRom"],
  [5, -2, -1, 1, "easeOutCubic", "splineCatmullRom"]
]

Point definitions can also be defined inside the _pointDefinitions field of your _customData, any point definition defined here can be called via their _name when one would fit.

{
  "_version": "2.0.0",
  "_customData": {
    "_pointDefinitions": [
      {
        "_name": "ZigZagPosition",
        "_points":[
          [0, 0, 0, 0],
          [1, 0, 0, 0.25],
          [-1, 0, 0, 0.75],
          [0, 0, 0, 1]
        ]
      }
    ],
    "_customEvents": [
      {
        "_time": 3.0,
        "_type": "AnimateTrack",
        "_data": {
          "_track": "ZigZagTrack",
          "_duration": 1,
          "_position": "ZigZagPosition"
        }
      }
    ]
  },
  "_events": [],
  "_notes": [],
  "_obstacles": []
}

When a point definition is used, input time values outside of the defined points' times will automatically clamp to the first and last values respectively.

// The scale of this note will be 2x up until 0.5, after which it will begin scaling down to 1x until 0.8, after which the note will remain at 1x
{
  "_time": 2,
  "_lineIndex": 1,
  "_lineLayer": 0,
  "_type": 1,
  "_cutDirection": 0,
  "_customData": {
    "_animation": {
      "_scale": [
        [2, 2, 2, 0.5],
        [1, 1, 1, 0.8]
      ]
    }
  }
}

If you only require one element in your point definition, instead of a list of points, your point definition can just be your point.

// These are equivalent
"_position": [[245, 23, 54, 0]]
"_position": [245, 23, 54]

Individual Path Animation

_animation is an object that can be put in the _customData of any object in the _obstacles or _notes array.

This will instantly apply a path animation to the object. See AssignPathAnimation. Will overwrite any path animation assigned through AssignPathAnimation

// Example
{
  "_time": 90,
  "_lineIndex": 1,
  "_lineLayer": 0,
  "_type": 0,
  "_cutDirection": 1,
  "_customData": {
    "_animation": {
      "_position": [
        [0, 40, 0, 0],
        [0, 0, 0, 0.2]
      ]
    }
  }
}

Events

AnimateTrack

{
  "_time": float, // Time in beats.
  "_type": "AnimateTrack",
  "_data": {
    "_track": string, // The track you want to animate.
    "_duration": float, // The length of the event in beats (defaults to 0).
    "_easing": string, // An easing for the animation to follow (defaults to easeLinear).
    "_property": point definition // The property you want to animate.
  }
}

Animate track will animate the properties of everything on the track individually at the same time. The animation will go over the point definition over the course of _duration.

Attempting to animate a property which is already being animated will stop the overwritten AnimateTrack.

However, multiple AnimateTrack events may animate separate properties at the same time, i.e. one AnimateTrack could animate position over 10 beats while another AnimateTrack animates rotation over 5 beats.

Although not recommended, properties can be set to null to "erase" a track's property (This obviously cannot have a duration). This will return that property to as if it was never set at all. This is highly not recommended because it cannot update active objects and can instead be done by setting the property to a default point definition. i.e. [[0,0,0,0]]

Track Properties

// Example
// All the objects on ZigZagTrack will be offset 1 unit to the right, then offset 1 units to the left, and then finally centered.
{
  "_time": 3.0,
  "_type": "AnimateTrack",
  "_data": {
    "_track": "ZigZagTrack",
    "_duration": 10,
    "_position": [
      [0, 0, 0, 0],
      [1, 0, 0, 0.25],
      [-1, 0, 0, 0.75],
      [0, 0, 0, 1]
    ]
  }
}

AssignPathAnimation

{
  "_time": float, // Time in beats.
  "_type": "AssignPathAnimation",
  "_data": {
    "_track": string, // The track you want to animate.
    "_duration": float, // How long it takes to assign this path animation (defaults to 0).
    "_easing": string, // An easing for moving to the path animation (defaults to easeLinear).
    "_property": point definition // The property you want to assign the path to.
  }
}

AssignPathAnimation will assign a "path animation" to the notes.

In this case, the time value of the point definition is the point each object on the track is at in its individual life span.

Meaning a point with time 0 would be right when the object finishes jumping in, a point with time 0.5 would be when the object reaches the player, at 0.75, walls and notes will begin their despawn animation and start flying away very quickly, and 1 being right when the object despawns.

Note: Objects CANNOT be animated while they are in their jumping animation. During that time, they will instead strictly use the first point in the point definition.

Although not recommended, path properties can be set to null to "erase" a track's path property. This will return that path property to as if it was never set at all. It is highly not recommended because although usually you can interpolate from one path animation to another using _duration, you cannot interpolate from null.

Path Properties

Noodle Extensions

Chroma

// Example
// During their jump animation, the objects will be 40 units high. Once their jump animation is complete, the object will then start descending.
{
  "_time": 3.0,
  "_type": "AssignPathAnimation",
  "_data": {
    "_track": "DropNotes",
    "_position": [
      [0, 40, 0, 0],
      [0, 0, 0, 0.2],
    ]
  }
}

AssignTrackParent

{
  "_time": float, // Time in beats.
  "_type": "AssignTrackParent",
  "_data": {
    "_childrenTracks": [string], // Array of tracks to parent to _parentTrack.
    "_parentTrack": string // The track you want to animate.
    "_worldPositionStays": bool // Defaults to false if not set. See https://docs.unity3d.com/ScriptReference/Transform.SetParent.html
  }
}

AssignTrackParent will parent any number of children tracks to a single parent track.

Only transform properties animated with AnimateTrack will influence the parent. Those properties being:

AssignPlayerToTrack

{
  "_time": float, // Time in beats.
  "_type": "AssignPlayerToTrack",
  "_data": {
    "_track": string // The track you wish to assign the player to.
  }
}

AssignPlayerToTrack will assign the player object to the specified _track.

Only transform properties animated with AnimateTrack will influence the player. Those properties being:

IT IS HIGHLY RECOMMENDED TO HAVE A TRACK DEDICATED TO THE PLAYER, AND NOT USE EASINGS IN MOVEMENT.

This is VR, non-linear movement or any form of rotation can easily cause severe motion sickness. To clarify, it is very easy to make people motion sick with player tracks, please use them carefully and sparingly.

AssignFogTrack

{
  "_time": float, // Time in beats.
  "_type": "AssignFogTrack",
  "_data": {
    "_track": string // The track you wish to assign the fog to.
  }
}

AssignFogTrack will assign the fog to the specified _track. You can then animate the _attenuation, _offset, _startY, and _height properties to affect the fog. Demo.

Please do not roast me for the documentation for this event being a little lacking, its 'cause im lazy!