Jump to content
Developer Wiki and Function Reference Links ×

vectorscript 2d animation


P Bartoli

Recommended Posts

I'm currently drawing a bicycle in VW, and would like to "animate" the movement of legs and crank somehow like what's being done with the "cam.sta" file supplied with VW.

I've never worked with Vectorscript, so I don't know how it works.

Can Vectorscript be used to make some kind of controllable/customizable step-by-step 2d vector animation?

BTW, I'm not looking for 3d animation, and I'd like to make it within VW... if possible!

Thanks

Link to comment

Hi Paolo,

Yes it can be done, but there is no easy 3D motion modeling platform in VW to work from. Depending on the level of accuracy you want to achieve will determine the amount of work you will need to do.

It would be possible to describe the relation of thigh, knee, leg, ankle and foot to each other as a function of pedal rotation, but that would be the most difficult. If you go this route, the vector math in VS is up to the task.

If you are not doing a physics demo, then I would consider having 3, 4 or 5 legs drawn in different positions and different classes and toggling the class visibility in sequence to simulate cyclic motion. I'm not sure what kind of rendering problems you may run into, but perhaps if you don't cast shadows it might work. Others will have to help you when you get that far.

Have fun,

Raymond

Link to comment

No 3D? Your job just got easier. What do you want to use to control the leg? Pedal position? It would be the easiest variable to base everything on. If knee and ankle are circles, then thigh, leg and foot can be polys (preferably all saved as symbols). Their positions and angles can be calculated to correspond to formulae based on pedal position. This is not too difficult, just tedious. Tom Urie's code for the Rotating Cam should provide a good example of what's needed. Find it in the VW application folder under "\Extras\Goodies\Rotating Cam.sta"

Raymond

Link to comment

quote:

Originally posted by MullinRJ:

Tom Urie's code for the Rotating Cam should provide a good example of what's needed. Find it in the VW application folder under "\Extras\Goodies\Rotating Cam.sta"

Raymond,

I tried to open the "rotating cam.sta" file with a text editor. It comes with some garbage inside.

Can I just modify the readable text and save it with a new name? Does it work or should I follow a different path?

Link to comment
  • 1 month later...

The rotating cam example mentioned above is pretty intricate. I think I've extracted the core of the method in the procedure below. It puts a box on the display and spins it around an origin. Hope it helps someone get started. I spent a couple days trying to figure it out.

****************************************

Procedure Rotate_a_box;

VAR

angle: REAL; { angle rotation per REPEAT cycle }

recH: HANDLE; { rectangle handle }

Xcenter,Ycenter : REAL; { rotation origin }

xM,yM : REAL; {required for MouseDown function}

cCode : INTEGER ; {required for keyDown function}

BEGIN

angle:=.2; { set rotation angle; size sets percieved speed of rotation }

Xcenter := 0 ; {set an arbitrary rotation origin}

Ycenter := 0 ;

UnDoOff; { turn off UNDO, not sure why, maybe for faster operation? }

Rect(0,0,.5,1); {draw an arbitrary size rectangle and get its handle}

recH := LNewObj;

DSelectAll; { Unselect the rectangle to remove the screen markers }

REPEAT {rotate rectangle by 'angle' degrees until press key or mouse button}

HRotate(recH , Xcenter , Ycenter , angle );

ReDraw; { refresh screen }

UNTIL KeyDown( cCode ) | MouseDown(xM,yM); { check for key or mouse button }

END;

RUN(Rotate_a_Box);

  • Like 1
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...