{"id":25481,"date":"2024-11-24T11:04:16","date_gmt":"2024-11-24T03:04:16","guid":{"rendered":"https:\/\/fwq.ai\/blog\/25481\/"},"modified":"2024-11-24T11:04:16","modified_gmt":"2024-11-24T03:04:16","slug":"%e5%a6%82%e4%bd%95%e8%ae%a9%e6%96%87%e5%ad%97%e5%bd%a2%e6%88%90%e6%b5%aa%e6%b6%8c%e5%8f%98%e8%89%b2%e6%95%88%e6%9e%9c%ef%bc%9f-2","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/25481\/","title":{"rendered":"\u5982\u4f55\u8ba9\u6587\u5b57\u5f62\u6210\u6d6a\u6d8c\u53d8\u8272\u6548\u679c\uff1f"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/246\/273\/173062030057150.jpg\" class=\"aligncenter\" title=\"\u5982\u4f55\u8ba9\u6587\u5b57\u5f62\u6210\u6d6a\u6d8c\u53d8\u8272\u6548\u679c\uff1f\u63d2\u56fe\" alt=\"\u5982\u4f55\u8ba9\u6587\u5b57\u5f62\u6210\u6d6a\u6d8c\u53d8\u8272\u6548\u679c\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5982\u4f55\u8ba9\u6587\u5b57\u5f62\u6210\u6d6a\u6d8c\u53d8\u8272\u6548\u679c\uff1f<\/strong><\/p>\n<p>\u8981\u8ba9\u4e00\u884c\u6587\u5b57\u4ece\u524d\u5230\u540e\u5f62\u6210\u989c\u8272\u6d6a\u6d8c\u6e10\u53d8\u6548\u679c\uff0c\u4f60\u53ef\u4ee5\u91c7\u7528\u4ee5\u4e0b\u65b9\u6cd5\uff1a<\/p>\n<p><strong><\/strong><\/p>\n<p>\u5229\u7528 background-clip \u548c text-fill-color \u5c5e\u6027\uff0c\u521b\u5efa\u80cc\u666f\u8272\u68af\u5ea6\u5e76\u5c06\u5176\u526a\u88c1\u4e3a\u6587\u5b57\u5f62\u72b6\u3002\u4f8b\u5982\uff1a<\/p>\n<pre>p {\n  background: linear-gradient(to left, red, orange, yellow, green, blue, indigo, violet);\n  -webkit-background-clip: text;\n  -webkit-text-fill-color: transparent;\n}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>jquery<\/strong><\/p>\n<p>\u4f7f\u7528 jquery \u7684 animate() \u65b9\u6cd5\uff0c\u9010\u6e10\u6539\u53d8\u6587\u672c\u989c\u8272\uff0c\u5f62\u6210\u6d6a\u6d8c\u6548\u679c\u3002\u4f8b\u5982\uff1a<\/p>\n<pre>$(\"#text\").each(function() {\n  $(this).animate({\n    color: \"#ff0000\"\n  }, 500, \"linear\");\n});<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>javascript<\/strong><\/p>\n<p>\u5229\u7528 canvas api \u7ed8\u5236\u6587\u672c\uff0c\u5e76\u4f7f\u7528 createlineargradient() \u548c filltext() \u65b9\u6cd5\u521b\u5efa\u6d6a\u6d8c\u6548\u679c\u3002\u4f8b\u5982\uff1a<\/p>\n<pre>const canvas = document.getElementById(\"canvas\");\nconst ctx = canvas.getContext(\"2d\");\n\nctx.createLinearGradient(0, 0, canvas.width, 0);\nctx.addColorStop(0, \"red\");\nctx.addColorStop(1, \"blue\");\n\nctx.fillText(\"\u6587\u5b57\", 10, 10);<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u53c2\u8003\u793a\u4f8b<\/strong><\/p>\n<p>\u4e0a\u9762\u7684\u793a\u4f8b\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u94fe\u63a5\u67e5\u770b\u5b9e\u9645\u6548\u679c\uff1a<\/p>\n<p>https:\/\/segmentfault.com\/a\/1190000043861422<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5982\u4f55\u8ba9\u6587\u5b57\u5f62\u6210\u6d6a\u6d8c\u53d8\u8272\u6548\u679c\uff1f\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5982\u4f55\u8ba9\u6587\u5b57\u5f62\u6210\u6d6a\u6d8c\u53d8\u8272\u6548\u679c\uff1f \u8981\u8ba9\u4e00\u884c\u6587\u5b57\u4ece\u524d\u5230\u540e\u5f62\u6210\u989c\u8272\u6d6a\u6d8c\u6e10\u53d8\u6548\u679c\uff0c\u4f60\u53ef\u4ee5\u91c7\u7528\u4ee5\u4e0b\u65b9\u6cd5\uff1a \u5229\u7528 background-clip \u548c text-fill-color \u5c5e\u6027\uff0c\u521b\u5efa\u80cc\u666f\u8272\u68af\u5ea6\u5e76\u5c06\u5176\u526a\u88c1\u4e3a\u6587\u5b57\u5f62\u72b6\u3002\u4f8b\u5982\uff1a p { background: linear-gradient(to left, red, orange, yellow, green, blue, indigo, violet); -webkit-background-clip: text; -webkit-text-fill-color: transparent; } \u767b\u5f55\u540e\u590d\u5236 jquery \u4f7f\u7528 jquery \u7684 animate() \u65b9\u6cd5\uff0c\u9010\u6e10\u6539\u53d8\u6587\u672c\u989c\u8272\uff0c\u5f62\u6210\u6d6a\u6d8c\u6548\u679c\u3002\u4f8b\u5982\uff1a $(&#8220;#text&#8221;).each(function() { $(this).animate({ color: &#8220;#ff0000&#8221; }, 500, &#8220;linear&#8221;); }); \u767b\u5f55\u540e\u590d\u5236 javascript \u5229\u7528 canvas api \u7ed8\u5236\u6587\u672c\uff0c\u5e76\u4f7f\u7528 createlineargradient() \u548c filltext() \u65b9\u6cd5\u521b\u5efa\u6d6a\u6d8c\u6548\u679c\u3002\u4f8b\u5982\uff1a const canvas = document.getElementById(&#8220;canvas&#8221;); const [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-25481","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/25481","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=25481"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/25481\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=25481"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=25481"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=25481"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}