Main
Vectors
Matrix
Matrix Manipulation
Transformation Matrices
Angles
Random
Bezier Curve
Equations
Path Movement
Color
Linear Interpolation
Derivatives
Collision Detection
Animation
Circle And Ellipse
Sequence
Combinatorics
Other

Ellipse Movement

import { ellipseMovement, Vector2 } from 'mz-math';

const center: Vector2 = [100, 100];
const radiansAngle = Math.PI/2; // Angle should be in the range [0, Math.PI]
const radius1 = 350;
const radius2 = 150;
const newPosition: Vector2 = ellipseMovement(center, radiansAngle, radius1, radius2);

Example

Ellipse movement after mouse

import { ellipseMovementAfterMouse, Vector2 } from 'mz-math';

const mouse = [evt.clientX, evt.clientY];
const center: Vector2 = [100, 100];
const radii = [250, 300];

const position: Vector2 = ellipseMovementAfterMouse(mouse, center, radii);