16#ifndef a60_SVG_SEQUENCES_H
17#define a60_SVG_SEQUENCES_H 1
35 size_t fps = 30,
double sec = 1.0,
double maxopac = 1.0)
38 size_t framesn = fps * sec;
39 double step = maxopac / framesn;
43 style sty = { klr, 0.0, klr, 0.0, 0 };
44 for (
size_t i = 0; i < framesn; ++i)
49 double opacity = i * step;
56 ret.push_back(rsvg.
str());
66 size_t fps = 30,
double sec = 1.0,
double minopac = 0)
69 std::reverse(ret.begin(), ret.end());
81 size_t fps,
double sec,
82 double twhen,
size_t nblinks,
double blinksec)
85 size_t framesn = fps * sec;
86 size_t startn = fps * twhen;
87 size_t blinkframesn = (fps * blinksec) + 1;
88 size_t blinkn = blinkframesn * nblinks;
90 if (startn + blinkn > framesn)
91 throw std::logic_error(
"blink:: desired frames exceed total duration");
95 double transparent(0.0);
96 style sty = { klr, 0.0, klr, 0.0, 0 };
99 for (
size_t i = 0; i < startn; ++i)
107 ret.push_back(rsvg.
str());
111 for (
size_t i = 0; i < nblinks; ++i)
113 for (
size_t j = 0; j < blinkframesn - 1; ++j)
121 ret.push_back(rsvg.
str());
130 ret.push_back(rsvg.
str());
134 for (
size_t i = startn + blinkn; i < framesn; ++i)
142 ret.push_back(rsvg.
str());
155 size_t fps,
double sec,
156 double twhen,
double maxclose,
double winksec)
161 size_t framesn = fps * sec;
162 size_t startn = fps * twhen;
163 size_t winkframesn = (fps * winksec) + 1;
164 size_t winkframeshalfn = winkframesn / 2;
167 if (startn + winkframesn >= framesn)
168 throw std::logic_error(
"wink:: desired frames exceed total duration");
172 double transparent(0.0);
173 style sty = { klr, 0.0, klr, 0.0, 0 };
176 for (
size_t i = 0; i < startn; ++i)
184 ret.push_back(rsvg.
str());
189 double ymax = ymid * maxclose;
200 const double step = 2 * ymax / winkframesn;
203 for (
size_t j = 0; j < winkframeshalfn; ++j)
206 double offsetn = j * step;
224 ret.push_back(r1.
str() + r2.
str());
228 for (
size_t j = 0; j < winkframeshalfn; ++j)
231 double offsetn = (winkframeshalfn - j) * step;
249 ret.push_back(r1.
str() + r2.
str());
253 for (
size_t i = startn + winkframesn; i < framesn; ++i)
261 ret.push_back(rsvg.
str());
272 size_t ,
double step = 10,
273 int blursz = 200,
int solidsz = 133,
double opac = 0.6)
278 const int blurr = 20;
281 const double vblursz = blursz / 2;
282 const double vsolidsz = solidsz / 2;
285 double x = (drin.
_M_height + (2 * blursz) + (3 * blurr)) / step;
286 size_t framesn =
static_cast<size_t>(x);
288 style sty = { klr, 1.0, klr, 0.0, 0 };
311 for (
size_t i = 0; i < framesn; ++i)
313 double stepn = i * step;
332 std::ostringstream ostrt;
333 ostrt <<
"rotate(180, 960, " << yblurb - vblursz <<
")";
338 string scene(rsvg1.
str() + rsvg3.
str());
349 ret.push_back(scene + rsvgfg.
str());
360 const int maxwidth = 8,
const int maxheight = 4,
368 static std::mt19937_64 rg(std::random_device{}());
369 auto distw = std::uniform_int_distribution<>(0, maxwidth);
370 auto disth = std::uniform_int_distribution<>(0, maxheight);
371 auto distb = std::uniform_int_distribution<>(0, 1);
372 const int gwidth = distw(rg);
373 const int gheight = disth(rg);
381 style sty = { klr, .9, klr, 0.0, 0 };
384 for (
auto iheight = 0; iheight < gheight; iheight++)
386 for (
auto iwidth = 0; iwidth < gwidth; iwidth++)
388 const bool b = distb(rg);
440 size_t fps = 30,
double sec = 1.0,
441 const int radius = 80,
442 const int maxw = 8,
const int maxh = 4,
443 const int xstart = 40,
const int ystart = 100)
446 size_t framesn = fps * sec;
447 size_t step_size = 4 + 17 + 4;
448 for (
size_t i = 1; i + step_size < framesn; i += step_size)
450 string dotpattern1 =
dot_grid_seq(drin, klr, radius, maxw, maxh,
452 ret.push_back(dotpattern1);
453 string dotpattern2 =
dot_grid_seq(drin, klr, radius, maxw, maxh,
455 ret.push_back(dotpattern2);
458 ret.insert(ret.end(), 17, empty);
460 string dotpattern3 =
dot_grid_seq(drin, klr, radius, maxw, maxh,
462 ret.push_back(dotpattern3);
463 string dotpattern4 =
dot_grid_seq(drin, klr, radius, maxw, maxh,
465 ret.push_back(dotpattern4);
485 const style styl = { klr, 1.0, klr, 0.0, 0 };
486 const size_t framesn = fps * sec;
488 const auto offset(width / framesn);
491 for (
size_t i = 0; i < framesn; ++i)
507 ret.push_back(r.
str() + img.
str());
void add_filter(const string id)
void add_data(const data &d)
Either serialize immediately (as below), or create data structure that adds data to data_vec and then...
void add_style(const style &sty)
void add_data(const data &d, string trans="")
void add_transform(const string s)
Common transforms include rotate(180)
void add_data(const data &d)
Either serialize immediately (as below), or create data structure that adds data to data_vec and then...
void start_element(const string &id)
string dot_grid_seq(const rect_element::data &drin, const color klr, const rect_element::atype radius=80, const int maxwidth=8, const int maxheight=4, const rect_element::atype xstart=40, const rect_element::atype ystart=100)
Randomly create grid of [maxwidth] x [maxheight] grid, and fill with dots.
strings swipe_left_seq(const rect_element::data &drin, const string imgf, const color klr=color::white, size_t fps=30, double sec=9)
1 channel start with image, background color is klr each "frame" == string in returned strings has an...
color
Color enumerated as types.
strings fade_to_color_seq(const rect_element::data &dr, const color klr, size_t fps=30, double sec=1.0, double maxopac=1.0)
strings wink_to_color_seq(const rect_element::data &dr, const color klr, size_t fps, double sec, double twhen, double maxclose, double winksec)
wink sequence of duration sec, given fps to color klr starts on background transparent,...
strings fade_from_color_seq(const rect_element::data &dr, const color klr, size_t fps=30, double sec=1.0, double minopac=0)
Start rectangle as transparent, fade to color.
strings vertical_sync_roll_seq(const rect_element::data &drin, const color klr, size_t, double step=10, int blursz=200, int solidsz=133, double opac=0.6)
Simulated vertical roll, with fades. r == frame size.
strings blink_to_color_seq(const rect_element::data &dr, const color klr, size_t fps, double sec, double twhen, size_t nblinks, double blinksec)
blink sequence of duration sec, given fps starts on background (backgf) at duration twhen blinks spec...
strings optical_sound_dots_seq(const rect_element::data &drin, const color klr, size_t fps=30, double sec=1.0, const int radius=80, const int maxw=8, const int maxh=4, const int xstart=40, const int ystart=100)
std::vector< string > strings
Datum consolidating style preferences.