animation-on-scroll
ما الذي تفعله
تُرشد هذه المهارة وكيلًا للذكاء الاصطناعي في إضافة رسوم متحركة تظهر عند التمرير إلى صفحة ويب. وهي موجهة لأصحاب المواقع الذين يريدون أن تتحرك الأقسام عند ظهورها أمام الزائر.
متى تستخدمها
- ✓عندما تريد أن تتحرك العناصر عند نزول الزوار إلى أسفل الصفحة.
- ✓عندما تحتاج إلى تأثير ظهور سريع عند التمرير على موقع يستخدم Tailwind.
- ✓عندما تريد أن يظهر كل عنصر في قائمة بفارق زمني صغير.
رابط المهارة
https://github.com/MengTo/Skills/blob/main/agent-skills/web-design/animation-on-scroll/SKILL.mdانسخه والصقه في الذكاء الاصطناعي الذي تستخدمه (Claude أو ChatGPT أو Cursor) واطلب منه اتباع التعليمات.
طريقة الاستخدام
أسهل طريقة: انسخ الرسالة والصقها في الذكاء الاصطناعي الذي تستخدمه. سيقرأ المهارة وينفّذ تعليماتها.
رسالة جاهزة للصق
لـ Claude Code أو Codex أو Cursor: شغّله داخل مجلد مشروعك وستُثبَّت المهارة.
نزّل ملف SKILL.md وضعه في مجلد مهارات وكيلك.
مثال على ما تطلبه من الذكاء الاصطناعي
“اجعل بطاقات الميزات تتلاشى وتنزلق واحدة تلو الأخرى عند تمرير الناس في صفحتي.”
5 مهارات جديدة كل أسبوع. قراءة في دقيقة واحدة.
كيف تعمل
يضيف وكيلك سكربتًا صغيرًا يراقب دخول العناصر إلى الشاشة. وعندما يحدث ذلك، يبدأ الرسم المتحرك المعرّف بإطار مفتاحي وفئة Tailwind.
المحتوى التقني (ملف SKILL.md الأصلي)
النص الأصلي من المؤلف، مباشرة من GitHub.
Animation On Scroll Skill
Workflow
- Confirm animation style, timing, and whether animations should run once or repeat.
- Provide the keyframes + JS observer snippet and the exact Tailwind class to apply.
- Offer focused tweaks only (threshold, rootMargin, duration, delay, transform/blur values).
Usage checklist
- Insert the JS snippet in the
<head>after the keyframes. - Add the animation class and
animate-on-scrollto elements. - Ensure your keyframes name matches the Tailwind animation reference.
IntersectionObserver trigger
<script>
/*
Sequence animation on scroll when visible. Requires Animation Keyframe. Usage:
1) Insert this code in the <head> along with the Animation Keyframe code.
2) Add to Tailwind Classes: [animation:animationIn_0.8s_ease-out_0.1s_both] animate-on-scroll
*/
(function () {
// Inject CSS for paused/running states
const style = document.createElement("style");
style.textContent = `
/* Default: paused */
.animate-on-scroll { animation-play-state: paused !important; }
/* Activated by JS */
.animate-on-scroll.animate { animation-play-state: running !important; }
`;
document.head.appendChild(style);
const once = true;
if (!window.__inViewIO) {
window.__inViewIO = new IntersectionObserver((entries) => {
entries.forEach((entry) => {
if (entry.isIntersecting) {
entry.target.classList.add("animate");
if (once) window.__inViewIO.unobserve(entry.target);
}
});
}, { threshold: 0.2, rootMargin: "0px 0px -10% 0px" });
}
window.initInViewAnimations = function (selector = ".animate-on-scroll") {
document.querySelectorAll(selector).forEach((el) => {
window.__inViewIO.observe(el); // observing twice is a no-op
});
};
document.addEventListener("DOMContentLoaded", () => initInViewAnimations());
})();
</script>
Keyframes
<style>
/*
Sequence animation intro. Usage:
1) Insert this code in the <head>
2) Add to Tailwind Classes: [animation:animationIn_0.8s_ease-out_0.1s_both]
*/
@keyframes animationIn {
0% {
opacity: 0;
transform: translateY(30px);
filter: blur(8px);
}
100% {
opacity: 1;
transform: translateY(0);
filter: blur(0px);
}
}
</style>
Tailwind example
<div class="animate-on-scroll [animation:animationIn_0.8s_ease-out_0.1s_both]">
...
</div>
Customization knobs
- Trigger: adjust
thresholdandrootMarginfor earlier/later reveals. - Repeat: set
once = falseto allow replays when re-entering. - Motion: tweak
translateYandblurin keyframes. - Timing: change duration and delay in the Tailwind animation value.
Common pitfalls
- Forgetting to include the keyframes before the JS snippet.
- Using a different keyframe name than in the Tailwind animation.
- Animations not running because the element is already in view before observer init.
Questions to ask when specs are missing
- Should animations run once or every time the element re-enters?
- How far before entering the viewport should they start?
- What motion style (fade, slide, blur, scale) do you want?
الأسئلة الشائعة
هل تتكرر الحركة عندما أعود بالتمرير؟
تتضمن المهارة إعدادًا لتشغيلها مرة واحدة أو تكرارها، فتختار ما تريد.
أين توضع الشيفرة؟
يوضع السكربت في رأس الصفحة بعد الإطارات المفتاحية، وتُضاف الفئة إلى كل عنصر.
هل يمكن تغيير التوقيت؟
نعم. تقترح المهارة تعديلات تحدد مقدار ظهور العنصر في الشاشة قبل التشغيل، إضافةً إلى المدة والتأخير والحركة.
التفاصيل
الوصف الأصلي من المؤلف
Create an on-scroll animation trigger using IntersectionObserver with Tailwind-friendly animation classes and keyframes. Use when asked for scroll-reveal, animate-on-scroll, or sequencing element animations when they enter the viewport.
repo: MengTo/Skills
الشعبية
- نجوم GitHub
- 7.2k
- الترتيب
- #13396
- الترخيص
- MIT
- آخر تحديث
- 1/11/2026
التعليقات
- …
المزيد من المهارات من هذا المستودع
3d-cloth-material
7.2kيساعد وكيلك على بناء قماش منسوج واقعي في Three.js، مع نسيج الخيوط والبريق الناعم والثنيات الطبيعية والأطراف والدروز.
3d-falling-leaves
7.2kيساعد وكيلك على إضافة أوراق متساقطة واقعية إلى مشهد ثلاثي الأبعاد، تتقلب وتنجرف مع الريح وتُعاد تدويرها مع حركة الكاميرا.
3d-four-seasons
7.2kيساعد وكيلك على إضافة مظاهر الربيع والصيف والخريف والشتاء إلى مشهد ثلاثي الأبعاد، بتغيير النباتات والضوء والسماء والثلج دون إعادة بناء المشهد.
3d-high-poly-models
7.2kيساعد وكيلك على بناء نماذج ثلاثية الأبعاد مفصلة بأشكال ناعمة وحواف مقنعة، ثم تجهيز نسخ أخف تعمل جيدًا على الويب.
مهارات مشابهة
angular-developer
280kيساعد وكيلك على كتابة شيفرة Angular وتقديم نصائح لبنية المشروع، ويفيد في بدء المشاريع الجديدة وإنشاء المكونات وتحسين الأداء وإمكانية الوصول.
frontend-a11y
280kيساعد وكيلك على جعل واجهات الويب متاحة للجميع، فيضمن أن المواقع والتطبيقات تعمل جيدًا مع قارئات الشاشة والتنقل بلوحة المفاتيح.
frontend-patterns
280kيطبّق وكيلك أنماط تطوير الواجهات الحديثة، فيحسّن الأداء ويدير الحالة ويتبع أفضل الممارسات في React وNext.js.