الخط الزمني المرحلي للعملية

إظهار مراحل العملية بالتدريج مع خط ربط يربط كل خطوة بالتالية.

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

المدة
1.6s
منحنى التسارع
cubic-bezier(0.22, 1, 0.36, 1)
التقنية
Sequence Timeline
المكتبة
SVG Line + Staggered Nodes
التصنيف
الرسوم البيانية والإنفوجرافيك
الرخصة
مجاني للاستخدام الشخصي والتجاري
أمر الذكاء الاصطناعي (AI Prompt)
أنشئ حركة ويب احترافية باسم "الخط الزمني المرحلي للعملية" (Phased Process Timeline).
• العنصر المستهدف (Target): مسار الربط والعقد (.step-node)
• المدة (Duration): 1.6s
• منحنى التسارع (Easing): cubic-bezier(0.22, 1, 0.36, 1)
• الألوان (Colors): خلفية فحمية داكنة #0d0e11، سطح #16181e، نص أبيض #f3f4f6، ولون تمييز برتقالي ناري واحد #ff5e1a
• الاتجاه (Direction): خطي من المرحلة 1 إلى 4
• المكتبة/التقنية (Library): SVG Line + Staggered Nodes
• صيغة الإخراج (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>الخط الزمني المرحلي للعملية — Phased Process Timeline</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: 28, mode: "g_timeline" };
      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 'g_timeline': {
              const svg = svgEl('svg', { viewBox: '0 0 240 80', width: '240', height: '80' });
              const line = svgEl('line', { x1: 30, y1: 40, x2: 210, y2: 40, stroke: accent, 'stroke-width': '3', 'stroke-dasharray': '180', 'stroke-dashoffset': '180' });
              svg.appendChild(line);
              regAnim(line.animate([{ strokeDashoffset: 180 }, { strokeDashoffset: 0 }], { duration: 1200, easing: 'ease-out', fill: 'forwards' }));
              [30, 90, 150, 210].forEach((x, i) => {
                const c = svgEl('circle', { cx: x, cy: 40, r: 8, fill: '#0d0e11', stroke: accent, 'stroke-width': '3' });
                c.style.transformBox = 'fill-box'; c.style.transformOrigin = 'center';
                svg.appendChild(c);
                regAnim(c.animate([{ transform: 'scale(0)' }, { transform: 'scale(1)' }], { duration: 400, delay: i * 280, easing: 'cubic-bezier(0.34,1.56,0.64,1)', fill: 'forwards' }));
              });
              stage.appendChild(svg);
              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 = 2200, 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>

قوالب مشابهة