473,320 Members | 1,694 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Fish eyeball vector

I made a simple animated gif of a fish whose eyeball wiggles
a few loops upon any mouseover:

< img id="ppic" src="http://xxx.yyy.com/Nice_Fish.gif"
onMouseOver="document.images.ppic.src=document.ima ges.ppic.src" >

But what I'd really like to do is to turn the eyeball into a
floating sprite that follows the mouse....so the fish looks at
the mouse cursor, at whatever position the mouse happens to be,
upon mouseover.

You'd need to calculate a relative vector somehow, from the center
of the eyeball position to the current mouse position.
I think I remember how to do that from previous exmperiments
with OpenGL. In fact I think I know how to do the whole
thing with OpenGL, but I haven't got a clue how to do it with
javascript, in browser land.

Is this possible, with javascript?
How would I do it?
Jul 23 '05 #1
3 2477
wh*****@montana-riverboats.com (while_1) wrote in message news:<9b**************************@posting.google. com>...
I made a simple animated gif of a fish whose eyeball wiggles
a few loops upon any mouseover:

&lt; img id="ppic" src="http://xxx.yyy.com/Nice_Fish.gif"
onMouseOver="document.images.ppic.src=document.ima ges.ppic.src" &gt;

But what I'd really like to do is to turn the eyeball into a
floating sprite that follows the mouse....so the fish looks at
the mouse cursor, at whatever position the mouse happens to be,
upon mouseover.

You'd need to calculate a relative vector somehow, from the center
of the eyeball position to the current mouse position.
I think I remember how to do that from previous exmperiments
with OpenGL. In fact I think I know how to do the whole
thing with OpenGL, but I haven't got a clue how to do it with
javascript, in browser land.

Is this possible, with javascript?
How would I do it?


You can use the basic trig from these:

http://www.propix.hu

http://www.btinternet.com/~kurt.grig...owingeyes.html

http://www.btinternet.com/~kurt.grig...taticeyes.html

Tone.
Jul 23 '05 #2
....thank you!

Jul 23 '05 #3
Hi,
I would suggest having the eye in 8 positions, Up,Down,L,R,UpL,UpR,DownL,DownR
Then replace the image with each position according to the mouse position
You can sense the mouse position using onmousemove capture
like here http://www.caoxuan.com/cxk/webart/goodies/shyobj.html

Kien

wh*****@montana-riverboats.com (while_1) wrote in message news:<9b**************************@posting.google. com>...
I made a simple animated gif of a fish whose eyeball wiggles
a few loops upon any mouseover:

&lt; img id="ppic" src="http://xxx.yyy.com/Nice_Fish.gif"
onMouseOver="document.images.ppic.src=document.ima ges.ppic.src" &gt;

But what I'd really like to do is to turn the eyeball into a
floating sprite that follows the mouse....so the fish looks at
the mouse cursor, at whatever position the mouse happens to be,
upon mouseover.
.... Is this possible, with javascript?
How would I do it?

Jul 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

21
by: Leonardo | last post by:
I have the following associative array: $user=1; $user=1; $user=0; $user=1; $user=0; $user=1; $user=1;
9
by: {AGUT2}=IWIK= | last post by:
Hello all, It's my fisrt post here and I am feeling a little stupid here, so go easy.. :) (Oh, and I've spent _hours_ searching...) I am desperately trying to read in an ASCII...
9
by: luigi | last post by:
Hi, I am trying to speed up the perfomance of stl vector by allocating/deallocating blocks of memory manually. one version of the code crashes when I try to free the memory. The other version...
7
by: Forecast | last post by:
I run the following code in UNIX compiled by g++ 3.3.2 successfully. : // proj2.cc: returns a dynamic vector and prints out at main~~ : // : #include <iostream> : #include <vector> : : using...
34
by: Adam Hartshorne | last post by:
Hi All, I have the following problem, and I would be extremely grateful if somebody would be kind enough to suggest an efficient solution to it. I create an instance of a Class A, and...
10
by: Bob | last post by:
Here's what I have: void miniVector<T>::insertOrder(miniVector<T>& v,const T& item) { int i, j; T target; vSize += 1; T newVector; newVector=new T;
8
by: Ross A. Finlayson | last post by:
I'm trying to write some C code, but I want to use C++'s std::vector. Indeed, if the code is compiled as C++, I want the container to actually be std::vector, in this case of a collection of value...
1
by: Joe Strout | last post by:
Is there any Python-based fish simulation project? I've tried searching google and pypi, but no luck. No burning need, just seems like it'd be fun. Thanks, - Joe
0
by: Tim Chase | last post by:
Is there any Python-based fish simulation project? I've tried Without much detail on what you want to simulate... class Fish: LITTLE, HUGE = range(2) def __init__(self, name, size=None):...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.