Add some transitions
This commit is contained in:
parent
9b8a42f9e6
commit
bdccc93bf9
2 changed files with 11 additions and 4 deletions
|
@ -1,7 +1,9 @@
|
||||||
<svelte:options immutable />
|
<svelte:options immutable />
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
import { expoOut } from "svelte/easing";
|
||||||
import type { Writable } from "svelte/store";
|
import type { Writable } from "svelte/store";
|
||||||
|
import { slide } from "svelte/transition";
|
||||||
|
|
||||||
import { Message, MessageType } from "../shark/Message";
|
import { Message, MessageType } from "../shark/Message";
|
||||||
import { SharkGame } from "../shark/SharkGame";
|
import { SharkGame } from "../shark/SharkGame";
|
||||||
|
@ -49,9 +51,12 @@
|
||||||
}}>Clear log</button
|
}}>Clear log</button
|
||||||
>
|
>
|
||||||
<ol>
|
<ol>
|
||||||
{#each displayMessages as message, i}
|
{#each displayMessages as message, i (message)}
|
||||||
{#if i < logLength}
|
{#if i < logLength}
|
||||||
<li class={(message.isEven ? "even" : "odd") + " " + message.type}>
|
<li
|
||||||
|
transition:slide={{ easing: expoOut }}
|
||||||
|
class={(message.isEven ? "even" : "odd") + " " + message.type}
|
||||||
|
>
|
||||||
{message}
|
{message}
|
||||||
</li>
|
</li>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
<svelte:options immutable />
|
<svelte:options immutable />
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
import { fade } from "svelte/transition";
|
||||||
|
|
||||||
import type { Resource } from "../../shark/data/Resources";
|
import type { Resource } from "../../shark/data/Resources";
|
||||||
|
|
||||||
export let categoryName: string;
|
export let categoryName: string;
|
||||||
|
@ -14,10 +16,10 @@
|
||||||
</tr>
|
</tr>
|
||||||
{#if !collapsed}
|
{#if !collapsed}
|
||||||
{#each resources as [resourceName, resource], index}
|
{#each resources as [resourceName, resource], index}
|
||||||
<tr class={index % 2 === 0 ? "even" : "odd"}>
|
<tr transition:fade class={index % 2 === 0 ? "even" : "odd"}>
|
||||||
<td colspan="2">{resourceName}</td>
|
<td colspan="2">{resourceName}</td>
|
||||||
<td>{resource.amount}</td>
|
<td>{resource.amount}</td>
|
||||||
<td>{Math.round(100 * resource.change) / 100}/s</td>
|
<td>{Math.round(100 * (resource.change + Number.EPSILON)) / 100}/s</td>
|
||||||
</tr>
|
</tr>
|
||||||
{/each}
|
{/each}
|
||||||
{/if}
|
{/if}
|
||||||
|
|
Reference in a new issue