1
0
mirror of https://github.com/wbbaddons/Tims-Chat.git synced 2024-12-22 21:40:08 +00:00

Now the fish won't swim out of the window

________
    /  Blubb \
    \___   __/
         v
><((((>
This commit is contained in:
max-m 2011-12-26 22:46:29 +01:00
parent cded6e79a3
commit cfae043ba4

View File

@ -135,15 +135,20 @@ TimWolla.WCF ?= {}
fish.appendTo $ 'body' fish.appendTo $ 'body'
new WCF.PeriodicalExecuter(() -> new WCF.PeriodicalExecuter(() ->
left = (Math.random() * 100 - 50) left = (Math.random() * 100 - 50)
top = (Math.random() * 100 - 50)
fish = $('#fish')
$('#fish').text('><((((°>') if (left > 0) left *= -1 if((fish.position().left + left) < (0 + fish.width()) or (fish.position().left + left) > ($(document).width() - fish.width()))
$('#fish').text('<°))))><') if (left < 0) top *= -1 if((fish.position().top + top) < (0 + fish.height()) or (fish.position().top + top) > ($(document).height() - fish.height()))
$('#fish').animate fish.text('><((((°>') if (left > 0)
top: '+=' + (Math.random() * 100 - 50) fish.text('<°))))><') if (left < 0)
fish.animate
top: '+=' + top
left: '+=' + left left: '+=' + left
, 1000 , 1000
, 3e3); , 1.5e3);
### ###
# Loads new messages. # Loads new messages.
### ###