Skip to content

Commit 18e0db9

Browse files
author
dninosores
committed
README cleanup
1 parent dab5228 commit 18e0db9

File tree

4 files changed

+45
-36
lines changed

4 files changed

+45
-36
lines changed

README.md

Lines changed: 45 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,72 @@
11
# Unity Animation Modifiers
2-
Provides ways to use equations to change values in the Unity editor over time, similar to animation modifiers in Blender or scripting in AfterEffects.
3-
## Features
4-
5-
- Can affect any float value accessible in the Unity editor
6-
- Can either modify values by overwriting them or by non-destructively adding to them
7-
- Modifiers are applied after all other scripts, so they won't overwrite or be overwritten by changes that other scripts make
8-
- Support for Sine and Perlin Noise functions, as well as custom animation curves and written equations
9-
- Framework for creating your own custom modifiers
2+
Provides components that can use equations to control any value in the Unity editor without needing to write additional scripts. It works similarly to animation modifiers in Blender or expressions in AfterEffects.
3+
4+
## Feature Overview
5+
6+
The `Animation Modifier` component allows you add basic animation to your Unity scene without needing to write any extra scripts. Here's an example where a `Float Animation Modifier` is being used to animate the Y position of the transform it is attached to:
7+
8+
![](readme-assets/UnityAnimationModifiersBasicDemo.gif)
9+
10+
One of the most powerful features of Animation Modifiers is that they can be set to additive mode, which adds the animation over the current value instead of overwriting it. This allows animation modifiers to edit values that are being accessed by other scripts without conflict:
11+
12+
![](readme-assets/UnityAnimationModifiersAdditiveDemo.gif)
13+
14+
Lastly, animation modifiers take advantage of the [UnityValueAccessors](https://github.com/ollyisonit/UnityValueAccessors) library to allow you to dynamically select different attributes to control on-the-fly:
15+
16+
![](readme-assets/UnityAnimationModifiersAccessorDemo.gif)
1017

11-
## The Float Animation Modifier
18+
## Usage Guide
19+
20+
### The Float Animation Modifier
1221
In order to use an Animation Modifier, you need to attach a FloatAnimationModifier to an object in your scene. It will contain several fields:
1322

14-
- Sync On Awake: Should the time used in the modifier be synced with Time.realtimeSinceStartup?
15-
- Modifier Type: What type of modifier do you want to use to generate your value? The options are:
16-
- Noise: Generate values using a perlin noise function, which will give random values with smooth transitions between them
17-
- Sine: Generate values using a sine wave
18-
- Custom Curve: Generate values using an animation curve drawn in-editor
19-
- Custom Equation: Generate values using an equation you type into a text box
20-
- Custom: Use a modifier script that you wrote yourself
23+
- `Sync On Awake`: Should the time used in the modifier be synced with `Time.realtimeSinceStartup`?
24+
- `Modifier Type`: What type of modifier do you want to use to generate your value? The options are:
25+
- `Noise`: Generate values using a perlin noise function, which will give random values with smooth transitions between them
26+
- `Sine`: Generate values using a sine wave
27+
- `Custom Curve`: Generate values using an animation curve drawn in-editor
28+
- `Custom Equation`: Generate values using an equation you type into a text box
29+
- `Custom`: Use a modifier script that you wrote yourself
2130
22-
Depending on the type of modifier you pick, you will get slightly different settings. However, all modifiers share an 'Additive' tickbox, which lets you pick whether you want the value from the modifier to be added on top of the original value, and an 'Intensity' value, which the modified value is multiplied by before it is returned.
31+
Depending on the type of modifier you pick, you will get slightly different settings. However, all modifiers share an `Additive` tickbox, which lets you pick whether you want the value from the modifier to be added on top of the original value, and an `Intensity` value, which the modified value is multiplied by before it is returned.
2332
24-
All modifiers also share a 'Float Accessor' field, which allows you to select the value that you want to modify. [You can find more information on Accessors here.](https://github.com/ollyisonit/UnityValueAccessors)
33+
All modifiers also share a `Float Accessor` field, which allows you to select the value that you want to modify. [You can find more information on Accessors here.](https://github.com/ollyisonit/UnityValueAccessors)
2534

2635
### Periodic Settings
27-
Noise, Sine, and Custom Curve are all periodic modifiers, meaning that they can be scaled over time. When you have one of these modifiers selected, you will have access to the Periodic Settings menu, which contains four settings:
36+
`Noise`, `Sine`, and `Custom Curve` are all periodic modifiers, meaning that they can be scaled over time. When you have one of these modifiers selected, you will have access to the Periodic Settings menu, which contains four settings:
2837

29-
- Amplitude: The maximum value that the modifier can reach
30-
- Frequency: The speed at which the modified value changes (in Hz)
31-
- Phase shift: How much the modifier should be offset over time
32-
- Vertical shift: A constant value to be added to the modifier
38+
- `Amplitude`: The maximum value that the modifier can reach
39+
- `Frequency`: The speed at which the modified value changes (in Hz)
40+
- `Phase shift`: How much the modifier should be offset over time
41+
- `Vertical shift`: A constant value to be added to the modifier
3342

3443
### Custom Equations
3544
When using custom equations, you should type the equation you want to use without an '='. You can use "t" to refer to the time since the modifier was started in seconds. Some examples of equations that you could use are:
3645

37-
- t + 1
38-
- sin(t)
39-
- (10 * t) ^ 5
40-
- Noise(10,t) * 6
46+
- `t + 1`
47+
- `sin(t)`
48+
- `(10 * t) ^ 5`
49+
- `Noise(10,t) * 6`
4150

4251
The modifier uses the [mxparser](https://github.com/mariuszgromada/MathParser.org-mXparser) library to read equations, so any functions supported in that library will be supported here.
43-
Additionally, you can use Noise(seed, time) to generate random Perlin noise in the same way that the Noise modifier does.
52+
Additionally, you can use `Noise(seed, time)` to generate random Perlin noise in the same way that the Noise modifier does.
4453

45-
The 'Dynamic' tickbox below the equation textbox tells the program whether the equation should be re-parsed each time it is evaluated. This will probably slow down your game, so you should only ever check this box if you know you are going to be changing the equation while the game is running.
54+
The `Dynamic` tickbox below the equation textbox tells the program whether the equation should be re-parsed each time it is evaluated. This will probably slow down your game, so you should only ever check this box if you know you are going to be changing the equation while the game is running.
4655

47-
Custom equations also support the use of variables that reference other values in your scene. For example, you may want to include the x component of another object's transform in your equation. In order to do this, you can add a variable to the Variables array below the 'Dynamic' tickbox. Each variable has a name, which you should use to refer to it in your equation, and a FloatValueAccessor, which tells the variable where to get its value from.
56+
Custom equations also support the use of variables that reference other values in your scene. For example, you may want to include the x component of another object's transform in your equation. In order to do this, you can add a variable to the Variables array below the 'Dynamic' tickbox. Each variable has a name, which you should use to refer to it in your equation, and a `FloatValueAccessor`, which tells the variable where to get its value from.
4857

49-
## Creating your own modifiers
58+
### Creating your own modifiers
5059
If you want to create your own custom modifier, there are two routes you can take:
51-
### Custom Float Modifier
60+
#### Custom Float Modifier
5261
In order to create a custom modifier that works with float modifiers, you should create a script that extends the CustomFloatModifier class, attach that script to a GameObject in your scene, and reference that script on a FloatAnimationModifier that has been set to 'Custom' mode.
5362

54-
### Custom Modifiers for Other Data Types
55-
In order to create a modifier for a non-float value, you will need to extend the Modifier<T\> class. Make sure that you mark your class as Serializable or it won't show up in the Unity editor. Since Modifiers aren't MonoBehaviours, they cannot be attached to GameObjects as scripts. In order to actually use your modifier in your scene, you will need to extend the MonoAnimationModifier class, which acts as a MonoBehaviour wrapper that you can use to attach your modifier to GameObjects.
63+
#### Custom Modifiers for Other Data Types
64+
In order to create a modifier for a non-float value, you will need to extend the `Modifier<T>` class. Make sure that you mark your class as `Serializable` or it won't show up in the Unity editor. Since `Modifiers` aren't `MonoBehaviours`, they cannot be attached to GameObjects as scripts. In order to actually use your modifier in your scene, you will need to wrap it in a component by extending the `MonoAnimationModifier<T>` class, which acts as a `MonoBehaviour` wrapper that you can use to attach your modifier to `GameObjects`.
5665

5766
When creating custom modifiers, you will most likely find [Accessors](https://github.com/ollyisonit/UnityValueAccessors) useful for creating references to the values that you want to modify.
5867

5968
## Installation
60-
Download or clone this repository and place it in the Assets folder of your Unity project.
69+
[Download](https://github.com/ollyisonit/UnityAnimationModifiers/releases/latest) or clone this repository and place it in the Assets folder of your Unity project.
6170

62-
## Dependencies
71+
### Dependencies
6372
This library requires you to have the [UnityValueAccessors](https://github.com/ollyisonit/UnityValueAccessors) and [UnityEditorAttributes](https://github.com/ollyisonit/UnityEditorAttributes) libraries in your project Assets folder.
362 KB
Loading
438 KB
Loading
216 KB
Loading

0 commit comments

Comments
 (0)