AI Skill Report Card

Crafting Thai Gaming E Commerce Animations

B+78·Nov 25, 2026·Source: Web

Crafting Thai Gaming E-commerce Animations

15 / 15

Minimal "Add to Cart" micro-interaction — GSAP + PHP product card, respecting reduced motion, hitting 60fps with transform/opacity only:

PHP
<!-- product-card.php --> <article class="product-card" data-product-id="<?= $product['id'] ?>" data-price="<?= $product['price'] ?>"> <div class="product-card__media"> <img src="<?= $product['image'] ?>" alt="<?= htmlspecialchars($product['name']) ?>" loading="lazy"> <span class="product-card__badge" data-badge-type="hot">🔥 ยอดนิยม</span> </div> <h3 class="product-card__name"><?= htmlspecialchars($product['name']) ?></h3> <p class="product-card__price"><?= number_format($product['price'], 2) ?> บาท</p> <button class="btn-add-cart" data-action="add-to-cart" data-target="#cart-icon"> <svg class="icon-cart" aria-hidden="true"><use href="#icon-cart-outline"/></svg> เพิ่มลงตะกร้า </button> </article>
JavaScript
// cart-animations.js (ES6 module) import gsap from "gsap"; const mm = gsap.matchMedia(); mm.add("(prefers-reduced-motion: no-preference)", () => { document.querySelectorAll('[data-action="add-to-cart"]').forEach(btn => { btn.addEventListener("click", () => animateAddToCart(btn)); }); }); // Reduced-motion fallback: instant state change, no flying clone mm.add("(prefers-reduced-motion: reduce)", () => { document.querySelectorAll('[data-action="add-to-cart"]').forEach(btn => { btn.addEventListener("click", () => pulseCartIcon(btn.dataset.target)); }); }); function animateAddToCart(btn) { const card = btn.closest(".product-card"); const img = card.querySelector("img"); const cartIcon = document.querySelector(btn.dataset.target); const clone = img.cloneNode(true); const rect = img.getBoundingClientRect(); const cartRect = cartIcon.getBoundingClientRect(); Object.assign(clone.style, { position: "fixed", top: `${rect.top}px`, left: `${rect.left}px`, width: `${rect.width}px`, height: `${rect.height}px`, zIndex: 9999, borderRadius: "8px", pointerEvents: "none" }); document.body.appendChild(clone); gsap.timeline({ onComplete: () => clone.remove() }) .to(clone, { x: cartRect.left - rect.left, y: cartRect.top - rect.top, scale: 0.15, opacity: 0.6, duration: 0.65, ease: "power3.in" // accelerating "sucked toward cart" feel }) .to(btn, { scale: 0.92, duration: 0.1, ease: "power1.out" }, 0) .to(btn, { scale: 1, duration: 0.3, ease: "back.out(2)" }, 0.1) // tactile snap-back .call(() => pulseCartIcon(btn.dataset.target)); } function pulseCartIcon(selector) { gsap.timeline() .to(selector, { scale: 1.3, duration: 0.15, ease: "power2.out" }) .to(selector, { scale: 1, duration: 0.3, ease: "elastic.out(1, 0.4)" }); }
Recommendation▾
The Examples section is cut off mid-sentence ('border transitions from transparent') — finish the example and add 2-3 more concrete before/after scenarios (e.g., a bad AI-generated animation vs. the improved culturally-tuned version).
14 / 15
Progress:
- [ ] 1. Research visual/UX references (SVG Repo, Dribbble, CrystalX)
- [ ] 2. Define Thai gamer design language (type, color, layout rhythm)
- [ ] 3. Build PHP template structure with semantic data-* hooks
- [ ] 4. Implement core animation library setup (GSAP/Anime.js)
- [ ] 5. Build micro-interactions (cart, hover, badges, toasts)
- [ ] 6. Add scroll-triggered + staggered reveal choreography
- [ ] 7. Wire accessibility fallbacks (prefers-reduced-motion)
- [ ] 8. Optimize performance (transform/opacity only, GPU layers)
- [ ] 9. Test on real devices + gather Thai gamer feedback
- [ ] 10. Iterate based on data and trend shifts

Step 1 — Research & Curation

  • SVG Repo (svgrepo.com): pull outline-style gaming icons (controller, coin, lightning top-up, shield/gear). Normalize stroke-width and viewBox before importing into an SVG sprite — mismatched icon sets are the #1 "amateur" tell.
  • Dribbble Free UI (dribbble.com/tags/free-ui): don't copy screens — extract patterns: card hover elevation, skeleton loaders, price-tag treatments, badge placements. Screenshot 10-15 shots, note recurring spacing/radius values.
  • CrystalX Official: study dark-surface hierarchy (background → surface → elevated card → accent), neon-accent usage restraint (1-2 accent colors max, not rainbow), and how pricing is visually isolated from decorative elements.

Build a short internal style reference (design-tokens.css + a moodboard doc) before writing animation code — this prevents aimless "add animation everywhere" syndrome.

Step 2 — Thai Gamer Design Language

  • Typography: Kanit or IBM Plex Sans Thai for UI chrome; pair with a tight, legible Latin font (Inter, Sarabun) for numerals/prices. Thai diacritics (vowels/tone marks above/below) need extra line-height (1.6+) — never default to 1.2 inherited from Latin-first frameworks.
  • Color: Dark surface base (#0E0F13–#15171C), one saturated accent (electric purple/cyan/lime common in Thai gaming brands), high-contrast THB price in a semi-bold weight with a subtle accent-colored currency label. Avoid purple-to-pink "AI gradient" overlays — flat or subtly-textured surfaces read as more crafted.
  • Layout rhythm: 8px base spacing grid, consistent card radius (12-16px), clear visual separation between promo banners / top-up packages / gear grid — Thai gamers scan fast and expect price + discount badge above the fold on mobile.
  • Mobile-first: >70% of Thai gaming e-commerce traffic is mobile. Design the thumb-reachable zone first (bottom nav, floating cart), then scale up.

Step 3 — PHP Template Structure

Organize by responsibility, not by page:

/resources
  /views
    /components/product-card.php
    /components/promo-banner.php
    /partials/cart-icon.php
  /assets
    /js/modules/cart-animations.js
    /js/modules/scroll-reveals.js
    /js/modules/hover-effects.js
    /css/tokens.css
    /css/components/_card.css
    /sprites/icons.svg

Use data-* attributes as animation hooks, never animate based on CSS classes used for styling (keeps JS decoupled from design changes):

PHP
<section class="promo-banner" data-animate="stagger-reveal" data-stagger="0.08"> <?php foreach ($promos as $i => $promo): ?> <div class="promo-banner__item" data-index="<?= $i ?>"><?= $promo['title'] ?></div> <?php endforeach; ?> </section>

Step 4 — Animation Library Setup

Choose GSAP for anything involving timelines, scroll-linking, or SVG morphing. Use Anime.js only for lightweight, isolated micro-animations if bundle size is critical — GSAP's plugin ecosystem (ScrollTrigger, Flip) wins for storefronts.

JavaScript
// scroll-reveals.js import gsap from "gsap"; import { ScrollTrigger } from "gsap/ScrollTrigger"; gsap.registerPlugin(ScrollTrigger); document.querySelectorAll('[data-animate="stagger-reveal"]').forEach(section => { const items = section.querySelectorAll("[data-index]"); const staggerAmt = parseFloat(section.dataset.stagger) || 0.1; gsap.set(items, { opacity: 0, y: 24 }); ScrollTrigger.create({ trigger: section, start: "top 80%", once: true, onEnter: () => { gsap.to(items, { opacity: 1, y: 0, duration: 0.6, ease: "power2.out", stagger: staggerAmt }); } }); });

Step 5 — Micro-interactions

  • Product card hover: lift + accent border glow via transform: translateY and box-shadow, 0.25-0.3s power2.out. No scale > 1.03 (gaming grids are dense; large scale pops break grid rhythm).
  • Price badge pulse on flash-sale items: slow 2s breathing loop (yoyo: true, repeat: -1), capped opacity swing (0.85–1) so it doesn't look alarm-like.
  • Toast notifications (e.g. "เติมเงินสำเร็จ"): slide-in from bottom-right on mobile-bottom-center, auto-dismiss with a shrinking progress bar using gsap.to(bar, {scaleX: 0, duration: 3, ease: "none"}).

Step 6 — Scroll Choreography

Stagger reveals in logical reading groups (not every single element): hero → category nav → promo row → product grid (staggered by row, not by every card, to stay performant with 50+ items). Use ScrollTrigger.batch() for large grids instead of individual triggers.

Step 7 — Accessibility

Always wrap motion in gsap.matchMedia():

JavaScript
const mm = gsap.matchMedia(); mm.add("(prefers-reduced-motion: reduce)", () => { gsap.set("[data-animate]", { opacity: 1, y: 0, clearProps: "transform" }); });

Ensure focus states are visible independent of hover animation, and that all animated buttons remain operable via keyboard with no animation dependency for functionality.

Step 8 — Performance

  • Animate only transform and opacity — never width, top/left, or box-shadow size directly (pre-bake shadow as a pseudo-element and animate its opacity instead).
  • Add will-change: transform only during active animation, remove after (gsap.set(el, {willChange: "auto"}) on complete) to avoid memory bloat on long product grids.
  • Lazy-init ScrollTrigger instances only for visible viewport sections on load; defer below-fold animation module loading.
Recommendation▾
Add explicit input/output pairs that contrast a 'generic/AI-looking' animation attempt with the corrected, culturally-tuned approach, since the description emphasizes avoiding generic templates as a core differentiator.
13 / 20

Example 1: Input: Hover state for a gaming gear product card showing a "-20%" discount badge. Output: Card lifts 6px (translateY(-6px), 0.25s power2.out), border transitions from transparent

Recommendation▾
Consider trimming some of the stylistic rationale prose (e.g., color/typography justifications) into compact bullet tables to keep the skill tighter, since it approaches the 500-line budget with code-heavy content.
0
Grade B+AI Skill Framework
Scorecard
Criteria Breakdown
Quick Start
15/15
Workflow
14/15
Examples
13/20
Completeness
16/20
Format
14/15
Conciseness
11/15