initial support for nanoseconds

This commit is contained in:
2023-01-23 20:51:03 -08:00
parent 9fcd64581d
commit cfc75c2ce7
4 changed files with 68 additions and 53 deletions

View File

@@ -3,7 +3,7 @@
archiveVersion = 1; archiveVersion = 1;
classes = { classes = {
}; };
objectVersion = 47; objectVersion = 56;
objects = { objects = {
/* Begin PBXBuildFile section */ /* Begin PBXBuildFile section */
@@ -17,7 +17,7 @@
/* End PBXBuildFile section */ /* End PBXBuildFile section */
/* Begin PBXFileReference section */ /* Begin PBXFileReference section */
3A40066818B53112005F43A6 /* Epoch Flip Clock.saver */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Epoch Flip Clock.saver"; sourceTree = BUILT_PRODUCTS_DIR; }; 3A40066818B53112005F43A6 /* Fast Epoch Flip Clock.saver */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Fast Epoch Flip Clock.saver"; sourceTree = BUILT_PRODUCTS_DIR; };
3A40066D18B53113005F43A6 /* ScreenSaver.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ScreenSaver.framework; path = System/Library/Frameworks/ScreenSaver.framework; sourceTree = SDKROOT; }; 3A40066D18B53113005F43A6 /* ScreenSaver.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ScreenSaver.framework; path = System/Library/Frameworks/ScreenSaver.framework; sourceTree = SDKROOT; };
3A40068218B53129005F43A6 /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = System/Library/Frameworks/WebKit.framework; sourceTree = SDKROOT; }; 3A40068218B53129005F43A6 /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = System/Library/Frameworks/WebKit.framework; sourceTree = SDKROOT; };
3A95A94B18EA12D30036779C /* EpochFlipClock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EpochFlipClock.h; sourceTree = SOURCE_ROOT; }; 3A95A94B18EA12D30036779C /* EpochFlipClock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EpochFlipClock.h; sourceTree = SOURCE_ROOT; };
@@ -56,7 +56,7 @@
3A40066918B53112005F43A6 /* Products */ = { 3A40066918B53112005F43A6 /* Products */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
3A40066818B53112005F43A6 /* Epoch Flip Clock.saver */, 3A40066818B53112005F43A6 /* Fast Epoch Flip Clock.saver */,
); );
name = Products; name = Products;
sourceTree = "<group>"; sourceTree = "<group>";
@@ -97,9 +97,9 @@
/* End PBXHeadersBuildPhase section */ /* End PBXHeadersBuildPhase section */
/* Begin PBXNativeTarget section */ /* Begin PBXNativeTarget section */
3A40066718B53112005F43A6 /* Epoch Flip Clock */ = { 3A40066718B53112005F43A6 /* Fast Epoch Flip Clock */ = {
isa = PBXNativeTarget; isa = PBXNativeTarget;
buildConfigurationList = 3A40067F18B53113005F43A6 /* Build configuration list for PBXNativeTarget "Epoch Flip Clock" */; buildConfigurationList = 3A40067F18B53113005F43A6 /* Build configuration list for PBXNativeTarget "Fast Epoch Flip Clock" */;
buildPhases = ( buildPhases = (
3A40066218B53112005F43A6 /* Sources */, 3A40066218B53112005F43A6 /* Sources */,
3A40066318B53112005F43A6 /* Frameworks */, 3A40066318B53112005F43A6 /* Frameworks */,
@@ -111,9 +111,9 @@
); );
dependencies = ( dependencies = (
); );
name = "Epoch Flip Clock"; name = "Fast Epoch Flip Clock";
productName = "Epoch Flip Clock"; productName = "Epoch Flip Clock";
productReference = 3A40066818B53112005F43A6 /* Epoch Flip Clock.saver */; productReference = 3A40066818B53112005F43A6 /* Fast Epoch Flip Clock.saver */;
productType = "com.apple.product-type.bundle"; productType = "com.apple.product-type.bundle";
}; };
/* End PBXNativeTarget section */ /* End PBXNativeTarget section */
@@ -122,27 +122,23 @@
3A40065E18B53112005F43A6 /* Project object */ = { 3A40065E18B53112005F43A6 /* Project object */ = {
isa = PBXProject; isa = PBXProject;
attributes = { attributes = {
LastUpgradeCheck = 0920; LastUpgradeCheck = 1420;
ORGANIZATIONNAME = chrstphrknwtn; ORGANIZATIONNAME = smparkin;
TargetAttributes = {
3A40066718B53112005F43A6 = {
ProvisioningStyle = Manual;
}; };
}; buildConfigurationList = 3A40066118B53112005F43A6 /* Build configuration list for PBXProject "Fast Epoch Flip Clock" */;
}; compatibilityVersion = "Xcode 14.0";
buildConfigurationList = 3A40066118B53112005F43A6 /* Build configuration list for PBXProject "Epoch Flip Clock" */; developmentRegion = en;
compatibilityVersion = "Xcode 6.3";
developmentRegion = English;
hasScannedForEncodings = 0; hasScannedForEncodings = 0;
knownRegions = ( knownRegions = (
en, en,
Base,
); );
mainGroup = 3A40065D18B53112005F43A6; mainGroup = 3A40065D18B53112005F43A6;
productRefGroup = 3A40066918B53112005F43A6 /* Products */; productRefGroup = 3A40066918B53112005F43A6 /* Products */;
projectDirPath = ""; projectDirPath = "";
projectRoot = ""; projectRoot = "";
targets = ( targets = (
3A40066718B53112005F43A6 /* Epoch Flip Clock */, 3A40066718B53112005F43A6 /* Fast Epoch Flip Clock */,
); );
}; };
/* End PBXProject section */ /* End PBXProject section */
@@ -185,6 +181,7 @@
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO; ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++"; CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_OBJC_ARC = YES; CLANG_ENABLE_OBJC_ARC = YES;
@@ -192,14 +189,17 @@
CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES; CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES;
@@ -208,6 +208,7 @@
CODE_SIGN_IDENTITY = ""; CODE_SIGN_IDENTITY = "";
CODE_SIGN_STYLE = Manual; CODE_SIGN_STYLE = Manual;
COPY_PHASE_STRIP = YES; COPY_PHASE_STRIP = YES;
DEAD_CODE_STRIPPING = YES;
DEBUG_INFORMATION_FORMAT = dwarf; DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_NS_ASSERTIONS = YES; ENABLE_NS_ASSERTIONS = YES;
ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_STRICT_OBJC_MSGSEND = YES;
@@ -238,6 +239,7 @@
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO; ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++"; CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_OBJC_ARC = YES; CLANG_ENABLE_OBJC_ARC = YES;
@@ -245,14 +247,17 @@
CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES; CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES;
@@ -261,6 +266,7 @@
CODE_SIGN_IDENTITY = ""; CODE_SIGN_IDENTITY = "";
CODE_SIGN_STYLE = Manual; CODE_SIGN_STYLE = Manual;
COPY_PHASE_STRIP = YES; COPY_PHASE_STRIP = YES;
DEAD_CODE_STRIPPING = YES;
DEBUG_INFORMATION_FORMAT = dwarf; DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_NS_ASSERTIONS = YES; ENABLE_NS_ASSERTIONS = YES;
ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_STRICT_OBJC_MSGSEND = YES;
@@ -284,13 +290,20 @@
3A40068018B53113005F43A6 /* Debug */ = { 3A40068018B53113005F43A6 /* Debug */ = {
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
CODE_SIGN_IDENTITY = ""; CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES; COMBINE_HIDPI_IMAGES = YES;
DEVELOPMENT_TEAM = ""; CURRENT_PROJECT_VERSION = 1;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_TEAM = QR825BQSTL;
INFOPLIST_FILE = Info.plist; INFOPLIST_FILE = Info.plist;
INSTALL_PATH = "$(HOME)/Library/Screen Savers"; INSTALL_PATH = "$(HOME)/Library/Screen Savers";
PRODUCT_BUNDLE_IDENTIFIER = "com.chrstphrknwtn.${PRODUCT_NAME:rfc1034identifier}"; MACOSX_DEPLOYMENT_TARGET = 12.0;
MARKETING_VERSION = 2022.1.23;
PRODUCT_BUNDLE_IDENTIFIER = "in.smpark.Fast-Epoch-Flip-Clock";
PRODUCT_NAME = $TARGET_NAME; PRODUCT_NAME = $TARGET_NAME;
PROVISIONING_PROFILE_SPECIFIER = "";
WRAPPER_EXTENSION = saver; WRAPPER_EXTENSION = saver;
}; };
name = Debug; name = Debug;
@@ -298,13 +311,20 @@
3A40068118B53113005F43A6 /* Release */ = { 3A40068118B53113005F43A6 /* Release */ = {
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
CODE_SIGN_IDENTITY = ""; CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES; COMBINE_HIDPI_IMAGES = YES;
DEVELOPMENT_TEAM = ""; CURRENT_PROJECT_VERSION = 1;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_TEAM = QR825BQSTL;
INFOPLIST_FILE = Info.plist; INFOPLIST_FILE = Info.plist;
INSTALL_PATH = "$(HOME)/Library/Screen Savers"; INSTALL_PATH = "$(HOME)/Library/Screen Savers";
PRODUCT_BUNDLE_IDENTIFIER = "com.chrstphrknwtn.${PRODUCT_NAME:rfc1034identifier}"; MACOSX_DEPLOYMENT_TARGET = 12.0;
MARKETING_VERSION = 2022.1.23;
PRODUCT_BUNDLE_IDENTIFIER = "in.smpark.Fast-Epoch-Flip-Clock";
PRODUCT_NAME = $TARGET_NAME; PRODUCT_NAME = $TARGET_NAME;
PROVISIONING_PROFILE_SPECIFIER = "";
WRAPPER_EXTENSION = saver; WRAPPER_EXTENSION = saver;
}; };
name = Release; name = Release;
@@ -312,7 +332,7 @@
/* End XCBuildConfiguration section */ /* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */ /* Begin XCConfigurationList section */
3A40066118B53112005F43A6 /* Build configuration list for PBXProject "Epoch Flip Clock" */ = { 3A40066118B53112005F43A6 /* Build configuration list for PBXProject "Fast Epoch Flip Clock" */ = {
isa = XCConfigurationList; isa = XCConfigurationList;
buildConfigurations = ( buildConfigurations = (
3A40067D18B53113005F43A6 /* Debug */, 3A40067D18B53113005F43A6 /* Debug */,
@@ -321,7 +341,7 @@
defaultConfigurationIsVisible = 0; defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release; defaultConfigurationName = Release;
}; };
3A40067F18B53113005F43A6 /* Build configuration list for PBXNativeTarget "Epoch Flip Clock" */ = { 3A40067F18B53113005F43A6 /* Build configuration list for PBXNativeTarget "Fast Epoch Flip Clock" */ = {
isa = XCConfigurationList; isa = XCConfigurationList;
buildConfigurations = ( buildConfigurations = (
3A40068018B53113005F43A6 /* Debug */, 3A40068018B53113005F43A6 /* Debug */,

View File

@@ -11,19 +11,19 @@
<key>CFBundleIdentifier</key> <key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key> <key>CFBundleInfoDictionaryVersion</key>
<string>0.0.5</string> <string>2022.12.22</string>
<key>CFBundleName</key> <key>CFBundleName</key>
<string>${PRODUCT_NAME}</string> <string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>BNDL</string> <string>BNDL</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>0.0.5</string> <string>$(MARKETING_VERSION)</string>
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>????</string> <string>????</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>0.0.5</string> <string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSHumanReadableCopyright</key> <key>NSHumanReadableCopyright</key>
<string>Copyright © 2019 Christopher Newton. All rights reserved.</string> <string>Hi</string>
<key>NSPrincipalClass</key> <key>NSPrincipalClass</key>
<string>EpochFlipClock</string> <string>EpochFlipClock</string>
</dict> </dict>

View File

@@ -56,12 +56,12 @@ flap-bottom-flip {
flap-top-flip { flap-top-flip {
display: none; display: none;
transform-origin: 100% 100%; transform-origin: 100% 100%;
animation: flip-top-down 300ms ease-in; animation: flip-top-down var(--anim) ease-in;
} }
flap-bottom-flip { flap-bottom-flip {
display: none; display: none;
transform-origin: 100% 0%; transform-origin: 100% 0%;
animation: flip-bottom-down 150ms ease-out; animation: flip-bottom-down var(--anim) ease-out;
} }
flap-top > n, flap-top > n,

View File

@@ -1,22 +1,25 @@
'use strict'; 'use strict';
var digits = []; var digits = [];
const digitDict = {};
function getEpoch() { function getEpoch() {
return Date.now().toString().slice(0,-3); return Date.now().toString();
} }
function createDigit() { function createDigit(i) {
var anim = [10, 11, 12].includes(i) ? 30 : (10-i) * 300;
var anim2 = Math.floor(anim/2)
var digit = document.createElement('digit'); var digit = document.createElement('digit');
digit.innerHTML = '\ digit.innerHTML = `\
<flap-top> <n></n> </flap-top>\ <flap-top> <n></n> </flap-top>\
<flap-top-flip> <n></n> </flap-top-flip>\ <flap-top-flip style="--anim: ${anim}ms;"> <n></n> </flap-top-flip>\
<flap-bottom> <n></n> </flap-bottom>\ <flap-bottom> <n></n> </flap-bottom>\
<flap-bottom-flip> <n></n> </flap-bottom-flip>'; <flap-bottom-flip style="--anim: ${anim2}ms;"> <n></n> </flap-bottom-flip>`;
return digit; return digit;
} }
function flipDigitTo(digit, currentVal, updatedVal) { function flipDigitTo(digit, currentVal, updatedVal, i) {
var topFlapNum = digit.querySelector('flap-top > n'), var topFlapNum = digit.querySelector('flap-top > n'),
topFlapFlip = digit.querySelector('flap-top-flip'), topFlapFlip = digit.querySelector('flap-top-flip'),
topFlapFlipNum = topFlapFlip.querySelector('n'), topFlapFlipNum = topFlapFlip.querySelector('n'),
@@ -32,56 +35,48 @@ function flipDigitTo(digit, currentVal, updatedVal) {
setTimeout(function() { setTimeout(function() {
topFlapFlip.style.display = 'none'; topFlapFlip.style.display = 'none';
}, 300); }, [10, 11, 12].includes(i) ? 30 : (10-i) * 300);
setTimeout(function() { setTimeout(function() {
bottomFlapFlipNum.innerHTML = updatedVal; bottomFlapFlipNum.innerHTML = updatedVal;
bottomFlapFlip.style.display = 'block'; bottomFlapFlip.style.display = 'block';
}, 300); }, [10, 11, 12].includes(i) ? 30 : (10-i) * 300);
setTimeout(function() { setTimeout(function() {
bottomFlapNum.innerHTML = updatedVal; bottomFlapNum.innerHTML = updatedVal;
bottomFlapFlip.style.display = 'none'; bottomFlapFlip.style.display = 'none';
}, 450); }, [10, 11, 12].includes(i) ? 45 : (10-i) * 450);
digit.setAttribute('current-val', updatedVal); digit.setAttribute('current-val', updatedVal);
} }
function updateClock() { function updateClock() {
var epoch = getEpoch(), var epoch = getEpoch(),
staggerDelay,
currentVal, currentVal,
updatedVal, updatedVal,
i; i;
for (i = 0; i < epoch.length; i+=1) { for (i = 0; i < epoch.length; i+=1) {
if(i === epoch.length-1) {
staggerDelay = 0;
} else {
staggerDelay = Math.random() * 400;
}
currentVal = digits[i].getAttribute('current-val'); currentVal = digits[i].getAttribute('current-val');
updatedVal = epoch[i]; updatedVal = epoch[i];
if(currentVal !== updatedVal) { if(currentVal !== updatedVal) {
setTimeout(flipDigitTo, staggerDelay, digits[i], currentVal, updatedVal); setTimeout(flipDigitTo, 0, digits[i], currentVal, updatedVal, i);
} }
} }
} }
function setupClock() { function setupClock() {
var epoch = getEpoch(), var epoch = getEpoch(),
staggerDelay,
digit, digit,
i; i;
for (i = 0; i < epoch.length; i+=1) { for (i = 0; i < epoch.length; i+=1) {
digit = createDigit(); digit = createDigit(i);
staggerDelay = Math.random() * 400;
document.body.appendChild(digit); document.body.appendChild(digit);
setTimeout(flipDigitTo, staggerDelay, digit, null, epoch[i]); setTimeout(flipDigitTo, 0, digit, null, epoch[i], i);
} }
digits = document.querySelectorAll('digit'); digits = document.querySelectorAll('digit');
} }
setupClock(); setupClock();
setInterval(updateClock, 1000); setInterval(updateClock, 1);