View Full Version : how to do the pen effect in this site

12-18-2006, 06:39 AM
can any one tell me how to guide the cursor to write the text effect that is done in this site

notice that the pen is automatically dragged from the position of the cursor to the place where the animation is to be performed...
please if anyone knows how the scripting is done tell me how.........

12-18-2006, 02:24 PM
The only part that I personally couldn't write off the top of my head would be the script behind the drawing api. It is just drawing lines, but it's beyond anything I have tried with it yet.

Regardless of that though, the part that you are asking about is easy enough. The pen is just following the x and ymouse when you are in control of it. When you load a page that uses it for animation, it just dumps the mouse script, and tweens the pen between where it is and where it needs to be.

It would pretty much just be:

On release - change pages
On page load - get the x/y of the mouse/pen.
On enter frame - shrink the difference between the x/y of the mouse at click time, and the x/y of the pen in it's start frame, untill they match.
At the end of the animation, trigger the return trip.

12-18-2006, 11:30 PM
I worked on this a while ago, and came out with this:
versionOne (http://casual-donut.batcave.net/pencil.zip)
and this:
versionTwo (http://casual-donut.batcave.net/pencilv2.zip)

They both work... I think.

12-19-2006, 07:41 AM
well as a mattter of fact those links to ur files are not working properly so i would be grateful if u send me those files as attachment in my hotmail..

I have already added u in msn...please accept the add invitation........