Skip to content

Instantly share code, notes, and snippets.

View vaebe's full-sized avatar
🎯
Focusing

vae vaebe

🎯
Focusing
View GitHub Profile
@vaebe
vaebe / 文字渐变.html
Created July 11, 2025 09:52
文字渐变-带呼吸
<style>
.gradient-text {
    font-size: 28px;
    background: linear-gradient(45deg, #f9d423, #ff4e50, #7b4397, #00c6ff);
    background-size: 300% 300%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradient-shift 8s ease infinite, pulse 2s infinite alternate;
}
@vaebe
vaebe / bg.svg
Created May 20, 2025 02:27
svg 背景
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@vaebe
vaebe / useFloatingDiv.ts
Created May 19, 2025 07:04
vue3 组合式函数实现画中画 同时保留原有视频元素,资源消耗过大 待优化,方向 减少每秒渲染帧数、渲染分辨率
// todo 同时只能有一个元素进入画中画
export function useFloatingDiv() {
const video = shallowRef<HTMLVideoElement | null>(null)
let animationFrameId: number | null = null
function cleanUp() {
// 取消动画循环
if (animationFrameId !== null) {
cancelAnimationFrame(animationFrameId)
animationFrameId = null
@vaebe
vaebe / usePictureInPicture.ts
Created May 19, 2025 07:00
vue3 组合式函数实现视频画中画
export function usePictureInPicture(domId: string) {
const getDom = () => document.getElementById(domId) as HTMLVideoElement
const isPipActive = ref(false)
async function enterPip() {
const videoDom = getDom()
if (videoDom) {
try {
await videoDom.requestPictureInPicture()
@vaebe
vaebe / leaflet-popup.css
Created November 21, 2024 09:51
leaflet-popup 边框流光效果
.leaflet-popup-content-wrapper {
position: relative;
overflow: hidden;
&::before {
content: '';
position: absolute;
left: -50%;
top: -50%;
width: 200%;
@vaebe
vaebe / html-element-corner-border.scss
Created November 21, 2024 09:49
html 元素四角边框
&:before {
content: "";
width: 100%;
height: 10px;
position: absolute;
top: 0;
left: 0;
background: linear-gradient(to left, #7BBBDC, #7BBBDC) left top no-repeat, linear-gradient(to bottom, #7BBBDC, #7BBBDC) left top no-repeat, linear-gradient(to left, #7BBBDC, #7BBBDC) right top no-repeat, linear-gradient(to bottom, #7BBBDC, #7BBBDC) right top no-repeat;
background-size: 2px 10px, 10px 2px, 2px 10px, 10px 2px;
}
@vaebe
vaebe / VideoCover.ts
Created November 21, 2024 09:47
获取视频首帧图片的base64数据
// https://www.npmjs.com/package/video-cover?activeTab=code
export class VideoCover {
private video: HTMLVideoElement
private canvas: HTMLCanvasElement
private ctx: CanvasRenderingContext2D
constructor(private url: string) {
this.video = document.createElement('video')
this.video.src = this.url
this.video.crossOrigin = 'Anonymous'