js+css实现爱心贴纸表白动画交互效果代码

代码语言:html

所属分类:表白

代码描述:js+css实现爱心贴纸表白动画交互效果代码

代码标签: js css 爱心 贴纸 表白 动画 交互

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="zh-CN">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>暖心提示</title>
        <!-- 图标 -->
        <link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>❤️</text></svg>">
        <link rel="apple-touch-icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>❤️</text></svg>">
        <link rel="shortcut icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>❤️</text></svg>">
        <!-- 样式 -->
    
      <style>
      * {
    margin: 0;
    padding: 0;
    box-sizing: border-box
}

body {
    background-color: #f9f3f3;
    overflow: hidden;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    user-select: none
}

.container {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0
}

.heart-point {
    position: absolute;
    width: 100px;
    height: 50px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    padding: 8px;
    text-align: center;
    font-size: 12px;
    color: #333;
    font-weight: bold;
    opacity: 0;
    animation: fadeIn .5s forwards;
    cursor: pointer;
    transition: transform .3s ease,box-shadow .3s ease,background-color .3s ease,z-index .3s ease;
    z-index: 1
}

.heart-point:hover {
    transform: scale(1.15);
    box-shadow: 0 6px 16px rgba(0,0,0,0.2);
    z-index: 10
}

.heart-point.enlarged {
    transform: scale(2.5)!important;
    transition: transform .4s cubic-bezier(0.175,0.885,0.32,1.275),box-shadow .4s ease,z-index .4s ease;
    transform-origin: center;
    box-shadow: 0 15px 40px rgba(0,0,0,0.4)!important;
    border: 2px solid #fff;
    z-index: 999!important
}

.heart-point.enlarged:hover {
    transform: scale(2.5)!important;
    z-index: 999!important
}

@media(max-width: 768px) {
    .heart-point.enlarged {
        transform:scale(2)!important
    }

    .heart-point.enlarged:hover {
        transform: scale(2)!important
   .........完整代码请登录后点击上方下载按钮下载查看

网友评论0