• SVG循环滑动效果


    1.循环滑动图(4张)
    效果图
    在这里插入图片描述

    svg滑块视频

    代码:(如果要调整整体的速度和时间请对begin=“1s” dur="12s"属性进行编辑)

    <section style="margin: 0px auto;display: block;width: 100%;" data-mpa-powered-by="yiban.io">
    	<section style="overflow: hidden;line-height: 0;margin-top: -1px;visibility: visible;"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1080 1701" style="display: block;margin: 0px auto;visibility: visible;" width="100%">
    			<g style="visibility: visible;" name="默认第一章底图">
    				<foreignObject x="0" y="0" width="1080" height="1701" style="visibility: visible;"><svg style="display: block;background-image: url(https://img0.baidu.com/it/u=4274692597,1740785081&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=609);background-size: 100%;background-repeat: no-repeat;visibility: visible;" viewBox="0 0 500 609" width="100%" xmlns="http://www.w3.org/2000/svg">svg>foreignObject>
    			g>
    			<g style="visibility: visible;" name="第4张">
    				<foreignObject x="0" y="0" width="1080" height="1701" style="visibility: visible;"><svg style="display: block;background-image: url(https://img0.baidu.com/it/u=1996830734,2605251766&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=609);background-size: 100%;background-repeat: no-repeat;visibility: visible;" viewBox="0 0 500 609" width="100%" xmlns="http://www.w3.org/2000/svg">svg>foreignObject>
    				<animateTransform attributeName="transform" type="translate" repeatCount="indefinite" values="0 0; 0 0; 0 0;0 0; 0 0; 0 0; 0 0;-80 0;1080 0" fill="freeze" begin="1s" dur="12s" calcMode="spline" keySplines="0.42 0 0.58 1.0; 0.42 0 0.58 1.0; 0.42 0 0.58 1.0; 0.42 0 0.58 1.0; 0.42 0 0.58 1.0; 0.42 0 0.58 1.0; 0.42 0 0.58 1.0; 0.42 0 0.58 1.0">
    				animateTransform>
    			g>
    			<g style="visibility: visible;" name="第3张">
    				<foreignObject x="0" y="0" width="1080" height="1701" style="visibility: visible;"><svg style="display: block;background-image: url(https://img2.baidu.com/it/u=2793766631,1237398890&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=609);background-size: 100%;background-repeat: no-repeat;visibility: visible;" viewBox="0 0 500 609" width="100%" xmlns="http://www.w3.org/2000/svg">svg>foreignObject>
    				<animateTransform attributeName="transform" type="translate" repeatCount="indefinite" values="0 0; 0 0; 0 0; 0 0; 0 0; 80 0; -1080 0;-1080 0;-1080 0" fill="freeze" begin="1s" dur="12s" calcMode="spline" keySplines="0.42 0 0.58 1.0; 0.42 0 0.58 1.0; 0.42 0 0.58 1.0; 0.42 0 0.58 1.0; 0.42 0 0.58 1.0; 0.42 0 0.58 1.0; 0.42 0 0.58 1.0; 0.42 0 0.58 1.0">
    				animateTransform>
    			g>
    			<g style="visibility: visible;" name="第2张">
    				<foreignObject x="0" y="0" width="1080" height="1701" style="visibility: visible;"><svg style="display: block;background-image: url(https://img0.baidu.com/it/u=2790564678,3176655049&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=609);background-size: 100%;background-repeat: no-repeat;visibility: visible;" viewBox="0 0 500 609" width="100%" xmlns="http://www.w3.org/2000/svg">svg>foreignObject>
    				<animateTransform attributeName="transform" type="translate" repeatCount="indefinite" values="0 0; 0 0; 0 0; -80 0; 1080 0; 1080 0; 1080 0;1080 0;1080 0" fill="freeze" begin="1s" dur="12s" calcMode="spline" keySplines="0.42 0 0.58 1.0; 0.42 0 0.58 1.0; 0.42 0 0.58 1.0; 0.42 0 0.58 1.0; 0.42 0 0.58 1.0; 0.42 0 0.58 1.0; 0.42 0 0.58 1.0; 0.42 0 0.58 1.0">
    				animateTransform>
    			g>
    			<g style="visibility: visible;" name="第1张">
    				<foreignObject x="0" y="0" width="1080" height="1701" style="visibility: visible;"><svg style="display: block;background-image: url(https://img0.baidu.com/it/u=4274692597,1740785081&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=609);background-size: 100%;background-repeat: no-repeat;visibility: visible;" viewBox="0 0 500 609" width="100%" xmlns="http://www.w3.org/2000/svg">svg>foreignObject>
    				<animateTransform attributeName="transform" type="translate" repeatCount="indefinite" values="0 0; 80 0; -1080 0; -1080 0; -1080 0; -1080 0; -1080 0;-1080 0;-1080 0" fill="freeze" begin="1s" dur="12s" calcMode="spline" keySplines="0.42 0 0.58 1.0; 0.42 0 0.58 1.0; 0.42 0 0.58 1.0; 0.42 0 0.58 1.0; 0.42 0 0.58 1.0; 0.42 0 0.58 1.0; 0.42 0 0.58 1.0; 0.42 0 0.58 1.0">
    				animateTransform>
    			g>
    		svg>section>
    section>
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
  • 相关阅读:
    Netty入门--传统IO与NIO详解
    阿里DataWorks的数据服务进行模糊查询
    xctf攻防世界 Web高手进阶区 shrine
    【大揭秘】美团面试题:ConcurrentHashMap和Hashtable有什么区别?一文解析!
    AI文本创作在百度App发文的实践
    软件测试“摆烂”已经成为常态化,我们应该怎样冲出重围?
    JWT登录验证前后端设计与实现笔记
    【浅谈IDE宏指令录制】为加速chrome扩展国际化,我从vscode回归notepad++
    如何远程配置linux系统和在linux系统安装软件
    【从零开始一步步学习VSOA开发】同步RPC客户端
  • 原文地址:https://blog.csdn.net/oneya1/article/details/134266306