Skip to content

Commit

Permalink
Merge pull request #26 from flixlix/inverted-animation
Browse files Browse the repository at this point in the history
added `inverted_animation` for individual devices
  • Loading branch information
flixlix authored Mar 27, 2023
2 parents aca8d1d + 215edad commit bbfab00
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
4 changes: 3 additions & 1 deletion src/power-flow-card-plus-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export interface PowerFlowCardConfig extends LovelaceCardConfig {
color?: ComboEntity;
color_icon?: boolean | "production" | "consumption";
display_state?: "two_way" | "one_way" | "one_way_no_zero";
}
};
grid?: {
entity: string | ComboEntity;
name?: string;
Expand Down Expand Up @@ -49,6 +49,7 @@ export interface PowerFlowCardConfig extends LovelaceCardConfig {
color?: string;
color_icon?: boolean;
display_zero?: boolean;
inverted_animation?: boolean;
};
individual2?: {
entity: string;
Expand All @@ -57,6 +58,7 @@ export interface PowerFlowCardConfig extends LovelaceCardConfig {
color?: string;
color_icon?: boolean;
display_zero?: boolean;
inverted_animation?: boolean;
};
};
dashboard_link?: string;
Expand Down
22 changes: 17 additions & 5 deletions src/power-flow-card-plus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,11 @@ export class PowerFlowCard extends LitElement {
dur="1.66s"
repeatCount="indefinite"
calcMode="linear"
keyPoints="1;0"
keyPoints=${
entities.individual2?.inverted_animation
? "0;1"
: "1;0"
}
keyTimes="0;1"
>
<mpath xlink:href="#individual2" />
Expand Down Expand Up @@ -749,9 +753,13 @@ export class PowerFlowCard extends LitElement {
<animateMotion
dur="1.66s"
repeatCount="indefinite"
calcMode="linear"
keyPoints="1;0"
keyPoints=${
entities.individual1?.inverted_animation
? "0;1"
: "1;0"
}
keyTimes="0;1"
>
<mpath xlink:href="#individual1" />
</animateMotion>
Expand Down Expand Up @@ -1126,8 +1134,12 @@ export class PowerFlowCard extends LitElement {
dur="1.66s"
repeatCount="indefinite"
calcMode="linear"
keyPoints="1;0"
keyTimes="0;1"
keyPoints=${
entities.individual1?.inverted_animation
? "0;1"
: "1;0"
}
keyTimes="0;1"
>
<mpath xlink:href="#individual1" />
</animateMotion>
Expand Down

0 comments on commit bbfab00

Please sign in to comment.