Skip to content

Instantly share code, notes, and snippets.

View 0xsommer's full-sized avatar

Michael Sommer 0xsommer

View GitHub Profile
@0xsommer
0xsommer / button.tsx
Last active February 27, 2025 15:39
Exploding button
'use client'
import { useState, useRef, useEffect } from 'react'
import { motion, cubicBezier, useMotionValue, useTransform, AnimatePresence } from 'framer-motion';
import Particles from './particles';
import Explosion from './explosion';
import { PiCheckFatFill } from "react-icons/pi";
// Custom easing function
const customEase = cubicBezier(0.05, 0.3, 0.2, 1);
@0xsommer
0xsommer / slide-to-button.tsx
Last active November 27, 2024 14:23
Button: Slide to confirm
'use client'
import React, { useEffect, useState } from 'react';
import { motion, useMotionValue, useTransform, animate } from 'framer-motion';
import { IoArrowBackOutline, IoArrowForwardOutline } from "react-icons/io5";
const SlideButton: React.FC = () => {
const [isOn, setIsOn] = useState(false);
const trackRef = React.useRef<HTMLDivElement>(null);
const handleRef = React.useRef<HTMLDivElement>(null);