Skip to content

Commit 8e75ac6

Browse files
committed
transition: avoid opacity change for fly-out/slide-out presets
Set opacity to window-raw-opacity-before instead of to 1. Signed-off-by: Yuxuan Shui <[email protected]>
1 parent b631485 commit 8e75ac6

File tree

2 files changed

+107
-64
lines changed

2 files changed

+107
-64
lines changed

data/animation_presets.conf

+12-7
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,11 @@ slide-out = {
7171
crop-y = "window-y";
7272
crop-width = "window-width";
7373
crop-height = "window-height";
74-
opacity = 1;
74+
opacity = {
75+
start = "window-raw-opacity-before";
76+
end = "window-raw-opacity-before";
77+
duration = "placeholder0";
78+
};
7579
blur-opacity = "opacity";
7680
shadow-opacity = "opacity";
7781
*knobs = {
@@ -124,9 +128,13 @@ fly-out = {
124128
offset-y = "v-timing * (1 - placeholder3)";
125129
shadow-offset-x = "offset-x";
126130
shadow-offset-y = "offset-y";
127-
opacity = 1;
128-
shadow-opacity = 1;
129-
blur-opacity = 1;
131+
opacity = {
132+
start = "window-raw-opacity-before";
133+
end = "window-raw-opacity-before";
134+
duration = "placeholder0";
135+
};
136+
shadow-opacity = "opacity";
137+
blur-opacity = "opacity";
130138
*knobs = {
131139
duration = 0.2;
132140
direction = (0, ["up", "down", "left", "right"]);
@@ -151,9 +159,6 @@ fly-in = {
151159
offset-y = "v-timing * (1 - placeholder3)";
152160
shadow-offset-x = "offset-x";
153161
shadow-offset-y = "offset-y";
154-
opacity = 1;
155-
shadow-opacity = 1;
156-
blur-opacity = 1;
157162
*knobs = {
158163
duration = 0.2;
159164
direction = (0, ["up", "down", "left", "right"]);

src/transition/generated/script_templates.c

+95-57
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ static bool win_script_preset__appear(struct win_script *output, config_setting_
445445
}
446446
static struct script *script_template__slide_out(int *output_slots) {
447447
static const struct instruction instrs[] = {
448-
{.type = INST_BRANCH_ONCE, .rel = 42},
448+
{.type = INST_BRANCH_ONCE, .rel = 55},
449449
{.type = INST_LOAD, .slot = 15},
450450
{.type = INST_LOAD, .slot = 14},
451451
{.type = INST_OP, .op = OP_SUB},
@@ -490,11 +490,27 @@ static struct script *script_template__slide_out(int *output_slots) {
490490
{.type = INST_STORE, .slot = 7},
491491
{.type = INST_LOAD_CTX, .ctx = 24},
492492
{.type = INST_STORE, .slot = 8},
493+
{.type = INST_LOAD, .slot = 18},
494+
{.type = INST_LOAD, .slot = 17},
495+
{.type = INST_OP, .op = OP_SUB},
496+
{.type = INST_LOAD, .slot = 12},
497+
{.type = INST_IMM, .imm = 0x0p+0},
498+
{.type = INST_OP, .op = OP_SUB},
499+
{.type = INST_LOAD, .slot = 19},
500+
{.type = INST_OP, .op = OP_DIV},
501+
{
502+
.type = INST_CURVE,
503+
.curve = {.type = CURVE_LINEAR},
504+
},
505+
{.type = INST_OP, .op = OP_MUL},
506+
{.type = INST_LOAD, .slot = 17},
507+
{.type = INST_OP, .op = OP_ADD},
508+
{.type = INST_STORE, .slot = 9},
493509
{.type = INST_LOAD, .slot = 9},
494510
{.type = INST_STORE, .slot = 10},
495511
{.type = INST_LOAD, .slot = 9},
496512
{.type = INST_STORE, .slot = 11},
497-
{.type = INST_BRANCH_ONCE, .rel = 17},
513+
{.type = INST_BRANCH_ONCE, .rel = 21},
498514
{.type = INST_HALT},
499515
{.type = INST_IMM, .imm = 0x0p+0},
500516
{.type = INST_STORE_OVER_NAN, .slot = 14},
@@ -508,9 +524,13 @@ static struct script *script_template__slide_out(int *output_slots) {
508524
{.type = INST_OP, .op = OP_MUL},
509525
{.type = INST_OP, .op = OP_ADD},
510526
{.type = INST_STORE, .slot = 15},
511-
{.type = INST_IMM, .imm = 0x1p+0},
512-
{.type = INST_STORE, .slot = 9},
513-
{.type = INST_BRANCH, .rel = -55},
527+
{.type = INST_LOAD_CTX, .ctx = 64},
528+
{.type = INST_STORE_OVER_NAN, .slot = 17},
529+
{.type = INST_LOAD_CTX, .ctx = 1073741824},
530+
{.type = INST_STORE, .slot = 19},
531+
{.type = INST_LOAD_CTX, .ctx = 64},
532+
{.type = INST_STORE, .slot = 18},
533+
{.type = INST_BRANCH, .rel = -72},
514534
{.type = INST_IMM, .imm = 0x0p+0},
515535
{.type = INST_STORE, .slot = 13},
516536
{.type = INST_LOAD, .slot = 16},
@@ -519,12 +539,18 @@ static struct script *script_template__slide_out(int *output_slots) {
519539
{.type = INST_LOAD, .slot = 13},
520540
{.type = INST_OP, .op = OP_MAX},
521541
{.type = INST_STORE, .slot = 13},
542+
{.type = INST_LOAD, .slot = 19},
543+
{.type = INST_IMM, .imm = 0x0p+0},
544+
{.type = INST_OP, .op = OP_ADD},
545+
{.type = INST_LOAD, .slot = 13},
546+
{.type = INST_OP, .op = OP_MAX},
547+
{.type = INST_STORE, .slot = 13},
522548
{.type = INST_HALT},
523549
};
524550
struct script *ret = malloc(offsetof(struct script, instrs) + sizeof(instrs));
525551
ret->len = ARR_SIZE(instrs);
526552
ret->elapsed_slot = 12;
527-
ret->n_slots = 17;
553+
ret->n_slots = 20;
528554
ret->stack_size = 3;
529555
ret->vars = NULL;
530556
ret->overrides = NULL;
@@ -606,6 +632,11 @@ static struct script *script_template__slide_out(int *output_slots) {
606632
*override = (struct overridable_slot){.name = strdup("v-timing"), .slot = 14};
607633
HASH_ADD_STR(ret->overrides, name, override);
608634
}
635+
{
636+
struct overridable_slot *override = malloc(sizeof(*override));
637+
*override = (struct overridable_slot){.name = strdup("opacity"), .slot = 17};
638+
HASH_ADD_STR(ret->overrides, name, override);
639+
}
609640
output_slots[0] = 1;
610641
output_slots[1] = 2;
611642
output_slots[2] = 3;
@@ -872,7 +903,7 @@ static bool win_script_preset__slide_in(struct win_script *output, config_settin
872903
}
873904
static struct script *script_template__fly_out(int *output_slots) {
874905
static const struct instruction instrs[] = {
875-
{.type = INST_BRANCH_ONCE, .rel = 30},
906+
{.type = INST_BRANCH_ONCE, .rel = 47},
876907
{.type = INST_LOAD, .slot = 11},
877908
{.type = INST_LOAD, .slot = 10},
878909
{.type = INST_OP, .op = OP_SUB},
@@ -909,6 +940,26 @@ static struct script *script_template__fly_out(int *output_slots) {
909940
{.type = INST_STORE, .slot = 3},
910941
{.type = INST_LOAD, .slot = 2},
911942
{.type = INST_STORE, .slot = 4},
943+
{.type = INST_LOAD, .slot = 14},
944+
{.type = INST_LOAD, .slot = 13},
945+
{.type = INST_OP, .op = OP_SUB},
946+
{.type = INST_LOAD, .slot = 8},
947+
{.type = INST_IMM, .imm = 0x0p+0},
948+
{.type = INST_OP, .op = OP_SUB},
949+
{.type = INST_LOAD, .slot = 15},
950+
{.type = INST_OP, .op = OP_DIV},
951+
{
952+
.type = INST_CURVE,
953+
.curve = {.type = CURVE_LINEAR},
954+
},
955+
{.type = INST_OP, .op = OP_MUL},
956+
{.type = INST_LOAD, .slot = 13},
957+
{.type = INST_OP, .op = OP_ADD},
958+
{.type = INST_STORE, .slot = 5},
959+
{.type = INST_LOAD, .slot = 5},
960+
{.type = INST_STORE, .slot = 6},
961+
{.type = INST_LOAD, .slot = 5},
962+
{.type = INST_STORE, .slot = 7},
912963
{.type = INST_BRANCH_ONCE, .rel = 29},
913964
{.type = INST_HALT},
914965
{.type = INST_IMM, .imm = 0x0p+0},
@@ -931,13 +982,13 @@ static struct script *script_template__fly_out(int *output_slots) {
931982
{.type = INST_OP, .op = OP_MUL},
932983
{.type = INST_OP, .op = OP_ADD},
933984
{.type = INST_STORE, .slot = 11},
934-
{.type = INST_IMM, .imm = 0x1p+0},
935-
{.type = INST_STORE, .slot = 5},
936-
{.type = INST_IMM, .imm = 0x1p+0},
937-
{.type = INST_STORE, .slot = 6},
938-
{.type = INST_IMM, .imm = 0x1p+0},
939-
{.type = INST_STORE, .slot = 7},
940-
{.type = INST_BRANCH, .rel = -55},
985+
{.type = INST_LOAD_CTX, .ctx = 64},
986+
{.type = INST_STORE_OVER_NAN, .slot = 13},
987+
{.type = INST_LOAD_CTX, .ctx = 1073741824},
988+
{.type = INST_STORE, .slot = 15},
989+
{.type = INST_LOAD_CTX, .ctx = 64},
990+
{.type = INST_STORE, .slot = 14},
991+
{.type = INST_BRANCH, .rel = -72},
941992
{.type = INST_IMM, .imm = 0x0p+0},
942993
{.type = INST_STORE, .slot = 9},
943994
{.type = INST_LOAD, .slot = 12},
@@ -946,12 +997,18 @@ static struct script *script_template__fly_out(int *output_slots) {
946997
{.type = INST_LOAD, .slot = 9},
947998
{.type = INST_OP, .op = OP_MAX},
948999
{.type = INST_STORE, .slot = 9},
1000+
{.type = INST_LOAD, .slot = 15},
1001+
{.type = INST_IMM, .imm = 0x0p+0},
1002+
{.type = INST_OP, .op = OP_ADD},
1003+
{.type = INST_LOAD, .slot = 9},
1004+
{.type = INST_OP, .op = OP_MAX},
1005+
{.type = INST_STORE, .slot = 9},
9491006
{.type = INST_HALT},
9501007
};
9511008
struct script *ret = malloc(offsetof(struct script, instrs) + sizeof(instrs));
9521009
ret->len = ARR_SIZE(instrs);
9531010
ret->elapsed_slot = 8;
954-
ret->n_slots = 13;
1011+
ret->n_slots = 16;
9551012
ret->stack_size = 3;
9561013
ret->vars = NULL;
9571014
ret->overrides = NULL;
@@ -1009,6 +1066,11 @@ static struct script *script_template__fly_out(int *output_slots) {
10091066
*override = (struct overridable_slot){.name = strdup("v-timing"), .slot = 10};
10101067
HASH_ADD_STR(ret->overrides, name, override);
10111068
}
1069+
{
1070+
struct overridable_slot *override = malloc(sizeof(*override));
1071+
*override = (struct overridable_slot){.name = strdup("opacity"), .slot = 13};
1072+
HASH_ADD_STR(ret->overrides, name, override);
1073+
}
10121074
output_slots[0] = 1;
10131075
output_slots[1] = 2;
10141076
output_slots[2] = 3;
@@ -1088,12 +1150,12 @@ static struct script *script_template__fly_in(int *output_slots) {
10881150
static const struct instruction instrs[] = {
10891151
{.type = INST_BRANCH_ONCE, .rel = 30},
10901152
{.type = INST_IMM, .imm = 0x0p+0},
1091-
{.type = INST_LOAD, .slot = 10},
1153+
{.type = INST_LOAD, .slot = 7},
10921154
{.type = INST_OP, .op = OP_SUB},
1093-
{.type = INST_LOAD, .slot = 8},
1155+
{.type = INST_LOAD, .slot = 5},
10941156
{.type = INST_IMM, .imm = 0x0p+0},
10951157
{.type = INST_OP, .op = OP_SUB},
1096-
{.type = INST_LOAD, .slot = 11},
1158+
{.type = INST_LOAD, .slot = 8},
10971159
{.type = INST_OP, .op = OP_DIV},
10981160
{
10991161
.type = INST_CURVE,
@@ -1106,7 +1168,7 @@ static struct script *script_template__fly_in(int *output_slots) {
11061168
.cy = 0x1.0147ae147ae16p+1}},
11071169
},
11081170
{.type = INST_OP, .op = OP_MUL},
1109-
{.type = INST_LOAD, .slot = 10},
1171+
{.type = INST_LOAD, .slot = 7},
11101172
{.type = INST_OP, .op = OP_ADD},
11111173
{.type = INST_STORE, .slot = 0},
11121174
{.type = INST_LOAD, .slot = 0},
@@ -1123,7 +1185,7 @@ static struct script *script_template__fly_in(int *output_slots) {
11231185
{.type = INST_STORE, .slot = 3},
11241186
{.type = INST_LOAD, .slot = 2},
11251187
{.type = INST_STORE, .slot = 4},
1126-
{.type = INST_BRANCH_ONCE, .rel = 27},
1188+
{.type = INST_BRANCH_ONCE, .rel = 21},
11271189
{.type = INST_HALT},
11281190
{.type = INST_LOAD_CTX, .ctx = 24},
11291191
{.type = INST_LOAD_CTX, .ctx = 1073741832},
@@ -1140,30 +1202,24 @@ static struct script *script_template__fly_in(int *output_slots) {
11401202
{.type = INST_LOAD_CTX, .ctx = 1073741840},
11411203
{.type = INST_OP, .op = OP_MUL},
11421204
{.type = INST_OP, .op = OP_ADD},
1143-
{.type = INST_STORE_OVER_NAN, .slot = 10},
1205+
{.type = INST_STORE_OVER_NAN, .slot = 7},
11441206
{.type = INST_LOAD_CTX, .ctx = 1073741824},
1145-
{.type = INST_STORE, .slot = 11},
1146-
{.type = INST_IMM, .imm = 0x1p+0},
1147-
{.type = INST_STORE, .slot = 5},
1148-
{.type = INST_IMM, .imm = 0x1p+0},
1149-
{.type = INST_STORE, .slot = 6},
1150-
{.type = INST_IMM, .imm = 0x1p+0},
1151-
{.type = INST_STORE, .slot = 7},
1152-
{.type = INST_BRANCH, .rel = -53},
1207+
{.type = INST_STORE, .slot = 8},
1208+
{.type = INST_BRANCH, .rel = -47},
11531209
{.type = INST_IMM, .imm = 0x0p+0},
1154-
{.type = INST_STORE, .slot = 9},
1155-
{.type = INST_LOAD, .slot = 11},
1210+
{.type = INST_STORE, .slot = 6},
1211+
{.type = INST_LOAD, .slot = 8},
11561212
{.type = INST_IMM, .imm = 0x0p+0},
11571213
{.type = INST_OP, .op = OP_ADD},
1158-
{.type = INST_LOAD, .slot = 9},
1214+
{.type = INST_LOAD, .slot = 6},
11591215
{.type = INST_OP, .op = OP_MAX},
1160-
{.type = INST_STORE, .slot = 9},
1216+
{.type = INST_STORE, .slot = 6},
11611217
{.type = INST_HALT},
11621218
};
11631219
struct script *ret = malloc(offsetof(struct script, instrs) + sizeof(instrs));
11641220
ret->len = ARR_SIZE(instrs);
1165-
ret->elapsed_slot = 8;
1166-
ret->n_slots = 12;
1221+
ret->elapsed_slot = 5;
1222+
ret->n_slots = 9;
11671223
ret->stack_size = 3;
11681224
ret->vars = NULL;
11691225
ret->overrides = NULL;
@@ -1198,36 +1254,18 @@ static struct script *script_template__fly_in(int *output_slots) {
11981254
.name = strdup("shadow-offset-y"), .slot = 4, .index = 4};
11991255
HASH_ADD_STR(ret->vars, name, var);
12001256
}
1201-
{
1202-
struct variable_allocation *var = malloc(sizeof(*var));
1203-
*var = (struct variable_allocation){
1204-
.name = strdup("opacity"), .slot = 5, .index = 5};
1205-
HASH_ADD_STR(ret->vars, name, var);
1206-
}
1207-
{
1208-
struct variable_allocation *var = malloc(sizeof(*var));
1209-
*var = (struct variable_allocation){
1210-
.name = strdup("shadow-opacity"), .slot = 6, .index = 6};
1211-
HASH_ADD_STR(ret->vars, name, var);
1212-
}
1213-
{
1214-
struct variable_allocation *var = malloc(sizeof(*var));
1215-
*var = (struct variable_allocation){
1216-
.name = strdup("blur-opacity"), .slot = 7, .index = 7};
1217-
HASH_ADD_STR(ret->vars, name, var);
1218-
}
12191257
{
12201258
struct overridable_slot *override = malloc(sizeof(*override));
1221-
*override = (struct overridable_slot){.name = strdup("v-timing"), .slot = 10};
1259+
*override = (struct overridable_slot){.name = strdup("v-timing"), .slot = 7};
12221260
HASH_ADD_STR(ret->overrides, name, override);
12231261
}
12241262
output_slots[0] = 1;
12251263
output_slots[1] = 2;
12261264
output_slots[2] = 3;
12271265
output_slots[3] = 4;
1228-
output_slots[4] = 5;
1229-
output_slots[5] = 7;
1230-
output_slots[6] = 6;
1266+
output_slots[4] = -1;
1267+
output_slots[5] = -1;
1268+
output_slots[6] = -1;
12311269
output_slots[7] = -1;
12321270
output_slots[8] = -1;
12331271
output_slots[9] = -1;

0 commit comments

Comments
 (0)