From 64c2616a8062688040f29a7c9c1baaff482332f6 Mon Sep 17 00:00:00 2001 From: mayank-0103 <201279422+mayank-0103@users.noreply.github.com> Date: Wed, 12 Mar 2025 21:49:46 +0530 Subject: [PATCH] updated code --- auto-text-effect/index.html | 33 ++++++++++++++++++--------------- auto-text-effect/script.js | 23 +++++++++++------------ auto-text-effect/style.css | 16 +++++++++++----- 3 files changed, 40 insertions(+), 32 deletions(-) diff --git a/auto-text-effect/index.html b/auto-text-effect/index.html index 3fb9ade..af1fd04 100644 --- a/auto-text-effect/index.html +++ b/auto-text-effect/index.html @@ -1,19 +1,22 @@ - - - - - Auto Text Effect - - -

Starting...

-
- - -
+ + + + + Auto Text Effect + - - - + +

Starting...

+ +
+ + +
+ + + + + \ No newline at end of file diff --git a/auto-text-effect/script.js b/auto-text-effect/script.js index c302628..1d1158f 100644 --- a/auto-text-effect/script.js +++ b/auto-text-effect/script.js @@ -1,22 +1,21 @@ -const textEl = document.getElementById('text') -const speedEl = document.getElementById('speed') -const text = 'We Love Programming!' -let idx = 1 -let speed = 300 / speedEl.value +const textEl = document.getElementById('text'); +const speedEl = document.getElementById('speed'); +const text = 'xAI is an AI company with the mission of advancing scientific discovery and gaining a deeper understanding of our universe.'; +let idx = 1; +let speed = 300 / speedEl.value; -writeText() +writeText(); function writeText() { - textEl.innerText = text.slice(0, idx) + textEl.innerText = text.slice(0, idx); - idx++ + idx++; if(idx > text.length) { - idx = 1 + idx = 1; } - setTimeout(writeText, speed) + setTimeout(writeText, speed); } - -speedEl.addEventListener('input', (e) => speed = 300 / e.target.value) \ No newline at end of file +speedEl.addEventListener('input', (e) => speed = 300 / e.target.value); \ No newline at end of file diff --git a/auto-text-effect/style.css b/auto-text-effect/style.css index 71fae02..cc41547 100644 --- a/auto-text-effect/style.css +++ b/auto-text-effect/style.css @@ -5,7 +5,7 @@ } body { - background-color: darksalmon; + background-color: rgb(234, 255, 217); font-family: 'Roboto', sans-serif; display: flex; flex-direction: column; @@ -13,13 +13,19 @@ body { justify-content: center; height: 100vh; overflow: hidden; - margin: 0; + width: 80vw; + margin: auto; +} + + +#text { + text-align: center; } div { position: absolute; bottom: 20px; - background: rgba(0, 0, 0, 0.1); + background: rgba(9, 105, 31, 0.1); padding: 10px 20px; font-size: 18px; } @@ -28,11 +34,11 @@ input { width: 50px; padding: 5px; font-size: 18px; - background-color: darksalmon; + background-color: rgb(172, 234, 201); border: none; text-align: center; } input:focus { outline: none; -} +} \ No newline at end of file