fix: only animate keyboard separator when splitting (#696)
This commit is contained in:
committed by
László Monda
parent
114014fa13
commit
a208a264c7
@@ -17,7 +17,7 @@
|
|||||||
(keyHover)="onKeyHover($event.index, $event.event, $event.over, i)"
|
(keyHover)="onKeyHover($event.index, $event.event, $event.over, i)"
|
||||||
(capture)="onCapture(i, $event.index, $event.captured)" />
|
(capture)="onCapture(i, $event.index, $event.captured)" />
|
||||||
|
|
||||||
<svg:path [ngClass]="{'separator-visible': !halvesSplit, 'separator-hide': halvesSplit}"
|
<svg:path [@fadeSeparator]="separatorAnimation"
|
||||||
[attr.d]="separator.d"
|
[attr.d]="separator.d"
|
||||||
[attr.style]="separatorStyle" />
|
[attr.style]="separatorStyle" />
|
||||||
</svg>
|
</svg>
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
@@ -8,33 +8,3 @@ editable-text {
|
|||||||
padding-right: 2em;
|
padding-right: 2em;
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
.separator-visible {
|
|
||||||
animation: visible-fade-in 1.5s;
|
|
||||||
opacity: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes visible-fade-in {
|
|
||||||
0% {
|
|
||||||
opacity: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
100% {
|
|
||||||
opacity: 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.separator-hide {
|
|
||||||
animation: visible-fade-out 1.5s;
|
|
||||||
opacity: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes visible-fade-out {
|
|
||||||
0% {
|
|
||||||
opacity: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
100% {
|
|
||||||
opacity: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -22,6 +22,16 @@ import { SvgSeparator } from '../separator';
|
|||||||
transform: 'translate(3%, 15%) rotate(-4deg) scale(0.92, 0.92)'
|
transform: 'translate(3%, 15%) rotate(-4deg) scale(0.92, 0.92)'
|
||||||
})),
|
})),
|
||||||
transition('* <=> *', animate(500))
|
transition('* <=> *', animate(500))
|
||||||
|
]),
|
||||||
|
trigger('fadeSeparator', [
|
||||||
|
state('visible', style({
|
||||||
|
opacity: 1
|
||||||
|
})),
|
||||||
|
state('invisible', style({
|
||||||
|
opacity: 0
|
||||||
|
})),
|
||||||
|
transition('visible => invisible', animate(500)),
|
||||||
|
transition('invisible => visible', animate(1500))
|
||||||
])
|
])
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
@@ -45,6 +55,7 @@ export class SvgKeyboardComponent implements OnInit {
|
|||||||
moduleAnimationStates: string[];
|
moduleAnimationStates: string[];
|
||||||
separator: SvgSeparator;
|
separator: SvgSeparator;
|
||||||
separatorStyle: SafeStyle;
|
separatorStyle: SafeStyle;
|
||||||
|
separatorAnimation = 'visible';
|
||||||
|
|
||||||
constructor(private svgModuleProvider: SvgModuleProviderService,
|
constructor(private svgModuleProvider: SvgModuleProviderService,
|
||||||
private sanitizer: DomSanitizer) {
|
private sanitizer: DomSanitizer) {
|
||||||
@@ -96,8 +107,10 @@ export class SvgKeyboardComponent implements OnInit {
|
|||||||
private updateModuleAnimationStates() {
|
private updateModuleAnimationStates() {
|
||||||
if (this.halvesSplit) {
|
if (this.halvesSplit) {
|
||||||
this.moduleAnimationStates = ['rotateRight', 'rotateLeft'];
|
this.moduleAnimationStates = ['rotateRight', 'rotateLeft'];
|
||||||
|
this.separatorAnimation = 'invisible';
|
||||||
} else {
|
} else {
|
||||||
this.moduleAnimationStates = [];
|
this.moduleAnimationStates = [];
|
||||||
|
this.separatorAnimation = 'visible';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user