Spaces:
Running
Running
Commit History
-
продолжить
Verified signature2657714 -
<script setup lang="ts">
Verified signatureimport { onMounted, onBeforeUnmount, ref, watch } from 'vue' import { gsap } from 'gsap' // === Константы === const BASE_W = 200 const BASE_H = 200 const COLORS = { skin: '#EACB8A', shirt: '#E42D43', pants: '#5F3A32', eyes: '#4A4A4A', bg: '#201e1e' } // === Пропсы === const props = withDefaults(defineProps<{ isWalking?: boolean }>(), { isWalking: false }) // === Состояния === const canvasRef = ref<HTMLCanvasElement | null>(null) let ctx: CanvasRenderingContext2D | null = null let frameId: number | null = null let blinkTimeout: ReturnType<typeof setTimeout> | null = null let walkTween: gsap.core.Tween | null = null // Анимационные состояния const blinkState = { level: 0 } const walkCycle = { progress: 0 } // === Хелперы === const drawRect = ( ctx: CanvasRenderingContext2D, x: number, y: number, w: number, h: number, color: string, opacity = 1 ) => { ctx.save() ctx.globalAlpha = opacity ctx.fillStyle = color ctx.fillRect(x, y, w, h) ctx.restore() } // …7a1a88f -
initial commit
Verified signature1d26e0e