page: 📄 元素改变时动画
This commit is contained in:
parent
5ff3d64e23
commit
1fd9d75928
|
@ -1,5 +1,4 @@
|
||||||
```sh
|
```sh
|
||||||
https://konvajs.org/docs/tweens/Linear_Easing.html
|
|
||||||
https://konvajs.org/docs/tweens/Common_Easings.html
|
https://konvajs.org/docs/tweens/Common_Easings.html
|
||||||
https://konvajs.org/docs/tweens/All_Easings.html
|
https://konvajs.org/docs/tweens/All_Easings.html
|
||||||
https://konvajs.org/docs/tweens/All_Controls.html
|
https://konvajs.org/docs/tweens/All_Controls.html
|
||||||
|
@ -11,10 +10,6 @@ https://konvajs.org/docs/animations/Rotation.html
|
||||||
https://konvajs.org/docs/animations/Scaling.html
|
https://konvajs.org/docs/animations/Scaling.html
|
||||||
https://konvajs.org/docs/animations/Stop_Animation.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/Blur.html
|
||||||
https://konvajs.org/docs/filters/Brighten.html
|
https://konvajs.org/docs/filters/Brighten.html
|
||||||
https://konvajs.org/docs/filters/Contrast.html
|
https://konvajs.org/docs/filters/Contrast.html
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
{"version":1721089915004}
|
{"version":1721175662341}
|
|
@ -0,0 +1,51 @@
|
||||||
|
<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 rect = new Konva.Rect({
|
||||||
|
x: 50,
|
||||||
|
y: 20,
|
||||||
|
width: 120,
|
||||||
|
height: 50,
|
||||||
|
fill: 'green',
|
||||||
|
stroke: 'black',
|
||||||
|
strokeWidth: 2,
|
||||||
|
opacity: 0.2,
|
||||||
|
});
|
||||||
|
layer.add(rect);
|
||||||
|
|
||||||
|
const tween = new Konva.Tween({
|
||||||
|
node: rect,
|
||||||
|
duration: 1,
|
||||||
|
x: 140,
|
||||||
|
y: 90,
|
||||||
|
fill: 'red',
|
||||||
|
rotation: Math.PI * 2,
|
||||||
|
opacity: 1,
|
||||||
|
strokeWidth: 6,
|
||||||
|
scaleX: 1.5,
|
||||||
|
});
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
tween.play();
|
||||||
|
}, 2000);
|
||||||
|
};
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
initial();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div id="container"></div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped lang="scss"></style>
|
Loading…
Reference in New Issue