svg+gsap实现花瓣旋转动画效果代码

代码语言:html

所属分类:动画

代码描述:svg+gsap实现花瓣旋转动画效果代码

代码标签: svg gsap 花瓣 旋转 动画

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

<!DOCTYPE html>

<html lang="en">

<head>

   
<meta charset="UTF-8">


   
<link href="https://fonts.googleapis.com/css2?family=Raleway:wght@200;300&display=swap" rel="stylesheet">



   
<style>
       
:root {
         
--default: hsl(247, 65%, 53%);
         
--white-50: hsla(0, 100%, 100%, 50%);
         
--white-25: hsla(0, 100%, 100%, 25%);
         
--white: hsl(0, 100%, 100%);
       
}
       
       
*,
       
*::before,
       
*::after {
         
box-sizing: border-box;
       
}
       
       
* {
         
margin: 0;
         
position: relative;
       
}
       
        html
{
         
height: 100%;
       
}
       
        img
,
        picture
,
        video
,
        canvas
,
        svg
{
         
display: block;
         
max-width: 100%;
       
}
       
        input
,
        button
,
        textarea
,
        select
{
         
font: inherit;
       
}
       
        p
,
        h1
,
        h2
,
        h3
,
        h4
,
        h5
,
        h6
{
         
overflow-wrap: break-word;
       
}
       
       
#root,
       
#__next {
         
isolation: isolate;
       
}
       
        body
{
         
color: white;
         
font-family: "Raleway", sans-serif;
         
font-size: 1rem;
         
font-weight: 200;
         
letter-spacing: 0.02em;
         
background: var(--default);
         
overflow-x: hidden;
       
}
       
        h1
{
         
font-size: 1rem;
         
font-weight: 300;
         
line-height: 1.5;
       
}
       
        p
{
         
font-size: 0.68rem;
         
line-height: 1.15;
         
padding-bottom: 1rem;
       
}
       
       
.petal {
         
mix-blend-mode: screen;
       
}
       
       
.container-btn {
         
margin: 1rem;
         
display: flex;
         
flex-direction: column;
         
justify-content: center;
         
align-items: flex-start;
         
z-index: 10;
         
position: absolute;
         
background: rgba(255, 255, 255, 0.18);
         
border: 1px solid rgba(255, 255, 255, 0.8);
         
border-radius: 16px;
         
box-shadow: 0 4px 150px rgba(190, 183, 240, 0.3);
         
backdrop-filter: blur(1.2px);
         
-webkit-backdrop-filter: blur(1.2px);
         
padding: 1rem;
         
max-width: 220px;
       
}
       
        button
{
         
color: white;
         
font-size: 1rem;
         
background: rgba(75, 57, 213, 0.8);
         
border: 1px solid rgba(255, 255, 255, 0.85);
         
border-right: 3px solid rgba(255, 255, 255, 0.85);
         
border-bottom: 3px solid rgba(255, 255, 255, 0.85);
         
border-radius: 8px;
         
cursor: pointer;
         
padding: 0.5rem 0;
         
width: 100%;
         
transition: background 0.3s ease-in-out;
       
}
       
button:hover {
         
background: #3726b5;
       
}
       
       
.grid-container {
         
display: grid;
         
grid-template-columns: 1fr;
         
grid-gap: 10px;
         
width: 100%;
         
overflow-x: hidden;
       
}
       
@media only screen and (min-width: 768px) {
         
.grid-container {
           
grid-template-columns: repeat(3, 1fr);
         
}
       
}
       
       
@media only screen and (min-width: 768px) {
         
.grid-item {
           
align-items: center;
         
}
       
}
   
</style>



</head>

<body >
   
<section>

       
<div class="container-btn">
           
<h1>The Randomizer!</h1>
           
<p>Change colors and rotation speeds by clicking the Randomize button.</p>
           
<button type="button">Randomize</button>
       
</div>

       
<!-- Start SVG Grid Container -->
       
<div class="grid-container">
           
<!-- grid 1 -->
           
<div class="grid-item">
               
<svg class="flower" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 300 300" xml:space="preserve">
        <path class="petal" fill="#fff" stroke="white" stroke-width="1" vector-effect="non-scaling-stroke".........完整代码请登录后点击上方下载按钮下载查看

网友评论0