قسمت های خالی را با توجه به اموزش در جمینای تکمیل کنید
پرامپت آماده
پرامپت ساخت انیمیشن با جمینای
دربارهی این پرامپت
۱
پرامپت اماده
I attached my voice-over. Build an animated cartoon Short around it, as ONE self-contained HTML file.
MY EXACT WORDS:
"
راننده تاکسی هر شب پیرزنی را از بیمارستان به خانه میرساند.
پیرزن همیشه صندلی عقب مینشست و میگفت: «پسرم، آروم برو. کسی منتظرم نیست.»
یک شب پیرزن نیامد.
راننده از نگهبان بیمارستان سراغش را گرفت.
نگهبان گفت: «سه روز پیش فوت کرد.»
راننده خشکش زد و گفت: «ولی من دیشب رسوندمش خونه!»
نگهبان لبخند تلخی زد:
«شاید یکی دیگه بوده... اون پیرزن سه سال بود که حتی نمیتونست راه بره."
MY STORY IN ONE LINE:
اننده تاکسی هر شب پیرزنی تنها را از بیمارستان به خانه میرساند، تا اینکه یک شب فهمید مسافری که دیشب سوار ماشینش بوده، سه روز پیش از دنیا رفته است
VOICE TIMING (the page works it out by itself; I give you no times):
1. Split my words into chunks at every punctuation mark (, . ? ! : ;). Give each chunk a weight: its letters plus its number of words, counting each digit as three letters.
2. When I choose my voice file, the page decodes it and measures the stretches of speech: find every pause quieter than -35 dB that lasts 0.25 s or more; what lies between two pauses is one stretch.
3. Align chunks to stretches, in order, with dynamic programming. Each step takes either 1 to 4 chunks into one stretch, or one chunk across 1 to 3 stretches. Cost of a step = |ln(rate / average rate)| x the step's seconds of speech, where rate = weight per second of speech and average rate = total weight / total seconds of speech. Choose the alignment with the lowest total cost.
4. Inside each step, spread the words over the speaking time in proportion to (letters + 1), skipping the pauses. Now every word has a start and an end time.
5. Before a file is chosen, run the same code on your own estimate of the stretches.
6. Every caption, cut, action and sound gets its time from that word table at draw time (for example: a scene starts at the first word of its sentence, a sound lands on the word it belongs to). No hard-coded seconds anywhere. window.DURATION becomes the length of my file once it is loaded.
7. The status line shows "Voice timing: measured" after a file is loaded, otherwise "Voice timing: estimated".
STEP 1 - PLAN (short, before any code). A table: the chunks of words, the scene, the shot size, and what happens beat by beat.
STEP 2 - THE CARTOON. Rules:
- Vertical 1080x1920. One scene per sentence or pair of sentences, each in its own place with its own background.
- Mostly wide and medium shots: a standing character is 30 to 45% of the frame height, so there is room for action. Close shots only for a face reaction.
- Fill the frame: the ground line sits about 70% of the way down and the action happens in the middle of the frame, not along the bottom edge. When the words mention many of something, show a crowd.
- Every scene is a tiny story with a start, a middle and an end. Something new happens at least once a second. Nobody stands frozen.
- Show what the words say. If something is fired, thrown, dropped or eaten, we see it happen.
- Look: bold cartoon. A thick dark outline around every character and object, flat colours with one darker shaded side, shaggy feather edges and cloth folds, and a soft shadow where they touch the ground. Original characters that look the same in every scene.
- Legs must be right. People: knees bend FORWARD, in the direction they face, never backward. Birds: the visible joint bends backward. When anyone walks or runs, the foot on the ground slides backward against the direction of travel and the lifted foot swings forward; they never moonwalk and never run backward. Check every walk and run cycle against this before you answer.
- Things line up: hands touch what they hold, feet stand on the ground, limbs bend at the joints, nothing overlaps by accident.
- Real animation: walk and run cycles, blinking, squash and stretch, anticipation, ease in and out.
- The camera never stops: slow push-ins, pans that follow the action, a punch-in on each joke, a clear transition on every cut.
- Depth: sky with clouds, far layer, middle layer, characters, foreground, with parallax.
- The light changes with the story from scene to scene (time of day, mood).
- Captions on the words: 1 to 3 words at a time, each appearing when it is spoken, the key word in yellow, big and bold (about 110 px), in the upper third, never wider than 84% of the frame, never over a face. If three words do not fit at full size, show two.
SOUND EFFECTS (WebAudio synthesis only, no audio files):
- 10 to 14 effects, each tied to one word or action on screen. List them in the plan.
- Make them sound full, not like beeps: layer filtered noise with tones, give each a fast attack and a natural fade.
- All in one function: window.scheduleSfx(audioCtx, destination, startTime). It must work with an AudioContext and an OfflineAudioContext.
TECH (strict):
- Canvas 2D only for the picture. No external files, libraries, fonts, images or network requests.
- window.DURATION = your estimate of the length of my voice-over until the file is loaded, then the real length.
- window.renderAt(t) draws the exact frame for time t in seconds. Deterministic: no Date, no performance.now, no state carried from earlier frames, no Math.random (use a seeded function).
- In the page, three buttons: "Choose voice file", "Play" and "Save video". Before anything is clicked the picture loops silently and a status line says "Choose your voice file, then press Play or Save video".
- Play: plays my voice, the sound effects and the picture in sync through the speakers.
- Save video: plays once from the start and records picture and sound together with MediaRecorder: canvas.captureStream(30) for the picture, plus an AudioContext MediaStreamDestination that the voice and scheduleSfx are routed to, and also to the speakers so I hear it while it records. Each frame is drawn with renderAt(audioCtx.currentTime - startTime). At window.DURATION it stops by itself and downloads my-short.mp4 (use "video/mp4;codecs=avc1.640028,mp4a.40.2" or "video/mp4" if MediaRecorder.isTypeSupported says yes, otherwise WebM saved as my-short.webm), 12 Mbps, the full 1080x1920 canvas whatever size it is shown at. Status line: "Recording... 12 / 31 s. Keep this tab open and in front." then "Saved. Check your Downloads folder." It must also work without a voice file.
- Write compact code: shared drawing functions, no repeated blocks, short comments. Keep the whole file under 110,000 characters.
Return the plan, then the full file in a single code block that starts with ```html.
پرامپت رو کپی کن و توی ChatGPT، Claude، Midjourney یا هر ابزار AI دیگهای استفاده کن. بخشهای داخل [کروشه] رو با خواستهی خودت عوض کن.