Add animation to container

This commit is contained in:
Siklos 2022-08-01 19:21:13 +02:00
parent 42d2d20fd0
commit 6ac76f6619

View file

@ -23,11 +23,18 @@ export class Container extends React.Component<IContainerProps> {
public render(): React.ReactNode { public render(): React.ReactNode {
const containersElements = this.props.children.map(child => child.render()); const containersElements = this.props.children.map(child => child.render());
const style = Object.assign({}, this.props.properties); const defaultStyle = {
transitionProperty: 'all',
transitionTimingFunction: 'cubic-bezier(0.4, 0, 0.2, 1)',
transitionDuration: '150ms'
} as React.CSSProperties;
const style = Object.assign(defaultStyle, this.props.properties);
style.x = 0; style.x = 0;
style.y = 0; style.y = 0;
return ( return (
<g <g
style={defaultStyle}
transform={`translate(${this.props.properties.x}, ${this.props.properties.y})`} transform={`translate(${this.props.properties.x}, ${this.props.properties.y})`}
key={`container-${this.props.properties.id}`} key={`container-${this.props.properties.id}`}
> >