Tutorial: Morping & Sequenced Animations

Gumawa ng mga pagbabago sa hugis at choreography na multi-election animation.

Oras: 20 minuto Difficulty:** Sumulong

Kung Ano ang Iyong Gagawin

Isang dinamikong pagkakasunud - sunod kung saan ang mga hugis ay nagkakahugis sa isa’t isa samantalang ang teksto ay nagsisiwalat nang may nakalilitong panahon.

Shape morpling na may pahilis na teksto ay nagsisiwalat ng

Saklaw ang mga Katangian

  • Shape morpning — Mga pagbabago sa pagitan ng iba’t ibang hugis
  • *Stagger animated animation — Sequenced na panahon para sa maraming elemento
  • Coror transitions — Nagbago ang kulay ng Animated
  • ** Ang*Mask ay nagsisiwalat** — Cinematic pur at mga epekto ng iris
  • Choreographyed sequences — Tiyak na naka-oras na sayaw na multi-election

Bahagi 1: Paghubog sa Morpong

Hakbang 1: Gawing Hugis ang Pinagmumulan

  1. Gumawa ng bilog sa gitna:
    • Radius: 80
    • Kulay: #3b82f6 (blue)
    • Position: (400, 300)
const circle = app.create('circle', {
  x: 400, y: 300,
  radius: 80,
  color: '#3b82f6'
});

Hakbang 2: Gumawa ng Hugis na Target

  1. Gumawa ng bituin (magiging target ng morph):
    • Mga punto: 5*
    • Radius: 100*
    • Kulay: #f59e0b (amber)
    • Position: (400, 300)
const star = app.create('star', {
  x: 400, y: 300,
  points: 5,
  radius1: 100,
  radius2: 40,
  color: '#f59e0b'
});

Hakbang 3: Idagdag ang Morph Relation

Ang morphs_to relate ay lumilikha ng makinis na mga transaksyon ng hugis:

app.addRelation(circle.data.id, star.data.id, 'morphs_to', {
  duration: 1.5,
  easing: 'easeInOut',
  morphColor: true,   // Also transition colors
  morphSize: true     // Also transition size
});

Hakbang 4: Maraming Morph

Gumawa ng morping sequence: Circle → Bituin → Triangle → Circle

const shapes = [];

// Circle
shapes.push(app.create('circle', {
  x: 400, y: 300, radius: 80, color: '#3b82f6'
}));

// Star
shapes.push(app.create('star', {
  x: 400, y: 300, points: 5, radius1: 100, radius2: 40,
  color: '#f59e0b', opacity: 0
}));

// Triangle
shapes.push(app.create('triangle', {
  x: 400, y: 300, radius: 90,
  color: '#10b981', opacity: 0
}));

// Hexagon (back to geometric)
shapes.push(app.create('polygon', {
  x: 400, y: 300, sides: 6, radius: 85,
  color: '#8b5cf6', opacity: 0
}));

// Chain morphs with delays
for (let i = 0; i < shapes.length - 1; i++) {
  app.addRelation(shapes[i].data.id, shapes[i + 1].data.id, 'morphs_to', {
    duration: 1.2,
    delay: i * 1.5,  // Stagger start times
    easing: 'easeInOut',
    morphColor: true
  });
}

// Loop back to first shape
app.addRelation(shapes[shapes.length - 1].data.id, shapes[0].data.id, 'morphs_to', {
  duration: 1.2,
  delay: (shapes.length - 1) * 1.5,
  easing: 'easeInOut',
  morphColor: true
});

Bahagi 2: Isinisiwalat ng Nakapangingilabot na Teksto

Hakbang 5: Gumawa ng Kola ng Liham

const collage = app.letterCollage.create('TRANSFORM', {
  style: 'gradient',
  gradientPalette: 'cyberpunk',
  gradientDirection: 'horizontal',
  fontSize: 64,
  x: 400, y: 500
});

Hakbang 6: Pahiran

app.letterCollage.applyStaggeredAnimation(collage.collageId, {
  effect: 'fadeSlideUp',
  staggerDelay: 0.06,    // 60ms between letters
  duration: 0.5,
  sequence: 'center',     // Start from center, expand outward
  easing: 'easeOut'
});

Mga Halimbawa ng Pag - aalinlangan

Huwaran Epekto
linear Kaliwa pakanan
reverse Kanan pakaliwa
center Pawang palabas
random Utos ng Random
wave Oras ng Sine wave
fibonacci Likas na ritmo

Bahagi 3: Isinisiwalat ng Maskara

Hakbang 7: Idagdag ang Madulang Pagsisiwalat

Isiwalat ang hugis morpinang may epektong iris:

// Apply animated mask to the shape container
app.applyAnimatedMask(shapes[0], 'iris', {
  startTime: 0,
  duration: 0.8,
  easing: 'easeOut'
});

Hakbang 8: Isinisiwalat ng Wipe ang Teksto

// Reveal text with horizontal wipe
app.applyAnimatedMask(collage.group, 'wipeLeft', {
  startTime: 0.5,  // Start after shape reveals
  duration: 0.6,
  easing: 'easeInOut'
});

Makukuhang mga Preset ng Maskara

Patiuna Epekto
iris Bilugan mula sa gitna
wipeLeft Isinisiwalat ng Horizontal mula sa kaliwa
wipeUp Isinisiwalat ng vertical mula sa ibaba
star Lumalaking hugis ng bituin
heart Lumalaki ang hugis ng puso
curtainHorizontal Mga bukas mula sa gitna
diagonalWipe Isinisiwalat ito ng isang glued

Bahagi 4: Buong Choreograpiya

Buong Paglalarawan

// === SETUP ===
app.setCanvasSize({ width: 800, height: 600 });
app.setBackgroundColor('#0f172a');

// === MORPHING SHAPES ===
const shapeColors = ['#3b82f6', '#f59e0b', '#10b981', '#8b5cf6'];
const shapeTypes = ['circle', 'star', 'triangle', 'polygon'];

const mainShape = app.create('circle', {
  x: 400, y: 250,
  radius: 80,
  color: shapeColors[0]
});

// Keyframe the shape through color transitions
app.addAnimation(mainShape.data.id, [
  { time: 0, properties: { fillColor: '#3b82f6', scale: 1 } },
  { time: 1.5, properties: { fillColor: '#f59e0b', scale: 1.2 }, easing: 'easeInOut' },
  { time: 3, properties: { fillColor: '#10b981', scale: 0.9 }, easing: 'easeInOut' },
  { time: 4.5, properties: { fillColor: '#8b5cf6', scale: 1.1 }, easing: 'easeInOut' },
  { time: 6, properties: { fillColor: '#3b82f6', scale: 1 }, easing: 'easeInOut' }
]);

// Add rotation for visual interest
app.addAnimation(mainShape.data.id, [
  { time: 0, properties: { rotation: 0 } },
  { time: 6, properties: { rotation: 360 }, easing: 'linear' }
]);

// === IRIS REVEAL FOR SHAPE ===
app.applyAnimatedMask(mainShape, 'iris', {
  startTime: 0,
  duration: 0.6,
  easing: 'easeOut'
});

// === STAGGERED TEXT ===
const title = app.letterCollage.create('TRANSFORM', {
  style: 'tile',
  palette: 'neon',
  fontSize: 56,
  x: 400, y: 480
});

app.letterCollage.applyStaggeredAnimation(title.collageId, {
  effect: 'popIn',
  staggerDelay: 0.05,
  duration: 0.4,
  sequence: 'center',
  easing: 'elastic'
});

// === ORBITING ACCENTS ===
const orbitColors = ['#f472b6', '#34d399', '#fbbf24'];
orbitColors.forEach((color, i) => {
  const dot = app.create('circle', {
    x: 400, y: 250,
    radius: 6,
    color: color
  });

  app.addRelation(dot.data.id, mainShape.data.id, 'orbits', {
    radius: 120 + i * 25,
    speed: 0.4 - i * 0.1,
    phase: i * (Math.PI * 2 / 3)
  });

  // Fade in the orbiting dots
  app.addAnimation(dot.data.id, [
    { time: 0.8 + i * 0.2, properties: { opacity: 0, scale: 0 } },
    { time: 1.2 + i * 0.2, properties: { opacity: 1, scale: 1 }, easing: 'elastic' }
  ]);
});

// === CAMERA MOVEMENT ===
app.addRelation('camera', null, 'camera_animates', {
  duration: 6,
  loop: true,
  keyframes: [
    { time: 0, zoom: 1, center: [400, 300] },
    { time: 1.5, zoom: 1.15, center: [400, 280], easing: 'easeOut' },
    { time: 3, zoom: 1.05, center: [400, 320], easing: 'easeInOut' },
    { time: 4.5, zoom: 1.1, center: [400, 300], easing: 'easeInOut' },
    { time: 6, zoom: 1, center: [400, 300], easing: 'easeOut' }
  ]
});

// === PLAY ===
app.playKeyframeTimeline(6, true);

Mga Pagsasaayos sa Pag - uulat

Para sa pinakamabuting resulta sa pag - iimbento ng morp:

Pagtatakda Halaga Dahilan
Kamag - anak WebM Pinakamabuting katangian ng mga bangin
Bilis ng Frame 60 fps Iba pang mga morph
Gaano Katagal 6 na segundo Buong siklo ng silo
Katangian Mataas Ingatan ang mga pagbabago sa kulay

Mga Mungkahi

Overlap tiyempo — Paandarin ang susunod na animation 0.1-0.2s bago ang mga naunang dulo para sa walang tigil na daloy.

*Gampan ang magkakaugnay na mga kulay — Ang mga morph ay pinakamabuting tingnan kapag ang pagbabago sa pagitan ng mga kulay ay gumaganang magkasama.

Center sequence para sa pagbagsak — Itinatawag - pansin ng center ang gitna ng teksto.

Isinisiwalat ng Match ang nilalaman — Gumamit ng iris para sa pabilog na mga hugis, wipeLeft para sa teksto.


Mga pagbabago

Paglalarawan sa mga Data

// Bar chart to pie chart transition
const bars = createBarChart(data);
const pie = createPieChart(data);

app.addRelation(bars.data.id, pie.data.id, 'morphs_to', {
  duration: 2,
  easing: 'easeInOut'
});

Katanungan ng Logo Animation

// Logo parts appear in sequence
const logoParts = [shape1, shape2, shape3, text];

logoParts.forEach((part, i) => {
  app.addAnimation(part.data.id, [
    { time: i * 0.3, properties: { opacity: 0, scale: 0.5 } },
    { time: i * 0.3 + 0.4, properties: { opacity: 1, scale: 1 }, easing: 'elastic' }
  ]);
});

Susunod na mga Hakbang