• 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
  • 相关阅读:
    Docker 第十三章 : Docker 三剑客之 Swarm(服务管理命令)
    设计模式——模板方法
    数据链路层-可靠传输机制(选择重传协议SR)
    docker入门加实战—部署Java和前端项目
    【C语言学习笔记---字符串函数】
    Dubbo入门实战最全攻略(基于 Spring Boot 实现)
    Linux简单命令学习 -- useradd passwd userdel
    韦东山FreeRTOS(1)ARM架构简明教程
    LeetCode 热题 HOT 100:链表专题
    GEO生信数据挖掘(四)数据清洗(离群值处理、低表达基因、归一化、log2处理)
  • 原文地址:https://blog.csdn.net/oneya1/article/details/134266306