Skip to content

Commit

Permalink
fix(frontend/test): MkAnimBgで毎回Chromaticの差分が生成されないように
Browse files Browse the repository at this point in the history
  • Loading branch information
syuilo committed May 16, 2023
1 parent 0d8e1c5 commit 153eed7
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions packages/frontend/src/components/MkAnimBg.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<script lang="ts" setup>
import { onMounted, onUnmounted, shallowRef } from 'vue';
import { defaultStore } from '@/store';
import isChromatic from 'chromatic/isChromatic';
const canvasEl = shallowRef<HTMLCanvasElement>();
Expand Down Expand Up @@ -204,14 +204,19 @@ onMounted(() => {
const vertices = [1.0, 1.0, -1.0, 1.0, 1.0, -1.0, -1.0, -1.0];
gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(vertices), gl.DYNAMIC_DRAW);
function render(timeStamp) {
gl!.uniform1f(u_time, timeStamp);
if (isChromatic()) {
gl!.uniform1f(u_time, 0);
gl!.drawArrays(gl!.TRIANGLE_STRIP, 0, 4);
} else {
function render(timeStamp) {
gl!.uniform1f(u_time, timeStamp);
gl!.drawArrays(gl!.TRIANGLE_STRIP, 0, 4);
handle = window.requestAnimationFrame(render);
}
handle = window.requestAnimationFrame(render);
}
handle = window.requestAnimationFrame(render);
});
onUnmounted(() => {
Expand Down

1 comment on commit 153eed7

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Chromatic detects changes. Please review the changes on Chromatic.

Please sign in to comment.