IE6 FIX
I was always missing the easy option to make simple gearwheels. So today i wrote a very simple implementation in Scriptographer.
Hopefully someone finds use for it as well ;)
Suggestions are welcome
http://fuqr.de/dump/gear.js
Hopefully someone finds use for it as well ;)
Suggestions are welcome
http://fuqr.de/dump/gear.js
IE6 FIX
Re: Gearwheels
From: chris(login vergessen)
Date: 19. August 2008, 10:36
From: chris(login vergessen)
Date: 19. August 2008, 10:36
Nice, what do you think about that? :
var numTeeth = 15;
var radius = numTeeth*Math.PI/2;
var thinning = 0.2;
var depth = 5;
function onMouseDrag(event){
var pt=event.point;
var pos= pt.subtract(path.bounds.center);
path.transform(new Matrix().translate(pos));
}
var numTeeth = 15;
var radius = numTeeth*Math.PI/2;
var thinning = 0.2;
var depth = 5;
function onMouseDrag(event){
var pt=event.point;
var pos= pt.subtract(path.bounds.center);
path.transform(new Matrix().translate(pos));
}
IE6 FIX
I modified your script (with chris' addition) to make a gear drawing tool - the gears are rotated to make it possible for the gears to actually turn (i.e. they don't overlap).
The overlap finding is done brute force - must be possible to do it with pure geometry, but this is a very quick try out..
Let me know if it works for you - I'm using a newer prerelease version of Scriptographer..
The overlap finding is done brute force - must be possible to do it with pure geometry, but this is a very quick try out..
Let me know if it works for you - I'm using a newer prerelease version of Scriptographer..
IE6 FIX
Neat :) I actually though about implementing that myself, but at the time the purpose of the script was just to create the outlines to later reuse them in a Flash animation.
Sadly in my version of ScriptoGrapher the gears are placed all over the place, not like in your screenshot.
But, if my assumptions are correct, you could just do something like this:
globalRotation += Math.PI * 2 / numTeeth;
gear.rotate( globalRotation );
Bot most likely that doesn't take the movement vector into account. If i could try with your version of ScriptoGrapher i could definitely fix up the code.
But it runs quite smooth right now anyway :) Good work :D
Sadly in my version of ScriptoGrapher the gears are placed all over the place, not like in your screenshot.
But, if my assumptions are correct, you could just do something like this:
globalRotation += Math.PI * 2 / numTeeth;
gear.rotate( globalRotation );
Bot most likely that doesn't take the movement vector into account. If i could try with your version of ScriptoGrapher i could definitely fix up the code.
But it runs quite smooth right now anyway :) Good work :D
IE6 FIX
Okay thats happening because the old version of scripto rotates around the 0,0 position - I've put in a small workaround in the script which moves the gears back to the right position, it should work now..
your solution for the rotation doesn't work - would need something with the movement vector indeed..
your solution for the rotation doesn't work - would need something with the movement vector indeed..
Scripts
13.10.08, 01:28
03.10.08, 00:01
18.09.08, 20:43
16.09.08, 21:36
14.09.08, 18:50
Posts
19.11.08, 18:10
18.11.08, 19:27
18.11.08, 19:07
18.11.08, 06:05
18.11.08, 03:30
Script of the Moment
Donation