Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed minute seconds hands bouncing at 60 #1

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

katowulf
Copy link

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.

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.
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
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)
@katowulf
Copy link
Author

Also added a fix for the hours, which was reported in this issue on raphaeljs.

@Krinkle
Copy link

Krinkle commented Dec 24, 2012

It happens on all up values:

/*! github.com/vesln/timekeeper */
var timekeeper=function(){function n(){return f+(o.now()-c)}function e(e,t,r,u,c,a,w){var l=arguments.length
if(this instanceof o){if(!l&&i)return i
if(!l&&f)return new o(n())
var p=1==l&&e+""===e?new o(o.parse(e)):l>=7?new o(e,t,r,u,c,a,w):l>=6?new o(e,t,r,u,c,a):l>=5?new o(e,t,r,u,c):l>=4?new o(e,t,r,u):l>=3?new o(e,t,r):l>=2?new o(e,t):l>=1?new o(e):new o
return p.constructor=o,p}return o.apply(this,arguments)}function t(){Date=e}function r(){Date=o}var o=Date,u={},i=null,f=null,c=null
return function(){for(var n in o)e[n]=o[n]}(),e.UTC=o.UTC,e.parse=o.parse,e.prototype=o.prototype,e.prototype.constructor=o,e.now=function(){return i?i.getTime():f?n():o.now()},u.freeze=function(n){t(),"object"!=typeof n&&(n=new o(n)),i=n},u.travel=function(n){t(),"object"!=typeof n&&(n=new o(n)),f=n.getTime(),c=o.now()},u.reset=function(){r(),i=null,c=null,f=null},u}();


timekeeper.travel(new Date('2007-12-30 12:00:00'));

This will show flickering hands for month, day, hour and minute.

As of writing the month hand, for example, is flickering: http://raphaeljs.com/polar-clock.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants