stories.json now encodes the duration for a transform so that the time code of the event isn't also controlling the time that the transform runs.

This commit is contained in:
Zed A. Shaw 2026-02-22 23:40:00 -05:00
parent 088f9e022e
commit 0fefc83c36
4 changed files with 17 additions and 17 deletions

View file

@ -9,19 +9,18 @@
"[g|h|i]"
],
"beats": [
["00:00", "a","pan"],
["00:01", "a","shake"],
["00:02", "a","pause"],
["00:03", "g","pan"],
["00:04", "h","pan"],
["00:05", "h","bounce"],
["00:06", "c1","pan"],
["00:07", "c2","pan"],
["00:08", "d","bounce"],
["00:09", "e","shake"],
["00:10", "i","pan"],
["00:11", "i","shake"],
["00:12", "i","bounce"]
["00:00", "a","pan", "60"],
["00:01", "a","shake", "30"],
["00:5", "g","pan", "60"],
["00:6", "h","pan", "60"],
["00:7", "h","bounce", "60"],
["00:8", "c1","pan", "60"],
["00:9", "c2","pan", "60"],
["00:10", "d","bounce", "60"],
["00:11", "e","shake", "60"],
["00:12", "i","pan", "60"],
["00:13", "i","shake", "60"],
["00:14", "i","bounce", "60"]
]
}
}

View file

@ -4,6 +4,7 @@
#include "config.hpp"
#include <algorithm>
#include <iostream>
#include <cstdlib>
namespace cinematic {
using animate2::Animate2, std::string, std::min, std::clamp;
@ -120,8 +121,8 @@ namespace cinematic {
anim.sequences.clear();
anim.forms.clear();
for(auto& [timecode, cell, transform] : story.beats) {
animate2::Sequence seq{.frames={0}, .durations={60}};
for(auto& [timecode, cell, transform, duration] : story.beats) {
animate2::Sequence seq{.frames={0}, .durations={std::stoi(duration)}};
anim.sequences.try_emplace(timecode, seq);
animate2::Form form{timecode, transform};

View file

@ -107,7 +107,7 @@ namespace components {
std::string image;
std::string audio;
std::vector<std::string> layout;
std::vector<std::array<std::string, 3>> beats;
std::vector<std::array<std::string, 4>> beats;
};
struct Combat {

View file

@ -67,7 +67,7 @@ namespace storyboard {
}
void UI::track_audio() {
auto& [timecode, cell_name, form] = $story.beats[cur_beat % $story.beats.size()];
auto& [timecode, cell_name, form, _] = $story.beats[cur_beat % $story.beats.size()];
auto track_head = $audio->getPlayingOffset();
auto next_beat = parse_time_code(timecode);