7wu1wm0 发表于 2024-6-29 14:05:18

HTML5+CSS3高级动画的应用实践

<img src="https://mmbiz.qpic.cn/mmbiz/yqVAqoZvDibG3130Y2hAXktGHLUh928RJm3myrqkheLOYFvHIjErDMWl3Qwme8oOCvvSZmiaC6ykrRgVLTH9AzgA/640?wx_fmt=gif&amp;tp=webp&amp;wxfrom=5&amp;wx_lazy=1&amp;retryload=1" style="width: 50%; margin-bottom: 20px;">
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">本文为作者行舟客投稿,点击阅读原文可到达github<span style="color: black;">位置</span>~</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">github<span style="color: black;">位置</span>:https://github.com/1314mxc/yunUI ,欢迎star!</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">咱们</span>大概都<span style="color: black;">晓得</span>css<span style="color: black;">能够</span>用来作平面旋转、扭曲、放大缩小、平移。。。并且用起来几乎都得心应手。但<span style="color: black;">日前</span><span style="color: black;">来讲</span>,3D效果的“高级”动画似乎更受欢迎<span style="color: black;">有些</span>,<span style="color: black;">况且</span><span style="color: black;">咱们</span><span style="color: black;">亦</span>确实<span style="color: black;">必须</span>。</p>

    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">这不,前两天笔者就在项目中给“<strong style="color: blue;">翻转动画</strong>”<span style="color: black;">增多</span>了一个3D效果,看起来贼爽:<img src="https://mmbiz.qpic.cn/sz_mmbiz_gif/2wV7LicL762ZC3ibWfiatVmzP1dKDVWj1bZsTEVySSibU5XfPhOz0icGSwnyPSUh088j64podczia4zZ6IibkHaehAqgg/640?wx_fmt=gif&amp;tp=webp&amp;wxfrom=5&amp;wx_lazy=1&amp;wx_co=1" style="width: 50%; margin-bottom: 20px;"></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">这个动画实现所用到的3D盒子模型是<span style="color: black;">此刻</span>3D模型中最常用的一个 —— <span style="color: black;">不外</span><span style="color: black;">咱们</span>先拿其中两个面分析:</p><span style="color: black;">首要</span>,要实现这个功能,<span style="color: black;">咱们</span>从外往里看:把文字所在部分看作一个盒子的话,前后两个横线并不属于这个盒子才对,<span style="color: black;">那样</span>,很自然就想到了—— ::after 和 ::before 伪元素;其次,两个文字分别在两个div上,<span style="color: black;">那样</span>就<span style="color: black;">必须</span>有一个<span style="color: black;">能够</span>附带 overflow: hidden 的盒子 —— <span style="color: black;">不可</span>加到上面的盒子中,<span style="color: black;">由于</span>after和before不属于div!最后是两个元素的翻转效果:<span style="color: black;">咱们</span><span style="color: black;">必须</span><span style="color: black;">晓得</span>的是,为了性能<span style="color: black;">思虑</span>,<span style="color: black;">咱们</span>最好是对<span style="color: black;">全部</span>盒子进行翻转,而不是对两个文字div附加动画<span style="color: black;">★</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">事实上,transform动画中的属性<span style="color: black;">暗示</span>的含义<span style="color: black;">更加多</span>的是“过渡多少”而不是“过渡到哪里”!</p><span style="color: black;">”</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">那样</span>,这个层级关系就很明了了:</p><span style="color: black;">&lt;!--伪元素装饰盒子--&gt;</span><span style="color: black;">&lt;<span style="color: black;">div</span>&nbsp;<span style="color: black;">class</span>=<span style="color: black;">"pic_border"</span>&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;!--overflow-hidden盒子--&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;<span style="color: black;">div</span>&nbsp;<span style="color: black;">class</span>=<span style="color: black;">"pic_box"</span>&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;!--transition过渡盒子--&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;<span style="color: black;">div</span>&nbsp;<span style="color: black;">class</span>=<span style="color: black;">"pic_item"</span>&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;<span style="color: black;">div</span>&nbsp;<span style="color: black;">class</span>=<span style="color: black;">"pic_text"</span>&gt;</span>music<span style="color: black;">&lt;/<span style="color: black;">div</span>&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;<span style="color: black;">div</span>&nbsp;<span style="color: black;">class</span>=<span style="color: black;">"pic_back"</span>&gt;</span>此时此刻,非我莫属<span style="color: black;">&lt;/<span style="color: black;">div</span>&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;/<span style="color: black;">div</span>&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;/<span style="color: black;">div</span>&gt;</span><span style="color: black;">&lt;/<span style="color: black;">div</span>&gt;</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">按照上面所说,<span style="color: black;">咱们</span>很容易为它添加对应的CSS:</p><span style="color: black;">.pic_border</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">{</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">position</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">:&nbsp;relative;</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">}</p><span style="color: black;">.pic_border</span><span style="color: black;">::before</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">{</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">content</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">:&nbsp;;</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">position</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">:&nbsp;absolute;</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">top</span>:&nbsp;<span style="color: black;">50%</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">;</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">left</span>:&nbsp;<span style="color: black;">0</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">;</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">width</span>:&nbsp;<span style="color: black;">43vw</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">;</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">height</span>:&nbsp;<span style="color: black;">1px</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">;</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">bac<span style="color: black;">公斤</span>round-color</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">:&nbsp;red;</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">}</p><span style="color: black;">.pic_border</span><span style="color: black;">::after</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">{</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">content</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">:&nbsp;;</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">position</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">:&nbsp;absolute;</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">top</span>:&nbsp;<span style="color: black;">50%</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">;</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">right</span>:&nbsp;<span style="color: black;">0</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">;</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">width</span>:&nbsp;<span style="color: black;">43vw</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">;</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">height</span>:&nbsp;<span style="color: black;">1px</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">;</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">bac<span style="color: black;">公斤</span>round-color</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">:&nbsp;red;</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">}</p>@<span style="color: black;">media</span>screen&nbsp;and&nbsp;(max-width:<span style="color: black;">1100px</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">)&nbsp;{</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">.pic_border</span><span style="color: black;">::before</span>,<span style="color: black;">.pic_border</span><span style="color: black;">::after</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">{</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">width</span>:&nbsp;<span style="color: black;">20vw</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">;</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;&nbsp;&nbsp;&nbsp;}</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">}</p><span style="color: black;">.pic_box</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">{</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">display</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">:&nbsp;inline-block;</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">height</span>:&nbsp;<span style="color: black;">70px</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">;</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">margin-left</span>:&nbsp;<span style="color: black;">calc</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">(50%&nbsp;-&nbsp;70px);</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">overflow</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">:&nbsp;hidden;</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">perspective</span>:&nbsp;<span style="color: black;">2000px</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">;</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">cursor</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">:&nbsp;pointer;</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">user-select</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">:&nbsp;none;</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">}</p><span style="color: black;">.pic_item</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">{</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">width</span>:&nbsp;<span style="color: black;">100%</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">;</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">height</span>:&nbsp;<span style="color: black;">100%</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">;</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">transform-style</span>:&nbsp;preserve-<span style="color: black;">3</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">d;</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">transition</span>:&nbsp;all&nbsp;.<span style="color: black;">7s</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;ease;</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">}</p><span style="color: black;">.pic_text</span>,<span style="color: black;">.pic_back</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">{</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">width</span>:&nbsp;<span style="color: black;">100%</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">;</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">height</span>:&nbsp;<span style="color: black;">100%</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">;</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">display</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">:&nbsp;flex;</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">justify-content</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">:&nbsp;center;</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">align-items</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">:&nbsp;center;</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">}</p><span style="color: black;">.pic_text</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">{</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">transform</span>:&nbsp;<span style="color: black;">rotateX</span>(0deg)&nbsp;<span style="color: black;">translateZ</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">(-21.9px);</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">}</p><span style="color: black;">.pic_back</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">{</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">transform</span>:&nbsp;<span style="color: black;">rotateX</span>(90deg)&nbsp;<span style="color: black;">translateZ</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">(-15px);</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">}</p><span style="color: black;">.pic_box</span><span style="color: black;">:hover</span>&nbsp;<span style="color: black;">.pic_item</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">{</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">transform</span>:&nbsp;<span style="color: black;">rotateX</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">(-90deg);</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">}</p><span style="color: black;">.pic_box</span><span style="color: black;">:active</span>&nbsp;<span style="color: black;">.pic_item</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">{</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">transform</span>:&nbsp;<span style="color: black;">rotateX</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">(-90deg);</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">}</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">必须</span><span style="color: black;">重视</span>的是:<strong style="color: blue;">3D效果是<span style="color: black;">必定</span>要有Z轴参与的!</strong> <span style="color: black;">否则</span>会<span style="color: black;">显出</span>很“尴尬”<img src="https://mmbiz.qpic.cn/sz_mmbiz_png/2wV7LicL762ZC3ibWfiatVmzP1dKDVWj1bZo9VWV82AYxHKCia0JXZnSgAuGykbaNthHvWQ626a7kYjCZHb2ibDDpVQ/640?wx_fmt=png&amp;tp=webp&amp;wxfrom=5&amp;wx_lazy=1&amp;wx_co=1" style="width: 50%; margin-bottom: 20px;"></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">有了简单的上下翻滚,<span style="color: black;">咱们</span>还<span style="color: black;">能够</span>实现“<strong style="color: blue;">跟随鼠标上下<span style="color: black;">上下</span>翻滚</strong>”动画,<span style="color: black;">便是</span><span style="color: black;">所说</span>的“鼠标从哪里进入盒子,盒子就往哪个方向翻转” —— 有两种实现方式:</p>在最外层盒子中加四个方向的i或span标签,用来判断鼠标从哪里进入,JS<span style="color: black;">掌控</span>盒子做对应的rotateX/Y;借助<strong style="color: blue;">数学库与“matrix”</strong>:<span style="color: black;">&lt;<span style="color: black;">div</span>&nbsp;<span style="color: black;">class</span>=<span style="color: black;">"block"</span>&nbsp;<span style="color: black;">id</span>=<span style="color: black;">"block"</span>&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;<span style="color: black;">div</span>&nbsp;<span style="color: black;">class</span>=<span style="color: black;">"face&nbsp;front"</span>&gt;</span><span style="color: black;">&lt;/<span style="color: black;">div</span>&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;<span style="color: black;">div</span>&nbsp;<span style="color: black;">class</span>=<span style="color: black;">"face&nbsp;back"</span>&gt;</span><span style="color: black;">&lt;/<span style="color: black;">div</span>&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;<span style="color: black;">div</span>&nbsp;<span style="color: black;">class</span>=<span style="color: black;">"face&nbsp;up"</span>&gt;</span><span style="color: black;">&lt;/<span style="color: black;">div</span>&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;<span style="color: black;">div</span>&nbsp;<span style="color: black;">class</span>=<span style="color: black;">"face&nbsp;down"</span>&gt;</span><span style="color: black;">&lt;/<span style="color: black;">div</span>&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;<span style="color: black;">div</span>&nbsp;<span style="color: black;">class</span>=<span style="color: black;">"face&nbsp;left"</span>&gt;</span><span style="color: black;">&lt;/<span style="color: black;">div</span>&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;<span style="color: black;">div</span>&nbsp;<span style="color: black;">class</span>=<span style="color: black;">"face&nbsp;right"</span>&gt;</span><span style="color: black;">&lt;/<span style="color: black;">div</span>&gt;</span><span style="color: black;">&lt;/<span style="color: black;">div</span>&gt;</span><span style="color: black;">.block</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;{</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">position</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">:&nbsp;absolute;</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">transform-style</span>:&nbsp;preserve-<span style="color: black;">3</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">d;</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">width</span>:&nbsp;<span style="color: black;">100px</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">;</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">height</span>:&nbsp;<span style="color: black;">100px</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">;</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">transform-origin</span>:&nbsp;<span style="color: black;">50px</span>&nbsp;<span style="color: black;">50px</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">;</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">}</p><span style="color: black;">.front</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;{</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">bac<span style="color: black;">公斤</span>round</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">:&nbsp;fuchsia;</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">}</p><span style="color: black;">.back</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;{</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">transform</span>:&nbsp;<span style="color: black;">translate3d</span>(0,&nbsp;0,&nbsp;100px)&nbsp;<span style="color: black;">rotateY</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">(180deg);</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">bac<span style="color: black;">公斤</span>round</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">:&nbsp;red;</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">}</p><span style="color: black;">.left</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;{</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">transform-origin</span>:&nbsp;<span style="color: black;">100%</span>&nbsp;<span style="color: black;">50%</span>&nbsp;<span style="color: black;">0px</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">;</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">transform</span>:&nbsp;<span style="color: black;">rotateY</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">(90deg);</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">bac<span style="color: black;">公斤</span>round</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">:&nbsp;aqua;</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">}</p><span style="color: black;">.right</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;{</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">transform-origin</span>:&nbsp;<span style="color: black;">0%</span>&nbsp;<span style="color: black;">50%</span>&nbsp;<span style="color: black;">0px</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">;</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">transform</span>:&nbsp;<span style="color: black;">rotateY</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">(-90deg);</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">bac<span style="color: black;">公斤</span>round</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">:&nbsp;blueviolet;</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">}</p><span style="color: black;">.up</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;{</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">transform-origin</span>:&nbsp;<span style="color: black;">50%</span>&nbsp;<span style="color: black;">0%</span>&nbsp;<span style="color: black;">0px</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">;</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">transform</span>:&nbsp;<span style="color: black;">rotateX</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">(90deg);</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">bac<span style="color: black;">公斤</span>round</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">:&nbsp;darkorange;</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">}</p><span style="color: black;">.down</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;{</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">transform-origin</span>:&nbsp;<span style="color: black;">50%</span>&nbsp;<span style="color: black;">100%</span>&nbsp;<span style="color: black;">0px</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">;</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">transform</span>:&nbsp;<span style="color: black;">rotateX</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">(-90deg);</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">bac<span style="color: black;">公斤</span>round</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">:&nbsp;darkviolet;</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">}</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">为了便于观察,<span style="color: black;">咱们</span>为让魔方格子旋转起来:鼠标滑动分为左、右、上、下滑动,每种滑动对应一种方向的格子旋转。</p>从右往左:绕 Y 轴旋转 θ 角从左往右:绕 Y 轴旋转 -θ 角从上往下:绕 X 轴旋转 θ 角从下往上:绕 X 轴旋转 -θ 度<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">当然旋转<span style="color: black;">必须</span>有一个参照点,默认盒子中心。<span style="color: black;">咱们</span><span style="color: black;">能够</span>借助库函数将生成的矩阵转化为 CSS 中 transform 的 matrix3d 属性值。</p><span style="color: black;">var</span>&nbsp;currentQ&nbsp;=&nbsp;{<span style="color: black;">x</span>:<span style="color: black;">0</span>,&nbsp;<span style="color: black;">y</span>:<span style="color: black;">0</span>,&nbsp;<span style="color: black;">z</span>:<span style="color: black;">0</span>,&nbsp;<span style="color: black;">w</span>:<span style="color: black;">1</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">};</p><span style="color: black;">var</span>&nbsp;lastQ&nbsp;=&nbsp;{<span style="color: black;">x</span>:<span style="color: black;">0</span>,&nbsp;<span style="color: black;">y</span>:<span style="color: black;">0</span>,&nbsp;<span style="color: black;">z</span>:<span style="color: black;">0</span>,&nbsp;<span style="color: black;">w</span>:<span style="color: black;">1</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">};</p><span style="color: black;">var</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;currentMatrix&nbsp;=&nbsp;matrix.identity();</p><span style="color: black;">var</span>l&nbsp;=<span style="color: black;">Math</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">.sqrt(dx&nbsp;*&nbsp;dx&nbsp;+&nbsp;dy&nbsp;*&nbsp;dy);</p><span style="color: black;">if</span>(l&nbsp;&lt;=&nbsp;<span style="color: black;">0</span>)&nbsp;<span style="color: black;">return</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">;</p><span style="color: black;">var</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;x&nbsp;=&nbsp;dx&nbsp;/&nbsp;l,&nbsp;y&nbsp;=&nbsp;dy&nbsp;/&nbsp;l;</p><span style="color: black;">var</span>&nbsp;axis&nbsp;=&nbsp;{<span style="color: black;">x</span>:&nbsp;x,&nbsp;<span style="color: black;">y</span>:&nbsp;y,&nbsp;<span style="color: black;">z</span>:&nbsp;<span style="color: black;">0</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">};</p><span style="color: black;">var</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;q&nbsp;=&nbsp;matrix.fromAxisAndAngle(axis,&nbsp;l);</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">currentQ&nbsp;=&nbsp;matrix.multiplyQuaternions(q,&nbsp;lastQ);</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">currentMatrix&nbsp;=&nbsp;matrix.makeRotationFromQuaternion(currentQ);</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">经过</span><span style="color: black;">以上</span>方式<span style="color: black;">咱们</span>计算出了当前旋转矩阵 currentMatrix,接下来,<span style="color: black;">咱们</span><span style="color: black;">运用</span>上面介绍的矩阵转化成对应 css 的函数,生成对应的 transform 属性:</p><span style="color: black;">//&nbsp;将矩阵转化为transform matrix 属性值。</span><span style="color: black;"><span style="color: black;">function</span>&nbsp;<span style="color: black;">matrix2css</span>(<span style="color: black;">m</span>)</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">{</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">var</span>&nbsp;style&nbsp;=&nbsp;<span style="color: black;">matrix(</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">;</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">if</span>(m.length&nbsp;==&nbsp;<span style="color: black;">16</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">){</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;style&nbsp;=&nbsp;<span style="color: black;">matrix3d(</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;&nbsp;&nbsp;&nbsp;}</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">for</span>(<span style="color: black;">let</span>&nbsp;i&nbsp;=<span style="color: black;">0</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">;&nbsp;i&lt;&nbsp;m.length;&nbsp;i++){</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;style&nbsp;+=&nbsp;m;</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">if</span>(i&nbsp;!==&nbsp;m.length&nbsp;-&nbsp;<span style="color: black;">1</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">){</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;style&nbsp;+=&nbsp;<span style="color: black;">,</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<span style="color: black;">else</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">{</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;style&nbsp;+=<span style="color: black;">)</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;&nbsp;&nbsp;&nbsp;}</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">return</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;style;</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">}</p><span style="color: black;">var</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;style&nbsp;=&nbsp;matrix2css(currentMatrix);</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">最后将生成的样式应用到魔方格子上:</p><span style="color: black;">document</span>.querySelector(<span style="color: black;">#block</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">).style.transform&nbsp;=&nbsp;style;</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">这般</span>就实现了一个美妙的动画盒子!</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;">帧动画在canvas中的应用</strong></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">除去CSS-transform和animation在项目中的大放异彩,canvas+CSS的动画方式<span style="color: black;">亦</span>得到了<span style="color: black;">非常多</span>人的支持!而canvas中实现动画的最好方式不是离屏技术、不是canvas动画库,而是帧动画!</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">咱们</span><span style="color: black;">一般</span><span style="color: black;">经过</span>requestAnimFrame<span style="color: black;">掌控</span>一张<span style="color: black;">照片</span>上的<span style="color: black;">表示</span>区域的位置从而达到“伪动画”!</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">例如</span>:<img src="https://mmbiz.qpic.cn/sz_mmbiz_jpg/2wV7LicL762ZC3ibWfiatVmzP1dKDVWj1bZxFRxibMcRyLwEs6qxmQasiaPLKuDzrPaxia0SPApqficgbtLprPJUAah0g/640?wx_fmt=jpeg&amp;tp=webp&amp;wxfrom=5&amp;wx_lazy=1&amp;wx_co=1" style="width: 50%; margin-bottom: 20px;"></p><span style="color: black;">//调用方js部分内容</span><span style="color: black;">var</span>&nbsp;starPic=<span style="color: black;">new</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;Image()</p>starPic.src=<span style="color: black;">"上面<span style="color: black;">照片</span><span style="color: black;">位置</span>"</span><span style="color: black;">var</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">lastTime,deltaTime;</p><span style="color: black;">var</span>&nbsp;stardog=<span style="color: black;">new</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;starObj()</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">stardog.init()</p>lastTime=<span style="color: black;">Date</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">.now()</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">gameloop()</p><span style="color: black;"><span style="color: black;">function</span>&nbsp;<span style="color: black;">gameloop</span>()</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">{</p>&nbsp;<span style="color: black;">window</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">.requestAnimFrame(gameloop)</p>&nbsp;<span style="color: black;">var</span>&nbsp;now=<span style="color: black;">Date</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">.now()</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">deltaTime=now-lastTime</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;lastTime=now</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;drawStars()</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">}</p><span style="color: black;">//真正<span style="color: black;">掌控</span>动画的js文件</span><span style="color: black;">var</span>&nbsp;satrObj=<span style="color: black;"><span style="color: black;">function</span>()</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">{</p>&nbsp;<span style="color: black;">this</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">.x;</p>&nbsp;<span style="color: black;">this</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">.y;</p>&nbsp;<span style="color: black;">this</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">.picNo;</p>&nbsp;<span style="color: black;">this</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">.timer;</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">}</p>starObj.prototype.init=<span style="color: black;"><span style="color: black;">function</span>()</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">{</p>&nbsp;<span style="color: black;">this</span>.x=<span style="color: black;">Math</span>.random()*<span style="color: black;">630</span>+<span style="color: black;">100</span>;&nbsp;&nbsp;&nbsp;<span style="color: black;">//630:<span style="color: black;">照片</span>宽度</span>&nbsp;<span style="color: black;">this</span>.y=<span style="color: black;">Math</span>.random()*<span style="color: black;">70</span>+<span style="color: black;">150</span>;&nbsp;&nbsp;&nbsp;<span style="color: black;">//70:<span style="color: black;">照片</span>高度</span>&nbsp;<span style="color: black;">this</span>.picNo=<span style="color: black;">0</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">;</p>&nbsp;<span style="color: black;">this</span>.timer=<span style="color: black;">0</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">;</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">}</p>starObj.prototype.update=<span style="color: black;"><span style="color: black;">function</span>()</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">{</p>&nbsp;<span style="color: black;">this</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">.timer+=deltaTime;</p>&nbsp;<span style="color: black;">if</span>(<span style="color: black;">this</span>.timer&gt;<span style="color: black;">50</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">){</p>&nbsp;&nbsp;<span style="color: black;">this</span>.picNo+=<span style="color: black;">1</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">;</p>&nbsp;&nbsp;<span style="color: black;">this</span>.picNo%=<span style="color: black;">7</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">;</p>&nbsp;&nbsp;<span style="color: black;">this</span>.timer=<span style="color: black;">0</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">;</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;}</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">}</p>starObj.prototype.draw=<span style="color: black;"><span style="color: black;">function</span>()</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">{</p>&nbsp;ctx.drawImage(starPic,<span style="color: black;">0</span>,<span style="color: black;">0</span>,<span style="color: black;">this</span>.picNo*<span style="color: black;">70</span>,<span style="color: black;">70</span>,<span style="color: black;">this</span>.x,<span style="color: black;">this</span>.y,<span style="color: black;">70</span>,<span style="color: black;">70</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">)</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">}</p><span style="color: black;"><span style="color: black;">function</span>&nbsp;<span style="color: black;">drawStars</span>()</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">{</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;stardog.update();</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;stardog.draw();</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">}</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><img src="https://mmbiz.qpic.cn/sz_mmbiz_gif/2wV7LicL762ZC3ibWfiatVmzP1dKDVWj1bZm57GIowhHJJ3n7ib4FLMGLxzTAao8ZSCia05iaOTMUgRDx1XpMPKOnNDA/640?wx_fmt=gif&amp;tp=webp&amp;wxfrom=5&amp;wx_lazy=1&amp;wx_co=1" style="width: 50%; margin-bottom: 20px;">毫<span style="color: black;">没</span>疑问的是:这种方式对UI和前端的结合<span style="color: black;">起始</span>有了<span style="color: black;">需求</span>。(笔者前段时间<span style="color: black;">科研</span>支付宝春节活动<span style="color: black;">发掘</span>:里面采用的<span style="color: black;">亦</span>是“前端引入动画文件”的方式!)</p>最后<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">欢迎加我<span style="color: black;">微X</span>(winty230),拉你进技术群,<span style="color: black;">长时间</span>交流学习...</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">欢迎关注「前端Q」,认真学前端,做个专业的技术人...</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><img src="https://mmbiz.qpic.cn/mmbiz_png/2wV7LicL762bCOIS0es2Dvt0PXFBaRkRCpHTOlwao0X1xJFAQW9SAa6mgzRIO5fXktSjOSuZALqgt0ibBDBcPf9g/640?wx_fmt=png&amp;tp=webp&amp;wxfrom=5&amp;wx_lazy=1&amp;wx_co=1" style="width: 50%; margin-bottom: 20px;"></p><img src="https://mmbiz.qpic.cn/mmbiz_png/7QRTvkK2qC6BGNLOQxwBmMTOGmO0dSd31LlXL5HoZWBH6fKtSSeKQ2DOeTfVR7nHVXl0U7RSAchUVoia2bErYfg/640?wx_fmt=png&amp;tp=webp&amp;wxfrom=5&amp;wx_lazy=1&amp;wx_co=1" style="width: 50%; margin-bottom: 20px;">点个<span style="color: black;"><strong style="color: blue;">在看</strong></span>支持我吧<img src="https://mmbiz.qpic.cn/mmbiz_gif/7QRTvkK2qC6BGNLOQxwBmMTOGmO0dSd3NmOWsZBMWg3BC1msdwtyvBkNLYh1xGLQibm4QsHibClwxWfzuibicbJcIA/640?wx_fmt=gif&amp;tp=webp&amp;wxfrom=5&amp;wx_lazy=1" style="width: 50%; margin-bottom: 20px;">




星☆雨 发表于 2024-8-20 14:07:10

你的留言真是温暖如春,让我感受到了无尽的支持与鼓励。

星☆雨 发表于 2024-9-9 05:44:00

谷歌外链发布 http://www.fok120.com/

wrjc1hod 发表于 2024-9-29 20:30:20

楼主果然英明!不得不赞美你一下!
页: [1]
查看完整版本: HTML5+CSS3高级动画的应用实践