svg+anime实现茶饮点餐app交互ui效果代码

代码语言:html

所属分类:布局界面

代码描述:svg+anime实现茶饮点餐app交互ui效果代码,选择茶饮及加料,动画显示反馈加料操作。

代码标签: svg anime 茶饮 点餐 app 交互 ui

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

<!DOCTYPE html>
<html lang="en" >
<head>
 
<meta charset="UTF-8">
<style>
   
@import url("https://fonts.googleapis.com/css?family=Muli:300,400,600,900&display=swap");

* {
 
box-sizing: border-box;
 
padding: 0;
 
margin: 0;
}
body
{
 
color: #333;
 
font-family: "Muli", sans-serif;
 
min-height: 100vh;
 
/* add a circle with a linear gradient in the center of the screen, above another linear gradient */
 
background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><linearGradient id="gradient" x1="0" y1="1" x2="1" y2="0"><stop offset="0" stop-color="%23FBDBE3"></stop><stop offset="1" stop-color="%23F39BAE"></stop></linearGradient><circle cx="50" cy="50" r="50" fill="url(%23gradient)"></circle></svg>'),
    linear-gradient
(45deg, #ffecf0, #f5c3cf);
 
background-position: 50%, 0%;
 
background-size: 40%, 100%;
 
background-repeat: no-repeat;
}

/* for the phone UI specify a tall, thin, rounded rectangle */
div
.phone {
 
max-width: 280px;
 
margin: 2rem auto;
 
border-radius: 15px;
 
background: #fffffd;
 
/* display the content in a column */
 
display: flex;
 
flex-direction: column;
 
/* add multiple shadows to make a solid rounded border with a small blue-ish overlay and a softer shadow */
 
box-shadow: 0 0 0 0.02rem #ddf, 0 0 1rem 0.1rem #f4f4ff, 0 0 0 0.8rem #fcfcff,
   
0 0 0.8rem 0.5rem #ccf;
}

/* display the navigation's items in a row */
.phone__nav {
 
display: flex;
 
align-items: center;
 
padding: 0.5rem 1rem;
 
margin-bottom: 0.5rem;
}
.phone__nav span {
 
flex-grow: 1;
 
font-weight: 600;
 
font-size: 0.7rem;
}
.phone__nav svg {
 
margin: 0 0.1rem;
 
width: 0.8rem;
 
height: 0.8rem;
}

.phone__state {
 
padding: 0 1rem;
}
.phone__state h2 {
 
color: #ff4966;
 
font-size: 1.4rem;
}
.phone__state p {
 
font-size: 0.8rem;
}

/* display the drink in the center of the phone */
.phone__drink {
 
align-self: center;
 
width: 70%;
 
height: auto;
 
margin: 1.5rem 0 0;
}

/* display the ingredients in a non-wrapping row */
.phone__ingredients {
 
display: flex;
 
align-items: center;
 
margin: 0 0.5rem;
 
/* allow for horizontal scroll */
 
overflow-x: auto;
}
/* visually hide the scrollbar */
.phone__ingredients::-webkit-scrollbar {
 
opacity: 0;
}
/* prevent the buttons from shrinking */
.phone__ingredients button {
 
margin: 0.5rem;
 
flex-shrink: 0;
 
border: none;
 
background: none;
 
position: relative;
 
font-family: inherit;
 
/* display the svg and span atop one another */
 
display: flex;
 
flex-direction: column;
 
align-items: center;
}
.phone__ingredients button svg {
 
width: 78px;
 
height: 78px;
 
display: block;
 
filter: drop-shadow(0 0 10px hsla(0, 0%, 0%, 0.05));
}
/* have the span overlap on the svg */
.phone__ingredients button span {
 
position: relative;
 
border-radius: 20px;
 
background: #ff4966;
 
color: #fff;
 
padding: 0.25rem 0.75rem;
 
font-size: 0.75rem;
 
margin-top: -0.5rem;
}
/* on click darken the background color of the span element through an overlapping pseudo element */
.phone__ingredients button span:before {
 
position: absolute;
 
content: "";
 
top: 50%;
 
left: 50%;
 
width: 100%;
 
height: 100%;
 
border-radius: inherit;
 
background: #000;
 
opacity: 0;
 
transform: translate(-50%, -50%) scale(0);
 
transition-property: opacity, transform;
 
transition-duration: 0.1s;
 
transition-timing-function: ease-out;
}
.phone__ingredients button:active span:before {
 
opacity: 0.2;
 
transform: translate(-50%, -50%) scale(1);
}

/* display the receipt on a completely white background */
.phone__order {
 
display: flex;
 
background: #fff;
 
margin: 0.5rem 0.75rem 0.75rem;
 
padding: 0.75rem 1rem;
 
border-radius: 15px;
 
box-shadow: 0 1px 15px -2px #f5c3cf;
 
min-height: 75px;
}
/* have the heading and list stretch to occupy the available width */
.phone__order .order--list {
 
flex-grow: 1;
}
.phone__order .order--list h3 {
 
font-size: 0.6rem;
 
color: #ff4966;
 
text-transform: uppercase;
 
margin-bottom: 0.1rem;
}
/* remove the bullet point from the unordered list */
.phone__order .order--list ul {
 
list-style: none;
 
font-size: 0.8rem;
 
text-transform: capitalize;
 
line-height: 1.5;
}

/* highlight the button with the accent color
replicate the active state created for the ingredients' span
! enable this state alongside full opacity only when a class is added
this to highlight when the button is clickable
*/

.phone__order button {
 
align-self: center;
 
background: #ff4966;
 
border: none;
 
color: #fff;
 
width: 30px;
 
height: 30px;
 
padding: 0.3rem;
 
border-radius: 50%;
 
opacity: 0.5;
 
cursor: not-allowed;
 
transition: opacity 0.15s ease-out;
}
.phone__order button svg {
 
display: block;
 
width: 100%;
 
height: 100%;
}
.phone__order.complete button {
 
opacity: 1;
 
cursor: pointer;
}
</style>

</head>
<body>
<!-- partial:index.partial.html -->
<!-- graphics used in the project -->
<svg style="display: none;" viewBox="0 0 100 100" width="50" height="50">
   
<!-- icons for the navigation bar -->
   
<symbol id="signal" viewBox="0 0 100 100">
       
<g transform="translate(2.5 0)">
           
<rect
               
x="0"
               
y="80"
               
width="20"
               
height="20"
               
fill="currentColor">
           
</rect>
           
<g transform="translate(25 0)">
               
<rect
                   
x="0"
                   
y="60"
                   
width="20"
                   
height="40"
                   
fill="currentColor">
               
</rect>
           
</g>
           
<g transform="translate(50 0)">
               
<rect
                   
x="0"
                   
y="40"
                   
width="20"
                   
height="60"
                   
fill="currentColor">
               
</rect>
           
</g>
           
<g transform="translate(75 0)">
               
<rect
                   
x="0"
                   
y="20"
                   
width="20"
                   
height="80"
                   
fill="currentColor">
               
</rect>
               
<rect
                   
x="0"
                   
y="20"
                   
width="20"
                   
height="80"
                   
fill="currentColor">
               
</rect>
           
</g>
       
</g>
   
</symbol>

   
<symbol id="wifi" viewBox="0 0 100 100">
       
<circle
           
cx="50"
           
cy="90"
           
r="10"
           
fill="currentColor">
       
</circle>

       
<g
           
stroke="currentColor"
           
stroke-width="20"
           
fill="none">
           
<path
               
d="M 25 70 a 35 35 0 0 1 50 0">
           
</path>

           
<path
               
d="M 10 45 a 65 65 0 0 1 80 0">
           
</path>
       
</g>
   
</symbol>

   
<symbol id="battery" viewBox="0 0 100 100">
       
<rect
           
x="5"
           
y="35"
           
width="80"
           
height="50"
           
fill="currentColor">
       
</rect>
       
<rect
           
x="85"
           
y="45"
           
width="15"
           
height="30"
           
fill="currentColor">
       
</rect>
   
</symbol>

   
<!-- icon for the order button -->
   
<symbol id="arrow" viewBox="0 0 100 100">
       
<path
           
d="M 20 50 h 65 l -25 -25 l 25 25 l -25 25"
           
stroke-linecap="round"
           
stroke-linejoin="round"
           
stroke-width="10"
           
stroke="currentColor"
           
fill="none">
       
</path>
   
</symbol>

   
<!-- icon of fruits -->
   
<symbol id="pineapple" viewBox="0 0 100 100">
       
<g transform="translate(0,12.5)" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="3">
           
<path d="m50 21q20 0 20 20 0 25-15 25h-10q-15 0-15-25 0-20 20-20" stroke-dasharray="55 8 80"/>
           
<g stroke-width="2.5">
               
<path d="m36 33 2-2 2 2"/>
               
<path d="m60 33 2-2 2 2"/>
               
<path d="m30 46 4-4 4 4" stroke-dasharray="8, 3, 5"/>
               
<path d="m62 46 4-4 4 4"/>
               
<path d="m33 57 2.5-2.5 2.5 2.5"/>
               
<path d="m62 57 2.5-2.5 2.5 2.5"/>
               
<path d="m43 41 7-7 7 7"/>
               
<path d="m43 56 7-7 7 7"/>
           
</g>
           
<g fill="#ffffff">
               
<path d="m43 16 7-7 7 7"/>
               
<path d="m43 21-2-11 9 9 9-9-2 11"/>
               
<path d="m40 21-7-7 17 7 17-7-7 7"/>
           
</g>
       
</g>
   
</symbol>

   
<symbol id="peach" viewBox="0 0 100 100">
       
<g transform="translate(-7.0352 18.875)" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="3">
           
<g stroke-width="2.5">
               
<path d="m47 16v-8a3 3 0 0 1 6 0v8"/>
               
<path d="m53 14q2-10 16-7-4 14-16 7l8-3"/>
           
</g>
           
<path d="m50 16a20 20 0 0 0-20 20 18 18 0 0 0 18 18q2.5 0 5 3 2.5-3 5-3a18 18 0 0 0 18-18 20 20 0 0 0-20-20 20 20 0 0 0-10 20" stroke-dasharray="70, 45, 80"/>
           
<g transform="rotate(30 -43.373 151.62)">
               
<path d="m0-18c-20 8-16 32 0 32s20-24 0-32"/>
           
</g>
           
<g transform="rotate(30 -43.373 151.62)">
               
<path d="m0-8c-8 4-8 12 0 16 8-4 8-12 0-16"/>
           
</g>
       
</g>
   
</symbol>

   
<symbol id="raspberry" version="1.1" viewBox="0 0 100 100">
       
<g transform="translate(50 50)" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2">
           
<g transform="translate(.10082 .49998)">
           
<g>
               
<path d="m-2 0q-5-25 18-18 3 25-18 18"/>
               
<path d="m-2 0 15-15" stroke-dasharray="12, 4, 1, 10"/>
           
</g>
           
<g>
               
<path d="m-15-10q-5-10 5-15 4 8 7 10 10 8 0 10" fill="#ffffff" stroke-dasharray="25, 5, 20"/>
               
<path d="m-5-9q-2-4-4-5"/>
           
</g>
           
<g transform="matrix(.020627 -.99979 -.99979 -.020627 -.99002 -2.0879)">
               
<path d="m-15-10q-5-10 5-15 4 8 7 10 10 8 0 10" fill="#ffffff" stroke-dasharray="25, 5, 20"/>
               
<path d="m-5-9q-2-4-4-5"/>
           
</g>
               
<g fill="#ffffff">
                   
<circle cx="-20" cy="20" r="4"/>
                   
<circle cx="-19" cy="14" r="4.1"/>
                   
<circle cx="-14" cy="18" r="4.1"/>
                   
<circle cx="-18" cy="9" r="4.2"/>
                   
<circle cx="-9" cy="17" r="4.2"/>
                   
<circle cx="-14" cy="13" r="4.2"/>
                   
<circle cx="-17" cy="4" r="4.3"/>
                   
<circle cx="-4" cy="16" r="4.3"/>
                   
<circle cx="-9" cy="8" r="4.3"/>
                   
<circle cx="-16" cy="-1" r="4.4"/>
                   
<circle cx="1" cy="15" r="4.4"/>
                    &l.........完整代码请登录后点击上方下载按钮下载查看

网友评论0