Slowing down interpolation in ProScene
in
Contributed Library Questions
•
2 years ago
Hi,
I've been implementing the ridiculously awesome ProScene into one of my projects, but I've hit a stumbling block. I have a large scene, in which i want the camera to move between two keyframes a straight line. ProScene allows me to do this very easily, I just hit CTRL+1 where I the path to start and again where I want it to end. that bit works fine!
However, I can't control the speed at which the camera interpolates between the two keyframes. I've tried to implement
setInterpolationSpeed() but the way I've done it isn't attaching to the pre-defined interpolaters/cameras assigned to the keys 1-5 which I'm using.
Here is my code, can anyone give me direction on this?
thanks
Jim
- import remixlab.proscene.*;
- import javax.media.opengl.*;
- import codeanticode.glgraphics.*;
- Scene scene;
- KeyFrameInterpolator kfi;
- GLModel grid;
- void setup() {
- size(screen.width-100, screen.height-100, GLConstants.GLGRAPHICS);
- //Scene instantiation
- scene = new Scene(this);
- scene.setAxisIsDrawn(false);
- scene.setGridIsDrawn(false);
- scene.setRadius(15000);
- scene.camera().showEntireScene();
- //try to change the the speed of interpolation
- kfi = new KeyFrameInterpolator(this);
- kfi.setInterpolationSpeed(100.0f);
- //create Grid GLmodel
- drawgrid(85,100,20);
- }
- void draw()
- {
- GLGraphics renderer = (GLGraphics)g;
- renderer.beginGL();
- grid.render();
- renderer.endGL();
- }
- void drawgrid(float spacing, int gridsize, float gridStroke)
- {
- int gridverts = gridsize*4;
- grid = new GLModel(this, gridverts+4, LINES, GLModel.STATIC);
- grid.initColors();
- grid.beginUpdateVertices();
- for (int i = 0; i < gridverts+4; i=i+4)
- {
- grid.updateVertex(i,-(gridverts*(spacing/2)), (i*spacing)-((gridverts/2)*spacing), 0);
- grid.updateVertex(i+1,(gridverts*(spacing/2)), (i*spacing)-((gridverts/2)*spacing), 0);
- grid.updateVertex(i+2,(i*spacing)-((gridverts/2)*spacing),-(gridverts*(spacing/2)), 0);
- grid.updateVertex(i+3,(i*spacing)-((gridverts/2)*spacing),(gridverts*(spacing/2)), 0);
- }
- grid.endUpdateVertices();
- grid.beginUpdateColors();
- for (int i = 0; i < gridverts+4; i=i+4)
- {
- if (i@ == 0)
- {
- grid.updateColor(i, 255, 255, 255, gridStroke+30);
- grid.updateColor(i+1, 255, 255, 255, gridStroke+30);
- grid.updateColor(i+2, 255, 255, 255, gridStroke+30);
- grid.updateColor(i+3, 255, 255, 255, gridStroke+30);
- }
- else if(i == 0)
- {
- grid.updateColor(i, 255, 255, 255, gridStroke+15);
- grid.updateColor(i+1, 255, 255, 255, gridStroke+15);
- grid.updateColor(i+2, 255, 255, 255, gridStroke+15);
- grid.updateColor(i+3, 255, 255, 255, gridStroke+15);
- }
- else
- {
- grid.updateColor(i, 255, 255, 255, gridStroke);
- grid.updateColor(i+1, 255, 255, 255, gridStroke);
- grid.updateColor(i+2, 255, 255, 255, gridStroke);
- grid.updateColor(i+3, 255, 255, 255, gridStroke);
- }
- }
- grid.endUpdateColors();
- }
1