Skip to content
This repository has been archived by the owner on Jan 30, 2024. It is now read-only.

Parametric Equation Effects

Nathan Wolf edited this page Apr 13, 2016 · 4 revisions

Curve through 3D space

EffectLib is capable of parsing parametric equations to create a curve through 3D space.

An example config of a rising swirl is shown below:

        effectlib: 
            class: EquationEffect
            xEquation: "sin(0.3141 * t)"
            yEquation: "0.5t"
            zEquation: "cos(0.3141 * t)"
            duration: 10000
            particles: 20
            cycle: true

"t" is the variable for the steps (by default, 1 step per minecraft tick). It starts at 0 and increments until hitting the value of particles (20). If cycle is set to true, the effect sets t back to 0 and starts the effect over and over until hitting the duration time.

Per each tick, the values of x, y, and z are determined through the three equations, producing a curve in 3D minecraft space.

Parametric Surface in 3D Space

Continuing on from a simple curve in 3D space, Effectlib is also capable of generating a "surface". An example config of a cylinder is shown below:

        effectlib: 
            class: EquationEffect
            xEquation: 0
            yEquation: "0.5t"
            zEquation: 0
            duration: 10000
            particles: 10
            cycle: true
            x2Equation: "sin((0.3141) * t2)"
            y2Equation: 0
            z2Equation: "cos((0.3141) * t2)"
            particles2: 20

Similar to a 3D parametric curve, the surface equations first starts off with a curve in 3D space, in this example, the initial curve is a straight line rising in the y direction at a rate of 0.5 * t. Per every step of t, the second set of equations run it's entire course. In this example, the second set of equations create a circle with 20 particles. t2 is the second variable which acts exactly like variable t, except that it runs it's course in each step of t. The second set of equations are also capable of referencing t as a constant, this is helpful for effects that require changes over time.

Each step of the first set of equations are considered iterations while the second set of equations are considered sub-iterations.

Parameters:

  • particles - The limit for t to 'count' up to.
  • particles2 - Same as particles except for the second set of parametric surfaces equations.
  • cycle - Whether or not to loop the effect when t reaches the particles limit.
  • xEquation - The equation for the first x variable
  • yEquation - The equation for the first y variable
  • zEquation - The equation for the first z variable
  • x2Equation - The equation for the second x variable
  • y2Equation - The equation for the second y variable
  • z2Equation - The equation for the second z variable
  • duration - Time (in ms) for effect to last

Variables:

  • t - Iterations
  • t2 - Sub-iterations
  • p - The value of particles
  • p2 - The value of particles2

Helpful Resources:

  • Desmos - A helpful online grapher
  • exp4j - The equation parser used, contains the different functions capable.