فك تشفير النص الرقمي

تدوير رموز رقمية سريعة تستقر تدريجياً على الحروف النهائية.

مواصفات الحركة

المدة
1.2s
منحنى التسارع
linear -> ease-out
التقنية
JS Scramble
المكتبة
Vanilla JS / GSAP ScrambleText
التصنيف
تايبوجرافي حركي وتأثيرات النصوص
الرخصة
مجاني للاستخدام الشخصي والتجاري
أمر الذكاء الاصطناعي (AI Prompt)
أنشئ حركة ويب احترافية باسم "فك تشفير النص الرقمي" (Scramble Text Matrix Decode).
• العنصر المستهدف (Target): العنصر النصي (.decode-text)
• المدة (Duration): 1.2s
• منحنى التسارع (Easing): linear -> ease-out
• الألوان (Colors): خلفية فحمية داكنة #0d0e11، سطح #16181e، نص أبيض #f3f4f6، ولون تمييز برتقالي ناري واحد #ff5e1a
• الاتجاه (Direction): حرف تلو الآخر (Sequential Lock)
• المكتبة/التقنية (Library): Vanilla JS / GSAP ScrambleText
• صيغة الإخراج (Output Format): ملف HTML5/CSS3/Vanilla JS مستقل بالكامل (Self-Contained)
• قيود الأداء (Performance): تحريك خصائص GPU الآمنة فقط (transform, opacity, clip-path, filter)، سرعة 60fps، استخدام IntersectionObserver للتشغيل عند الظهور، ودعم @media (prefers-reduced-motion: reduce).
الكود الكامل (HTML + CSS + JS)
<!DOCTYPE html>
<html lang="ar" dir="rtl">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>فك تشفير النص الرقمي — Scramble Text Matrix Decode</title>
  <style>
    body { margin: 0; background: #0d0e11; color: #f3f4f6; font-family: system-ui, sans-serif; }
    :root { --font-mono: ui-monospace, Menlo, Consolas, monospace; }
    #stage { position: relative; width: 100%; height: 220px; box-sizing: border-box; padding: 16px; display: flex; align-items: center; justify-content: center; overflow: hidden; background: #090a0d; }
  </style>
</head>
<body>
  <div id="stage"></div>
  <script>
    function play(stage) {
      const fx = { id: 6, mode: "k_decode" };
      const timers = [], rafs = [], anims = [], listeners = [];
      const regTimer = (t) => { timers.push(t); return t; };
      const regRaf = (r) => { rafs.push(r); return r; };
      const regAnim = (a) => { anims.push(a); return a; };
      const regListen = (el, ev, fn) => { el.addEventListener(ev, fn); listeners.push([el, ev, fn]); };
      const accent = '#ff5e1a', white = '#f3f4f6', muted = '#a1a8b3', surface = '#1e2129';
      const svgEl = (tag, attrs = {}) => {
        const el = document.createElementNS('http://www.w3.org/2000/svg', tag);
        Object.entries(attrs).forEach(([k, v]) => el.setAttribute(k, v));
        return el;
      };
      switch (fx.mode) {
    case 'k_decode': {
              const target = 'SVG ENGINE 60FPS';
              const chars = '01X#%/+-*';
              const el = document.createElement('div');
              el.dir = 'ltr';
              el.style.cssText = 'font-family:var(--font-mono);font-size:1.25rem;font-weight:600;color:' + accent + ';';
              stage.appendChild(el);
              let frame = 0;
              const total = 28;
              const step = () => {
                const prog = frame / total;
                el.textContent = target.split('').map((c, idx) => {
                  if (c === ' ') return ' ';
                  if (idx / target.length < prog) return c;
                  return chars[Math.floor(Math.random() * chars.length)];
                }).join('');
                frame++;
                if (frame <= total) regTimer(setTimeout(step, 38));
                else el.style.color = white;
              };
              step();
              break;
            }
      }
      return () => {
        timers.forEach(clearTimeout);
        rafs.forEach(cancelAnimationFrame);
        anims.forEach(a => { try { a.cancel(); } catch (_) {} });
        listeners.forEach(([el, ev, fn]) => el.removeEventListener(ev, fn));
      };
    }
    
    const MS = 1800, PAUSE = 1500; // MS = 0: the effect already runs continuously
    const host = document.getElementById('stage');
    const still = matchMedia('(prefers-reduced-motion: reduce)').matches;
    let stop = null, timer = null, shown = false;
    function run() { if (stop) stop(); host.innerHTML = ""; stop = play(host); }
    function loop() { run(); if (!still && MS) timer = setTimeout(loop, MS + PAUSE); }
    new IntersectionObserver(([e]) => {
      if (e.isIntersecting && !shown) { shown = true; loop(); }
      else if (!e.isIntersecting && shown) { shown = false; clearTimeout(timer); if (stop) stop(); }
    }, { threshold: 0.1 }).observe(host);
  </script>
</body>
</html>

قوالب مشابهة