svg线框动画效果
代码语言:html
所属分类:动画
代码描述:svg线框动画效果
代码标签: 效果
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <style> body { margin: 0px; padding: 0px; justify-content: center; align-items: center; display: flex; min-height: 100vh; background: #EEC0B9; } .container { display: flex; justify-content:center; align-items: center; } .svg-icon { width: 150px !important; justify-content: space-between; } .svg-icon path{ fill: transparent; stroke: #002672; stroke-dasharray: 1700; stroke-offset: 0; width: 200px ; height: 200px; } .svg-icon:hover path { animation: animate 2s linear forwards; } .pomegranate{ stroke-width: 10 } .mango{ stroke-width: 7; } .strawberry{ stroke-width: 9; } .pineapple{ stroke-width: 2; } .cherry{ stroke-width: 7; } .mango:hover path { animation: mango-color 2s linear forwards; } .pomegranate:hover path { animation: pomegranate-color 2s linear forwards; } .pineapple:hover path { animation: pineapple-color 2s linear forwards; } .strawberry:hover path { animation: strawberry-color 2s linear forwards; } .cherry:hover path { animation: cherry-color 2s linear forwards; } @keyframes strawberry-color{ 0%{ stroke-dashoffset: 0; } 40%{ stroke-dashoffset: 1700; } 80%{ stroke-dashoffset: 3400; fill: transparent; } 100%{ stroke-dashoffset: 3400; fill: red; stroke: #262626; stroke-width: 2px; } } @keyframes cherry-color{ 0%{ stroke-dashoffset: 0; } 40%{ stroke-dashoffset: 1700; } 80%{ stroke-dashoffset: 3400; fill: transparent; } 100%{ stroke-dashoffset: 3400; fill: green; stroke: #262626; stroke-width: 2px; } } @keyframes mango-color{ 0%{ stroke-dashoffset: 0; } 40%{ stroke-dashoffset: 1700; } 80%{ stroke-dashoffset: 3400; fill: transparent; } 100%{ stroke-dashoffset: 3400; fill: orange; stroke: #262626; stroke-width: 2px; } } @keyframes pineapple-color{ 0%{ stroke-dashoffset: 0; } 40%{ stroke-dashoffset: 1700; } 80%{ stroke-dashoffset: 3400; fill: transparent; } 100%{ stroke-dashoffset: 3400; fill: yellow; stroke: #262626; stroke-width: 2px; } } @keyframes pomegranate-color{ 0%{ stroke-dashoffset: 0; } 40%{ stroke-dashoffset: 1700; } 80%{ stroke-dashoffset: 3400; fill: transparent; } 100%{ stroke-dashoffset: 3400; fill: red; stroke: #262626; stroke-width: 2px; } } /* @keyframes animate{ 0%{ stroke-dashoffset: 0; } 40%{ stroke-dashoffset: 1700; } 80%{ stroke-dashoffset: 3400; fill: transparent; } 100%{ stroke-dashoffset: 3400; .........完整代码请登录后点击上方下载按钮下载查看
网友评论0