From 877f926009017405943d812720feb91b9f4deb91 Mon Sep 17 00:00:00 2001 From: katowulf Date: Wed, 15 Aug 2012 15:34:56 -0700 Subject: [PATCH 1/4] fixed seconds and minutes hands seconds and minutes hands were getting "stuck" at the top (i.e. at 60) for a second/minute respectively, because when they are actually zero, a line of code sets them to the max (60) where they animate but go nowhere. Particularly bad for the minutes, which bounce 60 times back to 60. --- .idea/.name | 1 + .idea/encodings.xml | 5 + .idea/misc.xml | 25 ++++ .idea/modules.xml | 9 ++ .idea/raphaeljs.com.iml | 9 ++ .idea/scopes/scope_settings.xml | 5 + .idea/vcs.xml | 7 ++ .idea/workspace.xml | 214 ++++++++++++++++++++++++++++++++ polar-clock.html | 5 +- 9 files changed, 279 insertions(+), 1 deletion(-) create mode 100644 .idea/.name create mode 100644 .idea/encodings.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/raphaeljs.com.iml create mode 100644 .idea/scopes/scope_settings.xml create mode 100644 .idea/vcs.xml create mode 100644 .idea/workspace.xml diff --git a/.idea/.name b/.idea/.name new file mode 100644 index 0000000..16c6b11 --- /dev/null +++ b/.idea/.name @@ -0,0 +1 @@ +raphaeljs.com \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 0000000..e206d70 --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..7e6685a --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,25 @@ + + + + jar:file:\C:\Program Files\JetBrains\PhpStorm 121.62\lib\webide.jar!\resources\html5-schema\html5.rnc + + + + + + diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..6907844 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/.idea/raphaeljs.com.iml b/.idea/raphaeljs.com.iml new file mode 100644 index 0000000..6b8184f --- /dev/null +++ b/.idea/raphaeljs.com.iml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/.idea/scopes/scope_settings.xml b/.idea/scopes/scope_settings.xml new file mode 100644 index 0000000..922003b --- /dev/null +++ b/.idea/scopes/scope_settings.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..c80f219 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 0000000..2bc1942 --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,214 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1345068853549 + 1345068853549 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/polar-clock.html b/polar-clock.html index 1b5afab..2dcb9bc 100644 --- a/polar-clock.html +++ b/polar-clock.html @@ -68,7 +68,10 @@ hand.animate({arc: [value, total, R]}, 900, ">"); } else { if (!value || value == total) { - value = total; + // caused minute/second hands to bounce when they reset to 0 + // because they set to 60, where they wobbles for a whole second/minute respectively + // all others are properly adjusted below inside the anonymous init function + // value = total; hand.animate({arc: [value, total, R]}, 750, "bounce", function () { hand.attr({arc: [0, total, R]}); }); From 0ca9c359b1fdaa84640165e8f2a544d4faba7ca3 Mon Sep 17 00:00:00 2001 From: katowulf Date: Wed, 15 Aug 2012 15:38:58 -0700 Subject: [PATCH 2/4] Revert "fixed seconds and minutes hands" This reverts commit 877f926009017405943d812720feb91b9f4deb91. --- .idea/.name | 1 - .idea/encodings.xml | 5 - .idea/misc.xml | 25 ---- .idea/modules.xml | 9 -- .idea/raphaeljs.com.iml | 9 -- .idea/scopes/scope_settings.xml | 5 - .idea/vcs.xml | 7 -- .idea/workspace.xml | 214 -------------------------------- polar-clock.html | 5 +- 9 files changed, 1 insertion(+), 279 deletions(-) delete mode 100644 .idea/.name delete mode 100644 .idea/encodings.xml delete mode 100644 .idea/misc.xml delete mode 100644 .idea/modules.xml delete mode 100644 .idea/raphaeljs.com.iml delete mode 100644 .idea/scopes/scope_settings.xml delete mode 100644 .idea/vcs.xml delete mode 100644 .idea/workspace.xml diff --git a/.idea/.name b/.idea/.name deleted file mode 100644 index 16c6b11..0000000 --- a/.idea/.name +++ /dev/null @@ -1 +0,0 @@ -raphaeljs.com \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml deleted file mode 100644 index e206d70..0000000 --- a/.idea/encodings.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index 7e6685a..0000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - jar:file:\C:\Program Files\JetBrains\PhpStorm 121.62\lib\webide.jar!\resources\html5-schema\html5.rnc - - - - - - diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index 6907844..0000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/.idea/raphaeljs.com.iml b/.idea/raphaeljs.com.iml deleted file mode 100644 index 6b8184f..0000000 --- a/.idea/raphaeljs.com.iml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/.idea/scopes/scope_settings.xml b/.idea/scopes/scope_settings.xml deleted file mode 100644 index 922003b..0000000 --- a/.idea/scopes/scope_settings.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index c80f219..0000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/.idea/workspace.xml b/.idea/workspace.xml deleted file mode 100644 index 2bc1942..0000000 --- a/.idea/workspace.xml +++ /dev/null @@ -1,214 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1345068853549 - 1345068853549 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/polar-clock.html b/polar-clock.html index 2dcb9bc..1b5afab 100644 --- a/polar-clock.html +++ b/polar-clock.html @@ -68,10 +68,7 @@ hand.animate({arc: [value, total, R]}, 900, ">"); } else { if (!value || value == total) { - // caused minute/second hands to bounce when they reset to 0 - // because they set to 60, where they wobbles for a whole second/minute respectively - // all others are properly adjusted below inside the anonymous init function - // value = total; + value = total; hand.animate({arc: [value, total, R]}, 750, "bounce", function () { hand.attr({arc: [0, total, R]}); }); From 0809f7064bfbde5eeb829b3f1feee1aa7eba4d71 Mon Sep 17 00:00:00 2001 From: katowulf Date: Wed, 15 Aug 2012 15:42:57 -0700 Subject: [PATCH 3/4] fixed minute/second hands This line caused minute/second hands to bounce when they reset to 0 because they set to 60, where they wobbled for a whole second/minute respectively All others are properly adjusted below inside the anonymous init function so this was completely unnecessary --- polar-clock.html | 1 - 1 file changed, 1 deletion(-) diff --git a/polar-clock.html b/polar-clock.html index 1b5afab..eb3b2c3 100644 --- a/polar-clock.html +++ b/polar-clock.html @@ -68,7 +68,6 @@ hand.animate({arc: [value, total, R]}, 900, ">"); } else { if (!value || value == total) { - value = total; hand.animate({arc: [value, total, R]}, 750, "bounce", function () { hand.attr({arc: [0, total, R]}); }); From 70b2f44ab48c0a12c4eae1b3f17e63b798557e2d Mon Sep 17 00:00:00 2001 From: katowulf Date: Wed, 15 Aug 2012 16:11:18 -0700 Subject: [PATCH 4/4] fix hours/days/months Fixes bouncy behavior in hours/days/months when they are at max values Tested on all overlapping variations: 11:59:59p on 12/31 to 01:01:01a and also 11:59a to 12:01p Tested in IE, Chrome, and Firefox (latest) --- polar-clock.html | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/polar-clock.html b/polar-clock.html index eb3b2c3..6fb624d 100644 --- a/polar-clock.html +++ b/polar-clock.html @@ -56,21 +56,12 @@ html[5].style.color = Raphael.hsb2rgb(15 / 200, 1, .75).hex; function updateVal(value, total, R, hand, id) { - if (total == 31) { // month - var d = new Date; - d.setDate(1); - d.setMonth(d.getMonth() + 1); - d.setDate(-1); - total = d.getDate(); - } var color = "hsb(".concat(Math.round(R) / 200, ",", value / total, ", .75)"); if (init) { hand.animate({arc: [value, total, R]}, 900, ">"); } else { if (!value || value == total) { - hand.animate({arc: [value, total, R]}, 750, "bounce", function () { - hand.attr({arc: [0, total, R]}); - }); + hand.animate({arc: [value, total, R]}, 750, "bounce"); } else { hand.animate({arc: [value, total, R]}, 750, "elastic"); } @@ -102,7 +93,7 @@ (function () { var d = new Date, am = (d.getHours() < 12), - h = d.getHours() % 12 || 12; + h = Math.round(d.getHours() % 12) || 12; updateVal(d.getSeconds(), 60, 200, sec, 2); updateVal(d.getMinutes(), 60, 160, min, 1); updateVal(h, 12, 120, hor, 0);