<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>clock Archives - Codeplaners</title>
	<atom:link href="https://codeplaners.com/tag/clock/feed/" rel="self" type="application/rss+xml" />
	<link>https://codeplaners.com/tag/clock/</link>
	<description>Code Solution</description>
	<lastBuildDate>Fri, 24 Mar 2023 09:17:15 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.1.7</generator>

<image>
	<url>https://codeplaners.com/wp-content/uploads/2020/09/cropped-favicon-social-32x32.png</url>
	<title>clock Archives - Codeplaners</title>
	<link>https://codeplaners.com/tag/clock/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Clock In Javascript Example</title>
		<link>https://codeplaners.com/clock-in-javascript-example/</link>
					<comments>https://codeplaners.com/clock-in-javascript-example/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Fri, 24 Mar 2023 09:17:15 +0000</pubDate>
				<category><![CDATA[HTML&CSS]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[clock]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[html]]></category>
		<guid isPermaLink="false">https://codeplaners.com/?p=1465</guid>

					<description><![CDATA[<p>Hi Dev, Today, i we will show you Clock In Javascript Example. This article will give you simple example of Clock In Javascript Example. you will Clock In Javascript Example. In this article, we will implement a Clock In Javascript Example. So, let’s follow few steps to create example of Clock In Javascript Example. Example &#8230; <a href="https://codeplaners.com/clock-in-javascript-example/" class="more-link">Continue reading<span class="screen-reader-text"> "Clock In Javascript Example"</span></a></p>
<p>The post <a rel="nofollow" href="https://codeplaners.com/clock-in-javascript-example/">Clock In Javascript Example</a> appeared first on <a rel="nofollow" href="https://codeplaners.com">Codeplaners</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Hi Dev,</p>
<p>Today, i we will show you Clock In Javascript Example. This article will give you simple example of Clock In Javascript Example. you will Clock In Javascript Example. In this article, we will implement a Clock In Javascript Example. </p>
<p>So, let’s follow few steps to create example of Clock In Javascript Example.</p>
<h3 class="step_code">Example</h3>
<p><strong>index.html</strong></p>
<pre class="brush: xml; title: ; notranslate">
&lt;!DOCTYPE html&gt;
&lt;html lang=&quot;en&quot; &gt;
&lt;head&gt;
  &lt;meta charset=&quot;UTF-8&quot;&gt;
  &lt;title&gt;Clock In Javascript Example - codeplaners&lt;/title&gt;
  &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1, viewport-fit=cover&quot;&gt;
  &lt;link rel='stylesheet' href='https://fonts.googleapis.com/css2?family=DM+Sans&amp;amp;display=swap'&gt;
 &lt;style&gt;
    * {
	border: 0;
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}
:root {
	--hue: 223;
	--bg: hsl(var(--hue),90%,90%);
	--fg: hsl(var(--hue),10%,10%);
	--primary: hsl(var(--hue),90%,55%);
	--trans-dur: 0.3s;
	font-size: calc(16px + (20 - 16) * (100vw - 320px) / (1280 - 320));
}
body {
	background-color: var(--bg);
	color: var(--fg);
	font: 1em/1.5 &quot;DM Sans&quot;, sans-serif;
	height: 100vh;
	display: grid;
	place-items: center;
	transition:
		background-color var(--trans-dur),
		color var(--trans-dur);
}

.clock {
	display: flex;
	flex-direction: column;
	flex-wrap: wrap;
	align-items: center;
}
.clock__block {
	background-color: hsl(var(--hue),10%,90%);
	border-radius: 0.5rem;
	box-shadow: 0 1rem 2rem hsla(var(--hue),90%,50%,0.3);
	font-size: 3em;
	line-height: 2;
	margin: 0.75rem;
	overflow: hidden;
	text-align: center;
	width: 6rem;
	height: 6rem;
	transition:
		background-color var(--trans-dur),
		box-shadow var(--trans-dur);
}
.clock__block--small {
	border-radius: 0.25rem;
	box-shadow: 0 0.5rem 2rem hsla(var(--hue),90%,50%,0.3);
	font-size: 1em;
	line-height: 3;
	width: 3rem;
	height: 3rem;
}
.clock__colon {
	display: none;
	font-size: 2em;
	opacity: 0.5;
	position: relative;
}
.clock__colon:before,
.clock__colon:after {
	background-color: currentColor;
	border-radius: 50%;
	content: &quot;&quot;;
	display: block;
	position: absolute;
	top: -0.05em;
	left: -0.05em;
	width: 0.1em;
	height: 0.1em;
	transition: background-color var(--trans-dur);
}
.clock__colon:before {
	transform: translateY(-200%);
}
.clock__colon:after {
	transform: translateY(200%);	
}
.clock__digit-group {
	display: flex;
	flex-direction: column-reverse;
}
.clock__digits {
	width: 100%;
	height: 100%;
}
.clock__block--bounce {
	animation: bounce 0.75s; 
}
.clock__block--bounce .clock__digit-group {
	animation: roll 0.75s ease-in-out forwards; 
	transform: translateY(-50%);
}
.clock__block--delay1,
.clock__block--delay1 .clock__digit-group {
	animation-delay: 0.1s;
}
.clock__block--delay2,
.clock__block--delay2 .clock__digit-group {
	animation-delay: 0.2s;
}

/* Dark theme */
@media (prefers-color-scheme: dark) {
	:root {
		--bg: hsl(var(--hue),10%,10%);
		--fg: hsl(var(--hue),10%,90%);
	}
	.clock__block {
		background-color: hsl(var(--hue),90%,40%);
		box-shadow: 0 1rem 2rem hsla(var(--hue),90%,60%,0.4);
	}
	.clock__block--small {
		box-shadow: 0 0.5rem 2rem hsla(var(--hue),90%,60%,0.4);
	}
}

/* Beyond mobile */
@media (min-width: 768px) {
	.clock {
		flex-direction: row;
	}
	.clock__colon {
		display: inherit;
	}
}

/* Animations */
@keyframes bounce {
	from,
	to {
		animation-timing-function: ease-in;
		transform: translateY(0);
	}
	50% {
		animation-timing-function: ease-out;
		transform: translateY(15%);
	}
}
@keyframes roll {
	from {
		transform: translateY(-50%);
	}
	to {
		transform: translateY(0);
	}
}
 &lt;/style&gt;

&lt;/head&gt;
&lt;body&gt;
&lt;!-- partial:index.partial.html --&gt;
&lt;div class=&quot;clock&quot; aria-label=&quot;00:00:00 AM&quot;&gt;
	&lt;div class=&quot;clock__block clock__block--delay2&quot; aria-hidden=&quot;true&quot; data-time-group&gt;
		&lt;div class=&quot;clock__digit-group&quot;&gt;
			&lt;div class=&quot;clock__digits&quot; data-time=&quot;a&quot;&gt;00&lt;/div&gt;
			&lt;div class=&quot;clock__digits&quot; data-time=&quot;b&quot;&gt;00&lt;/div&gt;
		&lt;/div&gt;
	&lt;/div&gt;
	&lt;div class=&quot;clock__colon&quot;&gt;&lt;/div&gt;
	&lt;div class=&quot;clock__block clock__block--delay1&quot; aria-hidden=&quot;true&quot; data-time-group&gt;
		&lt;div class=&quot;clock__digit-group&quot;&gt;
			&lt;div class=&quot;clock__digits&quot; data-time=&quot;a&quot;&gt;00&lt;/div&gt;
			&lt;div class=&quot;clock__digits&quot; data-time=&quot;b&quot;&gt;00&lt;/div&gt;
		&lt;/div&gt;
	&lt;/div&gt;
	&lt;div class=&quot;clock__colon&quot;&gt;&lt;/div&gt;
	&lt;div class=&quot;clock__block&quot; aria-hidden=&quot;true&quot; data-time-group&gt;
		&lt;div class=&quot;clock__digit-group&quot;&gt;
			&lt;div class=&quot;clock__digits&quot; data-time=&quot;a&quot;&gt;00&lt;/div&gt;
			&lt;div class=&quot;clock__digits&quot; data-time=&quot;b&quot;&gt;00&lt;/div&gt;
		&lt;/div&gt;
	&lt;/div&gt;
	&lt;div class=&quot;clock__block clock__block--delay2 clock__block--small&quot; aria-hidden=&quot;true&quot; data-time-group&gt;
		&lt;div class=&quot;clock__digit-group&quot;&gt;
			&lt;div class=&quot;clock__digits&quot; data-time=&quot;a&quot;&gt;PM&lt;/div&gt;
			&lt;div class=&quot;clock__digits&quot; data-time=&quot;b&quot;&gt;AM&lt;/div&gt;
		&lt;/div&gt;
	&lt;/div&gt;
&lt;/div&gt;
&lt;!-- partial --&gt;
 &lt;script&gt;
    window.addEventListener(&quot;DOMContentLoaded&quot;,() =&gt; {
	const clock = new BouncyBlockClock(&quot;.clock&quot;);
});

class BouncyBlockClock {
	constructor(qs) {
		this.el = document.querySelector(qs);
		this.time = { a: &#x5B;], b: &#x5B;] };
		this.rollClass = &quot;clock__block--bounce&quot;;
		this.digitsTimeout = null;
		this.rollTimeout = null;
		this.mod = 0 * 60 * 1000;

		this.loop();
	}
	animateDigits() {
		const groups = this.el.querySelectorAll(&quot;&#x5B;data-time-group]&quot;);

		Array.from(groups).forEach((group,i) =&gt; {
			const { a, b } = this.time;

			if (a&#x5B;i] !== b&#x5B;i]) group.classList.add(this.rollClass);
		});

		clearTimeout(this.rollTimeout);
		this.rollTimeout = setTimeout(this.removeAnimations.bind(this),900);
	}
	displayTime() {
		// screen reader time
		const timeDigits = &#x5B;...this.time.b];
		const ap = timeDigits.pop();

		this.el.ariaLabel = `${timeDigits.join(&quot;:&quot;)} ${ap}`;

		// displayed time
		Object.keys(this.time).forEach(letter =&gt; {
			const letterEls = this.el.querySelectorAll(`&#x5B;data-time=&quot;${letter}&quot;]`);

			Array.from(letterEls).forEach((el,i) =&gt; {
				el.textContent = this.time&#x5B;letter]&#x5B;i];
			});
		});
	}
	loop() {
		this.updateTime();
		this.displayTime();
		this.animateDigits();
		this.tick();
	}
	removeAnimations() {
		const groups = this.el.querySelectorAll(&quot;&#x5B;data-time-group]&quot;);
	
		Array.from(groups).forEach(group =&gt; {
			group.classList.remove(this.rollClass);
		});
	}
	tick() {
		clearTimeout(this.digitsTimeout);
		this.digitsTimeout = setTimeout(this.loop.bind(this),1e3);	
	}
	updateTime() {
		const rawDate = new Date();
		const date = new Date(Math.ceil(rawDate.getTime() / 1e3) * 1e3 + this.mod);
		let h = date.getHours();
		const m = date.getMinutes();
		const s = date.getSeconds();
		const ap = h &lt; 12 ? &quot;AM&quot; : &quot;PM&quot;;

		if (h === 0) h = 12;
		if (h &gt; 12) h -= 12;

		this.time.a = &#x5B;...this.time.b];
		this.time.b = &#x5B;
			(h &lt; 10 ? `0${h}` : `${h}`),
			(m &lt; 10 ? `0${m}` : `${m}`),
			(s &lt; 10 ? `0${s}` : `${s}`),
			ap
		];

		if (!this.time.a.length) this.time.a = &#x5B;...this.time.b];
	}
}
 &lt;/script&gt;

&lt;/body&gt;
&lt;/html&gt;

</pre>
<p>I hope it will assist you…</p>
<p>The post <a rel="nofollow" href="https://codeplaners.com/clock-in-javascript-example/">Clock In Javascript Example</a> appeared first on <a rel="nofollow" href="https://codeplaners.com">Codeplaners</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://codeplaners.com/clock-in-javascript-example/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
