fixed minute seconds hands bouncing at 60#1
Open
katowulf wants to merge 4 commits intoDmitryBaranovskiy:masterfrom
Open
fixed minute seconds hands bouncing at 60#1katowulf wants to merge 4 commits intoDmitryBaranovskiy:masterfrom
katowulf wants to merge 4 commits intoDmitryBaranovskiy:masterfrom
Conversation
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 reverts commit 877f926.
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)
Author
|
Also added a fix for the hours, which was reported in this issue on raphaeljs. |
|
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.