- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我最近在做 Anime.JS。
我成功地使用 keyFrame 功能制作了眨眼效果。
现在我想为 SVG 文件制作动画,以使其更具可读性,我使用这样的对象 html:
<object id="DranakTitle" data="asset/dranak2.svg" type="image/svg+xml" ></object>
var svgObject = document.getElementById('DranakTitle');
var svgDoc;
svgObject.addEventListener('load', function(){
svgDoc = svgObject.contentDocument;
var lineDrawing = anime({
targets: svgDoc,
strokeDashoffset: [anime.setDashoffset, 0],
easing: 'easeInOutSine',
duration: 3000,
// delay: function(el, i) { return i * 250 },
direction: 'alternate',
loop: true
});
});
> <svg id="b08a73a6-c8cf-4eae-8175-56e92cb07c01" data-name="Calque 2"
> xmlns="http://www.w3.org/2000/svg"
> xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 938 242">
> <title>dranak2</title> <image width="938" height="242"
> xlink:href="dranak21.png"/> <g>
> <path d="M498.66,433.62H438.14q-3.64,0-3.64,3.12V552.07q0,3.64,3.64,3.64h60.52a45.15,45.15,0,0,0,18.57-3.64,41.24,41.24,0,0,0,13.9-9.87,42.31,42.31,0,0,0,8.7-14.67,54.57,54.57,0,0,0,3-18.32,56.24,56.24,0,0,0-3-18.7,42.17,42.17,0,0,0-8.73-14.81A40.14,40.14,0,0,0,517.15,466a47,47,0,0,0-18.63-3.5H468.28q-3.39,0-3.39,3.37V539.6q0,2.08-1.8,1.95a1.74,1.74,0,0,1-1.81-1.95V465.83q0-6.75,7-6.75H498.4a49.76,49.76,0,0,1,19.87,3.76A41.21,41.21,0,0,1,533,473.37a48.09,48.09,0,0,1,9.22,15.84,59.21,59.21,0,0,1,3.25,20,57.59,57.59,0,0,1-3.25,19.48,49.59,49.59,0,0,1-9.22,16,41.83,41.83,0,0,1-14.68,10.78,48.09,48.09,0,0,1-19.87,3.9H438.08a6.93,6.93,0,0,1-5.15-2.08,7.08,7.08,0,0,1-2.07-5.2V436.74a6.62,6.62,0,0,1,2.08-5.07,7.31,7.31,0,0,1,5.2-1.94h60.52A75.47,75.47,0,0,1,529.44,436a72.75,72.75,0,0,1,24.29,17.14,80.52,80.52,0,0,1,15.85,25.33,85.82,85.82,0,0,1,0,61.56,78.8,78.8,0,0,1-15.85,25.2,73.42,73.42,0,0,1-24.29,17,75.47,75.47,0,0,1-30.78,6.24H438.14a7.31,7.31,0,0,1-5.2-2,6.92,6.92,0,0,1-2.08-5.32V570.26c0-1.56.61-2.34,1.82-2.34s1.82.78,1.82,2.34v10.91q0,3.63,3.64,3.63h60.52a71.77,71.77,0,0,0,29.35-6,70.49,70.49,0,0,0,23.25-16.37,76,76,0,0,0,15.2-24,78,78,0,0,0,5.45-29.23,79.59,79.59,0,0,0-5.45-29.61,74.15,74.15,0,0,0-15.2-24A69.78,69.78,0,0,0,528,439.47,73,73,0,0,0,498.66,433.62Z"
> transform="translate(-389 -385)" fill="aqua"/>
> <path d="M711.92,580.13l-42.08-51.44-1.3-1.81,2.34-.78a47.53,47.53,0,0,0,19.87-17.54,46.39,46.39,0,0,0,7.4-25.58,49.12,49.12,0,0,0-3.89-19.49,51.27,51.27,0,0,0-10.52-15.84,49.15,49.15,0,0,0-35.2-14.55H595.29c-2.08,0-3.12,1.22-3.12,3.64v14a2,2,0,0,1-2.08,1.29,2,2,0,0,1-2.07-1.29v-14a6.65,6.65,0,0,1,2.07-5.07,7.31,7.31,0,0,1,5.2-1.94h53.25a52.74,52.74,0,0,1,20.91,4.15,53.5,53.5,0,0,1,17,11.43A55.63,55.63,0,0,1,698,462.2,50.36,50.36,0,0,1,702.31,483a47.07,47.07,0,0,1-7.79,26.23A54.71,54.71,0,0,1,674,527.91l41.3,50.92q2.6,3.38,1.3,6.49t-5.72,3.12H687.24a10.1,10.1,0,0,1-8-3.64l-40.52-50.13h-13q-3.64,0-3.64,3.64v42.86q0,7.27-6.75,7.27h-20a7.31,7.31,0,0,1-5.2-2,7,7,0,0,1-2.07-5.32V465.57a7.74,7.74,0,0,1,2.07-5.71,7,7,0,0,1,5.2-2.08h53.25a21.39,21.39,0,0,1,9.48,2.08,22.05,22.05,0,0,1,7.27,5.58A26.76,26.76,0,0,1,670,473.5a27.13,27.13,0,0,1,1.69,9.48,25.16,25.16,0,0,1-6.37,17.14q-6.36,7.28-16.75,7.27H625.68a7.45,7.45,0,0,1-5.06-1.68,6.36,6.36,0,0,1-2-5.07V470.51c0-1.39.56-1.95,1.69-1.69s1.68.82,1.68,1.69v30.13q0,3.38,3.64,3.38h22.86a17.73,17.73,0,0,0,14.29-6.54,22.55,22.55,0,0,0,0-29.4,17.88,17.88,0,0,0-14.29-6.4H595.29q-3.12,0-3.12,3.64V581.17q0,3.63,3.12,3.63h20q3.38,0,3.38-3.63V538.31a6.54,6.54,0,0,1,7-7.28h14.55l42.08,51.17a5.31,5.31,0,0,0,4.93,2.6h23.64c2.08,0,3-.47,2.73-1.43A10.55,10.55,0,0,0,711.92,580.13Z"
> transform="translate(-389 -385)" fill="aqua"/>
> <path d="M811.41,436.74a4.4,4.4,0,0,0-1.82-2.86,5.46,5.46,0,0,0-2.86-.78H778.42a5.69,5.69,0,0,0-2.73.78,3.49,3.49,0,0,0-1.69,2.86l-4.15,11.43c-.35,1.39-1.09,1.91-2.21,1.56s-1.52-1.21-1.17-2.6l3.9-11.95a8.16,8.16,0,0,1,8-5.45h28.31q5.71,0,8.06,5.45l49.09,145q1.56,3.63-.39,6a6.86,6.86,0,0,1-5.59,2.34H835.83q-5.73,0-7.54-6l-6.49-18.7a5.62,5.62,0,0,0-1.56-2.6c-.35-.34-1.3-.52-2.86-.52H768a5,5,0,0,0-4.68,3.12l-6,18.7q-1.3,6-8,6H727.51c-2.6,0-4.47-.78-5.59-2.34s-1.25-3.55-.39-6l38.7-115.08q1.82-5.44,8.32-5.45h17.66a8.17,8.17,0,0,1,8,5.45l21.56,67H769.33l14.28-44.16c.35-1.21,1.08-1.64,2.21-1.3s1.43,1.22.91,2.6l-12.47,38.7h36.63l-20-62.08a4.69,4.69,0,0,0-4.68-3.12H768.55q-3.9,0-4.68,3.12L724.65,581.17c-.7,2.42.26,3.63,2.86,3.63h21.82q3.88,0,4.67-3.11l5.72-19.23c1.72-3.63,4.5-5.45,8.31-5.45h49.35q6.24,0,7.8,5.45l6.23,19.23q.78,3.1,4.42,3.11H857.9q4.15,0,2.6-3.63Z"
> transform="translate(-389 -385)" fill="aqua"/>
> <path d="M965.44,436.74v96.11L903.62,435.7A2.74,2.74,0,0,0,901.8,434a9,9,0,0,0-2.59-.39H882.32c-1.39-.34-2.08-1-2.08-1.95s.69-1.6,2.08-1.94h16.89a10.59,10.59,0,0,1,4.54,1,8.28,8.28,0,0,1,3.51,3.12l54.55,87.28V436.74a7.18,7.18,0,0,1,1.8-5.07,6.67,6.67,0,0,1,5.16-1.94h20.11a6.75,6.75,0,0,1,5,1.94,6.89,6.89,0,0,1,1.94,5.07V581.17a7.18,7.18,0,0,1-2,5.32,6.83,6.83,0,0,1-5,2h-14q-4.14,0-6.09-2.34a64,64,0,0,1-4-5.45Q944,547.4,923.14,514.54T881.8,448.43V581.17q0,3.63,3.64,3.63h20q3.12,0,3.12-3.63V509.73a1.74,1.74,0,0,1,1.82-2c1.2-.08,1.81.57,1.81,2v71.44a7.22,7.22,0,0,1-1.94,5.32,6.55,6.55,0,0,1-4.81,2h-20q-7.28,0-7.27-7.27V443a1.87,1.87,0,0,1,1.42-1.82c.95-.34,1.86.26,2.73,1.82q22.08,34.56,43.38,68.45t42.6,68.19c1,1.39,1.91,2.59,2.6,3.63s2.08,1.56,4.16,1.56h14q3.38,0,3.38-3.63V436.74q0-3.12-3.38-3.12H968.82Q965.45,433.62,965.44,436.74Z" transform="translate(-389 -385)" fill="aqua"/>
> <path d="M1097.66,436.74a4.36,4.36,0,0,0-1.82-2.86,5.45,5.45,0,0,0-2.85-.78h-28.32a5.69,5.69,0,0,0-2.73.78,3.48,3.48,0,0,0-1.68,2.86l-4.16,11.43c-.35,1.39-1.08,1.91-2.21,1.56s-1.52-1.21-1.17-2.6l3.9-11.95q2.34-5.46,8.05-5.45H1093q5.7,0,8,5.45l49.09,145q1.56,3.63-.39,6a6.85,6.85,0,0,1-5.58,2.34h-22.08c-3.81,0-6.33-2-7.53-6l-6.5-18.7a5.62,5.62,0,0,0-1.56-2.6c-.35-.34-1.3-.52-2.85-.52h-49.36a5,5,0,0,0-4.67,3.12l-6,18.7q-1.31,6-8.05,6h-21.82q-3.9,0-5.59-2.34t-.39-6l38.71-115.08q1.82-5.44,8.31-5.45h17.66q5.71,0,8.06,5.45l21.56,67h-46.5l14.29-44.16a1.59,1.59,0,0,1,2.21-1.3c1.12.35,1.42,1.22.9,2.6l-12.46,38.7h36.62l-20-62.08a4.69,4.69,0,0,0-4.68-3.12H1054.8q-3.9,0-4.67,3.12L1010.9,581.17q-1,3.63,2.86,3.63h21.82c2.6,0,4.15-1,4.67-3.11l5.72-19.23q2.6-5.44,8.31-5.45h49.36q6.22,0,7.79,5.45l6.23,19.23q.78,3.1,4.42,3.11h22.08c2.77,0,3.63-1.21,2.6-3.63Z"
> transform="translate(-389 -385)" fill="aqua"/>
> <path d="M1280.79,581.17l-55.59-74.3L1278.45,437c1.56-2.25,1-3.38-1.81-3.38H1253a4.65,4.65,0,0,0-3.38,1,23.73,23.73,0,0,0-2.34,2.86l-49.09,63.12v80.53q0,7.27-7,7.27h-20.26q-6.75,0-6.75-7.27V436.74a7.45,7.45,0,0,1,1.69-5.07,6.32,6.32,0,0,1,5.06-1.94h20.26a6.76,6.76,0,0,1,5.2,1.94,7.15,7.15,0,0,1,1.82,5.07v42.34c0,.87-.61,1.3-1.82,1.3s-1.82-.43-1.82-1.3V436.74q0-3.12-3.38-3.12h-20.26c-2.08,0-3.11,1-3.11,3.12V581.17c0,2.42,1,3.63,3.11,3.63h20.26q3.38,0,3.38-3.63v-81l49.62-64.42a26.07,26.07,0,0,1,3.89-4.42,7.33,7.33,0,0,1,4.94-1.55h23.64c2.76,0,4.63,1,5.58,3s.65,4.2-.91,6.63l-51.69,67.53,53,71.44a7.87,7.87,0,0,1,2.34,6.62q-.53,3.51-6,3.51h-23.64a8,8,0,0,1-7.53-4.16l-42.6-56.37c-1-.86-1.08-1.68-.13-2.46a1.82,1.82,0,0,1,2.73.13l42.6,56.62a5.31,5.31,0,0,0,4.93,2.6H1279C1281.4,584.8,1282,583.59,1280.79,581.17Z"
> transform="translate(-389 -385)" fill="aqua"/> </g> </svg>
最佳答案
stroke-width
,所以它可以被动画化。 window.onload
初始化动画的函数 后 SVG 已加载:window.onload = function () {
anime({
targets: document.getElementById('DranakTitle').contentDocument.getElementsByTagName('path'),
strokeDashoffset: [anime.setDashoffset, 0],
easing: 'easeInOutSine',
duration: 3000,
direction: 'alternate',
loop: true
});
};
关于javascript - 在 Anime.js 中使用 SVG 对象 HTML,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52934587/
我需要将文本放在 中在一个 Div 中,在另一个 Div 中,在另一个 Div 中。所以这是它的样子: #document Change PIN
奇怪的事情发生了。 我有一个基本的 html 代码。 html,头部, body 。(因为我收到了一些反对票,这里是完整的代码) 这是我的CSS: html { backgroun
我正在尝试将 Assets 中的一组图像加载到 UICollectionview 中存在的 ImageView 中,但每当我运行应用程序时它都会显示错误。而且也没有显示图像。 我在ViewDidLoa
我需要根据带参数的 perl 脚本的输出更改一些环境变量。在 tcsh 中,我可以使用别名命令来评估 perl 脚本的输出。 tcsh: alias setsdk 'eval `/localhome/
我使用 Windows 身份验证创建了一个新的 Blazor(服务器端)应用程序,并使用 IIS Express 运行它。它将显示一条消息“Hello Domain\User!”来自右上方的以下 Ra
这是我的方法 void login(Event event);我想知道 Kotlin 中应该如何 最佳答案 在 Kotlin 中通配符运算符是 * 。它指示编译器它是未知的,但一旦知道,就不会有其他类
看下面的代码 for story in book if story.title.length < 140 - var story
我正在尝试用 C 语言学习字符串处理。我写了一个程序,它存储了一些音乐轨道,并帮助用户检查他/她想到的歌曲是否存在于存储的轨道中。这是通过要求用户输入一串字符来完成的。然后程序使用 strstr()
我正在学习 sscanf 并遇到如下格式字符串: sscanf("%[^:]:%[^*=]%*[*=]%n",a,b,&c); 我理解 %[^:] 部分意味着扫描直到遇到 ':' 并将其分配给 a。:
def char_check(x,y): if (str(x) in y or x.find(y) > -1) or (str(y) in x or y.find(x) > -1):
我有一种情况,我想将文本文件中的现有行包含到一个新 block 中。 line 1 line 2 line in block line 3 line 4 应该变成 line 1 line 2 line
我有一个新项目,我正在尝试设置 Django 调试工具栏。首先,我尝试了快速设置,它只涉及将 'debug_toolbar' 添加到我的已安装应用程序列表中。有了这个,当我转到我的根 URL 时,调试
在 Matlab 中,如果我有一个函数 f,例如签名是 f(a,b,c),我可以创建一个只有一个变量 b 的函数,它将使用固定的 a=a1 和 c=c1 调用 f: g = @(b) f(a1, b,
我不明白为什么 ForEach 中的元素之间有多余的垂直间距在 VStack 里面在 ScrollView 里面使用 GeometryReader 时渲染自定义水平分隔线。 Scrol
我想知道,是否有关于何时使用 session 和 cookie 的指南或最佳实践? 什么应该和什么不应该存储在其中?谢谢! 最佳答案 这些文档很好地了解了 session cookie 的安全问题以及
我在 scipy/numpy 中有一个 Nx3 矩阵,我想用它制作一个 3 维条形图,其中 X 轴和 Y 轴由矩阵的第一列和第二列的值、高度确定每个条形的 是矩阵中的第三列,条形的数量由 N 确定。
假设我用两种不同的方式初始化信号量 sem_init(&randomsem,0,1) sem_init(&randomsem,0,0) 现在, sem_wait(&randomsem) 在这两种情况下
我怀疑该值如何存储在“WORD”中,因为 PStr 包含实际输出。? 既然Pstr中存储的是小写到大写的字母,那么在printf中如何将其给出为“WORD”。有人可以吗?解释一下? #include
我有一个 3x3 数组: var my_array = [[0,1,2], [3,4,5], [6,7,8]]; 并想获得它的第一个 2
我意识到您可以使用如下方式轻松检查焦点: var hasFocus = true; $(window).blur(function(){ hasFocus = false; }); $(win
我是一名优秀的程序员,十分优秀!