TweenMax+MorphSVGPlugin实现有趣图像交互输入登录表单动画效果代码
代码语言:html
所属分类:表单美化
代码描述:TweenMax+MorphSVGPlugin实现有趣图像交互输入登录表单动画效果代码,输入email时,图像人物会盯着你,当输入密码时,他又会遮挡自己的眼睛,非常有趣。
代码标签: TweenMax MorphSVGPlugin 表单 动画 交互
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,600,700" rel="stylesheet"> <link type="text/css" rel="stylesheet" href="//repo.bfw.wiki/bfwrepo/css/reset.min.css"> <style> /* colors */ html { width: 100%; height: 100%; } body { background-color: #eff3f4; position: relative; width: 100%; height: 100%; font-size: 16px; font-family: "Source Sans Pro", sans-serif; font-weight: 400; -webkit-font-smoothing: antialiased; } form { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); display: block; width: 100%; max-width: 400px; background-color: #FFF; margin: 0; padding: 2.25em; box-sizing: border-box; border: solid 1px #DDD; border-radius: 0.5em; font-family: "Source Sans Pro", sans-serif; } form .svgContainer { position: relative; width: 200px; height: 200px; margin: 0 auto 1em; border-radius: 50%; pointer-events: none; } form .svgContainer div { position: relative; width: 100%; height: 0; overflow: hidden; border-radius: 50%; padding-bottom: 100%; } form .svgContainer .mySVG { position: absolute; left: 0; top: 0; width: 100%; height: 100%; pointer-events: none; } form .svgContainer:after { content: ""; position: absolute; top: 0; left: 0; z-index: 10; width: inherit; height: inherit; box-sizing: border-box; border: solid 2.5px #217093; border-radius: 50%; } form .inputGroup { margin: 0 0 2em; padding: 0; position: relative; } form .inputGroup:last-of-type { margin-bottom: 0; } form label { margin: 0 0 12px; display: block; font-size: 1.25em; color: #217093; font-weight: 700; font-family: inherit; } form input[type=email], form input[type=text], form input[type=number], form input[type=url], form input[type=search], form input[type=password] { display: block; margin: 0; padding: 0 1em 0; padding: 0.875em 1em 0; background-color: #f3fafd; border: solid 2px #217093; border-radius: 4px; -webkit-appearance: none; box-sizing: border-box; width: 100%; height: 65px; font-size: 1.55em; color: #353538; font-weight: 600; font-family: inherit; transition: box-shadow 0.2s linear, border-color 0.25s ease-out; } form input[type=email]:focus, form input[type=text]:focus, form input[type=number]:focus, form input[type=url]:focus, form input[type=search]:focus, form input[type=password]:focus { outline: none; box-shadow: 0px 2px 10px rgba(0, 0, 0, 0.1); border: solid 2px #4eb8dd; } form button { display: block; margin: 0; padding: 0.65em 1em 1em; background-color: #4eb8dd; border: none; border-radius: 4px; box-sizing: border-box; box-shadow: none; width: 100%; height: 65px; font-size: 1.55em; color: #FFF; font-weight: 600; font-family: inherit; transition: background-color 0.2s ease-out; } form button:hover, form button:active { background-color: #217093; } form .inputGroup1 .helper { position: absolute; z-index: 1; font-family: inherit; } form .inputGroup1 .helper1 { top: 0; left: 0; transform: translate(1em, 2.2em) scale(1); transform-origin: 0 0; color: #217093; font-size: 1.55em; font-weight: 400; opacity: 0.65; pointer-events: none; transition: transform 0.2s ease-out, opacity 0.2s linear; } form .inputGroup1.focusWithText .helper { transform: translate(1em, 1.55em) scale(0.6); opacity: 1; } form .inputGroup2 input[type=password] { padding: 0.4em 1em 0.5em; } form .inputGroup2 input[type=text] { padding: 0.025em 1em 0; } form .inputGroup2 #showPasswordToggle { display: block; padding: 0 0 0 1.45em; position: absolute; top: 0.25em; right: 0; font-size: 1em; } form .inputGroup2 #showPasswordToggle input { position: absolute; z-index: -1; opacity: 0; } form .inputGroup2 #showPasswordToggle .indicator { position: absolute; top: 0; left: 0; height: 0.85em; width: 0.85em; background-color: #f3fafd; border: solid 2px #217093; border-radius: 3px; } form .inputGroup2 #showPasswordToggle .indicator:after { content: ""; position: absolute; left: 0.25em; top: 0.025em; width: 0.2em; height: 0.5em; border: solid #217093; border-width: 0 3px 3px 0; transform: rotate(45deg); visibility: hidden; } form .inputGroup2 #showPasswordToggle input:checked ~ .indicator:after { visibility: visible; } form .inputGroup2 #showPasswordToggle input:focus ~ .indicator, form .inputGroup2 #showPasswordToggle input:hover ~ .indicator { border-color: #4eb8dd; } form .inputGroup2 #showPasswordToggle input:disabled ~ .indicator { opacity: 0.5; } form .inputGroup2 #showPasswordToggle input:disabled ~ .indicator:after { visibility: hidden; } </style> </head> <body> <!-- partial:index.partial.html --> <form> <div class="svgContainer"> <div> <svg class="mySVG" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 200 200"> <defs> <circle id="armMaskPath" cx="100" cy="100" r="100"/> </defs> <clipPath id="armMask"> <use xlink:href="#armMaskPath" overflow="visible"/> </clipPath> <circle cx="100" cy="100" r="100" fill="#a9ddf3"/> <g class="body"> <path class="bodyBGchanged" style="display: none;" fill="#FFFFFF" d="M200,122h-35h-14.9V72c0-27.6-22.4-50-50-50s-50,22.4-50,50v50H35.8H0l0,91h200L200,122z"/> <path class="bodyBGnormal" stroke="#3A5E77" stroke-width="2.5" stroke-linecap="round" stroke-linejoinn="round" fill="#FFFFFF" d="M200,158.5c0-20.2-14.8-36.5-35-36.5h-14.9V72.8c0-27.4-21.7-50.4-49.1-50.8c-28-0.5-50.9,22.1-50.9,50v50 H35.8C16,122,0,138,0,157.8L0,213h200L200,158.5z"/> <path fill="#DDF1FA" d="M100,156.4c-22.9,0-43,11.1-54.1,27.7c15.6,10,34.2,15.9,54.1,15.9s38.5-5.8,54.1-15.9 C143,167.5,122.9,156.4,100,156.4z"/> </g> <g class="earL"> <g class="outerEar" fill="#ddf1fa" stroke="#3a5e77" stroke-width="2.5"> <circle cx="47" cy="83" r="11.5"/> <path d="M46.3 78.9c-2.3 0-4.1 1.9-4.1 4.1 0 2.3 1.9 4.1 4.1 4.1" stroke-linecap="round" stroke-linejoin="round"/> </g> <g class="earHair"> <rect x="51" y="64" fill="#FFFFFF" width="15" height="35"/> <path d="M53.4 62.8C48.5 67.4 45 72.2 42.8 77c3.4-.1 6.8-.1 10.1.1-4 3.7-6.8 7.6-8.2 11.6 2.1 0 4.2 0 6.3.2-2.6 4.1-3.8 8.3-3.7 12.5 1.2-.7 3.4-1.4 5.2-1.9" fill="#fff" stroke="#3a5e77" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"/> </g> </g> <g class="earR"> <g class="outerEar"> <circle fill="#DDF1FA" stroke="#3A5E77" stroke-width="2.5" cx="153" cy="83" r="11.5"/> <path fill="#DDF1FA" stroke="#3A5E77" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" d="M153.7,78.9 c2.3,0,4.1,1.9,4.1,4.1c0,2.3-1.9,4.1-4.1,4.1"/> </g> <g class="earHair"> <rect x="134" y="64" fill="#FFFFFF" width="15" height="35"/> <path fill="#FFFFFF" stroke="#3A5E77" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" d="M146.6,62.8 c4.9,4.6,8.4,9.4,10.6,14.2c-3.4-0.1-6.8-0.1-10.1,0.1c4,3.7,6.8,7.6,8.2,11.6c-2.1,0-4.2,0-6.3,0.2c2.6,4.1,3.8,8.3,3.7,12.5 c-1.2-0.7-3.4-1.4-5.2-1.9"/> </g> </g> <path class="chin" d="M84.1 121.6c2.7 2.9 6.1 5.4 9.8 7.5l.9-4.5c2.9 2.5 6.3 4.8 10.2 6.5 0-1.9-.1-3.9-.2-5.8 3 1.2 6.2 2 9.7 2.5-.3-2.1-.7-4.1-1.2-6.1" fill="none" stroke="#3a5e77" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"/> <path class="face" fill="#DDF1FA" d="M134.5,46v35.5c0,21.815-15.446,39.5-34.5,39.5s-34.5-17.685-34.5-39.5V46"/> <path class="hair" fill="#FFFFFF" stroke="#3A5E77" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" d="M81.457,27.929 c1.755-4.084,5.51-8.262,11.253-11.77c0.979,2.565,1.883,5.14,2.712,7.723c3.162-4.265,8.626-8.27,16.272-11.235 c-0.737,3.293-1.588,6.573-2.554,9.837c4.857-2.116,11.049-3.64,18.428-4.156c-2.403,3.23-5.021,6.391-7.852,9.474"/> <g class="eyebrow"> <path fill="#FFFFFF" d="M138.142,55.064c-4.93,1.259-9.874,2.118-14.787,2.599c-0.336,3.341-0.776,6.689-1.322,10.037 c-4.569-1.465-8.909-3.222-12.996-5.226c-0.98,3.075-2.07,6.137-3.267,9.179c-5.514-3.067-10.559-6.545-15.097-10.329 c-1.806,2.889-3.745,5.73-5.816,8.515c-7.916-4.124-15.053-9.114-21.296-14.738l1.107-11.768h73.475V55.064z"/> <path fill="#FFFFFF" stroke="#3A5E77" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" d="M63.56,55.102 c6.243,5.624,13.38,10.614,21.296,14.738c2.071-2.785,4.01-5.626,5.816-8.515c4.537,3.785,9.583,7.263,15.097,10.329 c1.197-3.043,2.287-6.104,3.267-9.179c4.087,2.004,8.427,3.761,12.996,5.226c0.545-3.348,0.986-6.696,1.322-10.037 c4.913-0.481,9.857-1.34,14.787-2.599"/> </g> <g class="eyeL"> <circle cx="85.5" cy="78.5" r="3.5" fill="#3a5e77"/> <circle cx="84" cy="76" r="1" fill="#fff"/> </g> <g class="eyeR"> <circle cx="114.5" cy="78.5" r="3.5" fill="#3a5e77"/> <circle cx="113" cy="76" r="1" fill="#fff"/> </g> <g class="mouth"> <path class="mouthBG" fill="#617E92" d="M100.2,101c-0.4,0-1.4,0-1.8,0c-2.7-0.3-5.3-1.1-8-2.5c-0.7-0.3-0.9-1.2-0.6-1.8 c0.2-0.5,0.7-0.7,1.2-0.7c0.2,0,0.5,0.1,0.6,0.2c3,1.5,5.8,2.3,8.6,2.3s5.7-0.7,8.6-2.3c0.2-0.1,0.4-0.2,0.6-0.2 c0.5,0,1,0.3,1.2,0.7c0.4,0.7,0.1,1.5-0.6,1.9c-2.6,1.4-5.3,2.2-7.9,2.5C101.7,101,100.5,101,100.2,101z"/> <path style="display: none;" class="mouthSmallBG" fill="#617E92" d="M100.2,101c-0.4,0-1.4,0-1.8,0c-2.7-0.3-5.3-1.1-8-2.5c-0.7-0.3-0.9-1.2-0.6-1.8 c0.2-0.5,0.7-0.7,1.2-0.7c0.2,0,0.5,0.1,0.6,0.2c3,1.5,5.8,2.3,8.6,2.3s5.7-0.7,8.6-2.3c0.2-0.1,0.4-0.2,0.6-0.2 c0.5,0,1,0.3,1.2,0.7c0.4,0.7,0.1,1.5-0.6,1.9c-2.6,1.4-5.3,2.2-7.9,2.5C101.7,101,100.5,101,100.2,101z"/> <path style="display: none;" class="mouthMediumBG" d="M95,104.2c-4.5,0-8.2-3.7-8.2-8.2v-2c0-1.2,1-2.2,2.2-2.2h22c1.2,0,2.2,1,2.2,2.2v2 c0,4.5-3.7,8.2-8.2,8.2H95z"/> <path style="display: none;" class="mouthLargeBG" d="M100 110.2c-9 0-16.2-7.3-16.2-16.2 0-2.3 1.9-4.2 4.2-4.2h24c2.3 0 4.2 1.9 4.2 4.2 0 9-7.2 16.2-16.2 16.2z" fill="#617e92" stroke="#3a5e77" stroke-linejoin="round" stroke-width="2.5"/> <defs> <path id="mouthMaskPath" d="M100.2,101c-0.4,0-1.4,0-1.8,0c-2.7-0.3-5.3-1.1-8-2.5c-0.7-0.3-0.9-1.2-0.6-1.8 c0.2-0.5,0.7-0.7,1.2-0.7c0.2,0,0.5,0.1,0.6,0.2c3,1.5,5.8,2.3,8.6,2.3s5.7-0.7,8.6-2.3c0.2-0.1,0.4-0.2,0.6-0.2 c0.5,0,1,0.3,1.2,0.7c0.4,0.7,0.1,1.5-0.6,1.9c-2.6,1.4-5.3,2.2-7.9,2.5C101.7,101,100.5,101,100.2,101z"/> </defs> <clipPath id="mouthMask"> <use xlink:href="#mouthMaskPath" overflow="visible"/> </clipPath> <g clip-path="url(#mouthMask)">.........完整代码请登录后点击上方下载按钮下载查看
网友评论0