[Jitter, Javascript] Examples of jitter geometry in v8 or just using Jitter3dUtilsInterface in v8?

weuoimi 's icon

Hello, I am working on a project using mostly v8 and dicts which requires a lot of directed movement of objects. I want to create javascript classes that represent certain gridshapes and move them with certain speed and direction according to information provided in dictionary. I want to get familiar with some examples of how you can control the movement of figures in v8 javascript api, i guess you can use some of Jitter3dUtilsInterface functions for that. For example, if i understand it right, i can represent some gridshape as follows:

class Impulse {
    constructor(startVertex, impulsePower, maxTimeInMs) {
        this.currentVertex = startVertex; // Initialize with start vertex
        this.impulsePower = impulsePower;
        this.maxTimeInMs = maxTimeInMs;

        // Visual representation
        this.objectRepresentation = new JitterObject("jit.gl.gridshape");
        this.objectRepresentation.shape = "sphere";
        this.objectRepresentation.scale = [0.2, 0.2, 0.2];
        this.objectRepresentation.color = [Math.random(), Math.random(), Math.random(), 1.0];
        this.objectRepresentation.position = graph[startVertex]?.coordinates || [0, 0, 0]; // Position at startVertex
    }
// class methods
}

now i need to come up how to move them with certain speed etc.

any suggestions are appreciated, thanks in advance

Rob Ramirez's icon

search the max file browser for js.anim.drive.maxpat, a potentially helpful example patch for this task.

weuoimi 's icon

found it, thanks a lot!