The input is mirrored horizontally, vertically, or along both axes.
Also known as: FlipImage flip
Moves in browsers that support WebGPU
This device could not render the demo — showing a still
Code reflects the control values
React
// Renders only in browsers with WebGPU.
// /samples/… are this site’s sample files — point them at your own image or video.
import { Shader, Flip, ImageTexture } from 'shaders/react'
export default function ShaderEffect() {
return (
<Shader style={{ width: '100%', height: 320 }} disableTelemetry>
<ImageTexture
objectFit="cover"
url="/samples/poster.jpg" />
<Flip
flipX={true} />
</Shader>
)
}
Vue
<!-- Renders only in browsers with WebGPU. -->
<!-- /samples/… are this site’s sample files — point them at your own image or video. -->
<script setup lang="ts">
import { Shader, Flip, ImageTexture } from 'shaders/vue'
</script>
<template>
<Shader style="width: 100%; height: 320px" :disable-telemetry="true">
<ImageTexture
object-fit="cover"
url="/samples/poster.jpg"/>
<Flip
:flip-x="true"/>
</Shader>
</template>
Svelte
<!-- Renders only in browsers with WebGPU. -->
<!-- /samples/… are this site’s sample files — point them at your own image or video. -->
<script>
import { Shader, Flip, ImageTexture } from 'shaders/svelte'
</script>
<Shader style="width: 100%; height: 320px" disableTelemetry>
<ImageTexture
objectFit="cover"
url="/samples/poster.jpg" />
<Flip
flipX={true} />
</Shader>
Solid
// Renders only in browsers with WebGPU.
// /samples/… are this site’s sample files — point them at your own image or video.
import { Shader, Flip, ImageTexture } from 'shaders/solid'
export default function ShaderEffect() {
return (
<Shader style={{ width: '100%', height: '320px' }} disableTelemetry>
<ImageTexture
objectFit="cover"
url="/samples/poster.jpg" />
<Flip
flipX={true} />
</Shader>
)
}
JavaScript
// Renders only in browsers with WebGPU.
// /samples/… are this site’s sample files — point them at your own image or video.
// expects <canvas id="canvas" style="width:100%;height:320px"></canvas> on the page
import { createShader } from 'shaders/js'
const shader = await createShader(document.getElementById("canvas"), {
components: [
{
type: 'ImageTexture',
props: {
objectFit: 'cover',
url: '/samples/poster.jpg',
},
},
{
type: 'Flip',
props: {
flipX: true,
},
}
]
}, { disableTelemetry: true })
Props · Flip
Changes apply to the demo above and to the code tabs. Descriptions come from the library registry (MIT).
Name
Value
Default
Range / options
Description
flipXFlip X
false
—
Mirror the content horizontally (left ↔ right)
flipYFlip Y
false
—
Mirror the content vertically (top ↔ bottom)
Every component also takes blendMode · opacity · visible · maskSource/maskType · boundingBox · id
Like turning a photo over in a mirror, this effect reverses the input along one or both axes.
Enable `flipX` to reverse left and right, and `flipY` to reverse top and bottom. Enable both to flip along both axes.
Apply it above an image layer. Unlike `Mirror`, which creates a reflected arrangement within the image, `Flip` reverses the whole input. Check that text, directional symbols, and asymmetric logos do not end up backward.
When to use
Use it to change a photo's orientation, align a symmetrical composition, or rearrange directional imagery. Avoid it when text or objects must preserve their direction.