fix(frontend/test): MkAnimBgで毎回Chromaticの差分が生成されないように

This commit is contained in:
syuilo 2023-05-16 18:41:34 +09:00
parent 0d8e1c5421
commit 153eed7d71
1 changed files with 10 additions and 5 deletions

View File

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