feat: 🚀 添加组

This commit is contained in:
bunny 2024-07-16 16:16:01 +08:00
parent a42bc7d82d
commit 106f52f71e
2 changed files with 91 additions and 50 deletions

100
README.md
View File

@ -1,51 +1,51 @@
```sh
simple clip
complex clip
groups, layers and ordering
groups
layering
change containers
zindex
filters
blur
brighten
contrast
emboss
enhance
grayscale
hsl
hsv
rgb
invert
kaleidoscope
mask
noise
pixelate
custom filter
multiple filters
tweens
linear easing
common easings
all easings
finish event
all controls
tween filter
complex tweening
animations
create an animation
moving
rotation
scaling
stop animation
selectors
select by id
select by type
select by name
data & serialization & export
serialize a stage
simple load
complex load
json best practices
stage data url
export to hd image
```
https://konvajs.org/docs/groups_and_layers/Layering.html
https://konvajs.org/docs/groups_and_layers/Change_Containers.html
https://konvajs.org/docs/groups_and_layers/zIndex.html
https://konvajs.org/docs/tweens/Linear_Easing.html
https://konvajs.org/docs/tweens/Common_Easings.html
https://konvajs.org/docs/tweens/All_Easings.html
https://konvajs.org/docs/tweens/All_Controls.html
https://konvajs.org/docs/tweens/Tween_Filter.html
https://konvajs.org/docs/animations/Create_an_Animation.html
https://konvajs.org/docs/animations/Moving.html
https://konvajs.org/docs/animations/Rotation.html
https://konvajs.org/docs/animations/Scaling.html
https://konvajs.org/docs/animations/Stop_Animation.html
https://konvajs.org/docs/selectors/Select_by_id.html
https://konvajs.org/docs/selectors/Select_by_Type.html
https://konvajs.org/docs/selectors/Select_by_Name.html
https://konvajs.org/docs/filters/Blur.html
https://konvajs.org/docs/filters/Brighten.html
https://konvajs.org/docs/filters/Contrast.html
https://konvajs.org/docs/filters/Emboss.html
https://konvajs.org/docs/filters/Enhance.html
https://konvajs.org/docs/filters/Grayscale.html
https://konvajs.org/docs/filters/HSL.html
https://konvajs.org/docs/filters/HSV.html
https://konvajs.org/docs/filters/RGB.html
https://konvajs.org/docs/filters/Invert.html
https://konvajs.org/docs/filters/Kaleidoscope.html
https://konvajs.org/docs/filters/Mask.html
https://konvajs.org/docs/filters/Noise.html
https://konvajs.org/docs/filters/Pixelate.html
https://konvajs.org/docs/filters/Custom_Filter.html
https://konvajs.org/docs/filters/Multiple_Filters.html
https://konvajs.org/docs/data_and_serialization/Serialize_a_Stage.html
https://konvajs.org/docs/data_and_serialization/Simple_Load.html
https://konvajs.org/docs/data_and_serialization/Complex_Load.html
https://konvajs.org/docs/data_and_serialization/Best_Practices.html
https://konvajs.org/docs/data_and_serialization/Stage_Data_URL.html
https://konvajs.org/docs/data_and_serialization/High-Quality-Export.html
https://konvajs.org/docs/performance/Shape_Redraw.html
https://konvajs.org/docs/performance/Optimize_Strokes.html
https://konvajs.org/docs/performance/Optimize_Animation.html
https://konvajs.org/docs/performance/Batch_Draw.html
https://konvajs.org/docs/performance/Layer_Management.html
```

View File

@ -0,0 +1,41 @@
<script setup lang="ts">
import { useWindowSize } from '@vueuse/core';
import { onMounted } from 'vue';
import Konva from 'konva/lib';
const { width, height } = useWindowSize();
const initial = () => {
const stage = new Konva.Stage({ container: 'container', width: width.value, height: height.value });
const layer = new Konva.Layer();
stage.add(layer);
const group = new Konva.Group({ x: 120, y: 40, rotation: 20, draggable: true });
const colors = ['red', 'orange', 'yellow'];
for (let i = 0; i < 3; i++) {
const rect = new Konva.Rect({
x: i * 30,
y: i * 30,
width: 100,
height: 20,
name: `color${colors[i]}`,
fill: colors[i],
stroke: 'black',
strokeWidth: 4,
});
group.add(rect);
}
layer.add(group);
};
onMounted(() => {
initial();
});
</script>
<template>
<div id="container"></div>
</template>
<style scoped lang="scss"></style>