公众号svg点击切换图片播放音乐功能

公众号svg点击切换图片播放音乐功能
1公众号导入音频
在这里插入图片描述
2使用壹伴插件把公众号音频组件复制到代码替换

在这里插入图片描述
3替换下面 mp-common-mpaudio 标签并粘贴公众号后台预览

<!DOCTYPE html>
<html lang="">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width,initial-scale=1.0">
    <link rel="icon">
    <title>svg</title>
    <style>

    </style>
</head>

<body>
    <section 
        style="-webkit-touch-callout:none;user-select:text;overflow: hidden;text-align: center;line-height: 0;margin-bottom: 0px;">
        <section style="overflow: hidden;text-align: center;line-height: 0;margin-top: -1px;" 
            label="切换图片_播放音频">
            <section style="text-align: center;height: 0;line-height: 0;width: 100%;margin: 0px auto;"
                 label="切换图片_播放音频"><svg
                    style="background-image: url(http://gips3.baidu.com/it/u=3419425165,837936650&fm=3028&app=3028&f=JPEG&fmt=auto?w=1024&h=1024); background-repeat: no-repeat; display: block; background-size: 100%;"
                    version="1.1" viewBox="0 0 1000 611" x="0px" y="0px"
                    data-lazy-bgimg="http://gips3.baidu.com/it/u=3419425165,837936650&fm=3028&app=3028&f=JPEG&fmt=auto?w=1024&h=1024"
                    class="" data-fail="0"></svg></section>
            <section style="text-align: center;height: 0;line-height: 0;width: 100%;margin: 0px auto;overflow: visible;"
                 label="切换图片_播放音频">
                <section style="display: block;line-height: 0;transform: rotateZ(90deg);opacity: 0;">
                    <section style="transform:scale(100) translate(-37.5vw,-8.5vw);">
                        <section>
                            <mp-common-mpaudio src="" author=""
                                cover=""
                                isaac2="" low_size="" source_size="" high_size="" name="bg" play_length="02:39"
                                duration="159" show-listen-later="1" err_tips="" data-trans_state="1"
                                data-verify_state="0" data-topic_link="" data-topic_id="" data-topic_name=""
                                voice_encode_fileid=" class="mp_common_widget">
                            </mp-common-mpaudio>
                        </section>
                    </section>
                </section>
            </section>
            <section style="text-align: center;line-height: 0;width: 100%;pointer-events: none;transform: scale(1);"
                 label="切换图片_播放音频"><svg
                    style="display: block;line-height: 0;pointer-events: none;transform: scale(1);"
                    viewBox="0 0 1000 611">
                    <g>
                        <animateTransform attributeName="transform" type="translate"
                            values="0 0; 0 0; 500000000 500000000; 500000000 500000000" begin="touchstart+0.8s"
                            dur="1000s" keyTimes="0; 0.0005; 0.0005; 1"></animateTransform>
                        <animateTransform attributeName="transform" type="translate" values="0 0; 0 0; 0 0"
                            begin="touchmove+0.8s" dur="1000s" keyTimes="0; 0.0005; 1"></animateTransform>
                        <animate attributeName="opacity" fill="freeze" values="1; 0" dur="0.5s" begin="touchstart+0.3s">
                        </animate>
                        <animate attributeName="opacity" fill="freeze" values="1; 1" dur="0.5s" begin="touchmove+0.3s">
                        </animate>
                        <foreignObject x="0" y="0" width="100%" height="100%"><svg
                                style="background-image: url(http://gips2.baidu.com/it/u=195724436,3554684702&fm=3028&app=3028&f=JPEG&fmt=auto?w=1280&h=960); background-repeat: no-repeat; display: block; background-size: 100%;"
                                version="1.1" viewBox="0 0 1000 611" x="0px" y="0px"
                                data-lazy-bgimg="http://gips2.baidu.com/it/u=195724436,3554684702&fm=3028&app=3028&f=JPEG&fmt=auto?w=1280&h=960"
                                class="" data-fail="0"></svg></foreignObject>
                        <rect x="0" y="0" width="100%" height="100%" style="pointer-events: visiblePainted;opacity:0;"
                           >
                            <animate attributeName="width" fill="freeze" values="100%;0;0" keyTimes="0;0.0001;1"
                                dur="1000s" begin="touchstart" additive="replace"></animate>
                            <animate attributeName="width" fill="freeze" restart="always" calcMode="spline"
                                begin="touchmove" dur="1000s" values="100%; 100%" keySplines="0.42 0 0.58 1.0"
                                additive="replace"></animate>
                            <set attributeName="visibility" from="visible" to="hidden" begin="touchstart"
                                dur="0.00001s"></set>
                            <set attributeName="visibility" from="hidden" to="visible" begin="touchmove"></set>
                        </rect>
                    </g>
                </svg></section>
        </section>
    </section>
</body>

</html>```

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
公众号SVG互动答题是基于SVG(可缩放矢量图形)技术开发的一种互动答题平台SVG是一种基于XML的图像格式,可以实现高清晰度、可缩放、无失真的图形展示效果。 在公众号SVG互动答题中,用户可以通过在界面上点击或拖动,对SVG图形进行互动操作,以回答问题或解决难题。这种互动形式主要是通过在SVG图像上添加交互元素和动画效果实现的,使得用户能够更加直观地理解问题和答案。 通过公众号SVG互动答题,用户可以获得以下几方面的益处: 1. 提升学习和记忆能力:通过互动参与,用户能够更加深入地理解和记忆相关的知识点,从而提高学习效果。 2. 增强思维和逻辑能力:答题过程需要用户进行思维分析和逻辑推理,培养并提高用户的思维和逻辑能力。 3. 丰富化学习方式:与传统的纸质题目相比,公众号SVG互动答题以其视觉、听觉等多种感官形式进行呈现,为用户提供了一种全新的、丰富多样的学习方式。 4. 提高参与积极性:互动答题的形式更具有趣味性和互动性,能够激发用户的参与积极性,增加学习的乐趣。 5. 提供即时反馈和个性化学习:用户答题后,系统可以立即给出反馈和评估,帮助用户及时发现和纠正问题,提供个性化的学习指导。 总体而言,公众号SVG互动答题通过图形化、互动化的方式,为用户提供了一种全新的、丰富多样的学习与娱乐方式,促进了用户的学习兴趣和学习效果的提升。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值