Skip to content

Commit

Permalink
playground: optimize demos
Browse files Browse the repository at this point in the history
  • Loading branch information
Sunny-117 committed Apr 26, 2024
1 parent 4ca83fc commit a117c8b
Show file tree
Hide file tree
Showing 9 changed files with 64 additions and 104 deletions.
Binary file added playground/public/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 8 additions & 20 deletions playground/src/App.vue
Original file line number Diff line number Diff line change
@@ -1,25 +1,13 @@
<template>
<canvas></canvas>
<video-demo></video-demo>
<text-demo></text-demo>
<div style="display: flex; justify-content: space-between; margin-top: 10px;">
<image-demo></image-demo>
<video-demo></video-demo>
</div>
</template>

<script setup>
import { createTextImage } from '@sunny-117/text-image';
import TextDemo from './TextDemo.vue'
import ImageDemo from './ImageDemo.vue'
import VideoDemo from './VideoDemo.vue'
import {onMounted} from 'vue';
onMounted(() => {
createTextImage({
canvas: document.querySelector('canvas'),
source: {
text: 'Text Image',
},
});
})
</script>

<style scoped>
.titleBox {
background-color: blueviolet;
}
</style>
</script>
23 changes: 23 additions & 0 deletions playground/src/ImageDemo.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<template>
<canvas id="canvas2"></canvas>
</template>

<script setup>
import { createTextImage } from "@sunny-117/text-image";
import { onMounted } from "vue";
onMounted(() => {
const canvas = document.querySelector("#canvas2");
console.log(canvas)
createTextImage({
canvas,
raduis: 7,
isGray: true,
source: {
img: "../public/1.png",
width: 800,
height: 700,
},
});
});
</script>
25 changes: 25 additions & 0 deletions playground/src/TextDemo.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<template>
<canvas id="canvas1" style="width: 1000px;margin: 0 auto;"></canvas>
</template>

<script setup>
import { createTextImage } from "@sunny-117/text-image";
import { onMounted } from "vue";
onMounted(() => {
createTextImage({
canvas: document.querySelector("#canvas1"),
source: {
text: "Text Image",
width: 500,
height: 300,
},
});
});
</script>

<style scoped>
.titleBox {
background-color: blueviolet;
}
</style>
7 changes: 4 additions & 3 deletions playground/src/VideoDemo.vue
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
<template>
<canvas id="can1"></canvas>
<canvas id="can2"></canvas>
<canvas id="canvas3"></canvas>
</template>
<script setup>
import { onMounted } from "vue";
import { createTextImage } from "@sunny-117/text-image";
onMounted(() => {
createTextImage({
canvas: document.querySelector("#can1"),
canvas: document.querySelector("#canvas3"),
replaceText: "6",
source: {
video: "../public/1.mp4",
width: 500,
height: 700,
},
});
});
Expand Down
Binary file added playground/src/assets/1.mp4
Binary file not shown.
3 changes: 3 additions & 0 deletions playground/src/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
body {
overflow: hidden;
}
3 changes: 1 addition & 2 deletions playground/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { createApp } from 'vue'
import './style.css'
import App from './App.vue'

import './index.css'
createApp(App).mount('#app')
79 changes: 0 additions & 79 deletions playground/src/style.css

This file was deleted.

0 comments on commit a117c8b

Please sign in to comment.