找回密码
 快速注册
搜索
查看: 228|回复: 2

[tikz]地球绕着太阳转、月亮绕着地球转

[复制链接]

3149

主题

8386

回帖

6万

积分

$\style{scale:11;fill:#eff}꩜$

积分
65391
QQ

显示全部楼层

hbghlyj 发表于 2022-1-12 04:13 |阅读模式
本帖最后由 hbghlyj 于 2024-3-2 20:42 编辑 zhuanlan.zhihu.com/p/54877220
2019-01-05,PGF/TikZ 发布了 v3.1(ctan.org/ctan-ann/id/mailman.640.1546781639.5014.ctan-ann@ctan.org)增加了生成动画的库(animations)。

  1. \documentclass[tikz, margin=3pt, dvisvgm]{standalone}
  2. \usetikzlibrary{animations}
  3. \begin{document}
  4. \begin{tikzpicture}[
  5.     animate/orbit/.style 2 args = {
  6.     myself:shift = {
  7.     along = {
  8.     (0,0) circle [radius=#1]
  9.     } sloped in #2s/10,
  10.     repeats }} ]
  11.   \node :color = {0s = "orange",
  12.                   2s = "red",
  13.                   4s = "orange",
  14.                   repeats}
  15.                   {Sun};
  16.   \begin{scope}[animate={orbit={2.5cm}{365}}]
  17.   \node {Earth};
  18.   \node [animate={orbit={1cm}{28}}] {Moon};
  19.   \end{scope}
  20.   \useasboundingbox (-3.8,-3.8) (3.8,3.8);
  21. \end{tikzpicture}
  22. \end{document}
复制代码

730

主题

1万

回帖

9万

积分

积分
93593
QQ

显示全部楼层

kuing 发表于 2022-1-12 14:51
tikz 牛比

点评

但如果在 i.upmath.me 中,此动画会在转换时丢失。  发表于 2024-11-4 17:27

手机版|悠闲数学娱乐论坛(第3版)

GMT+8, 2025-3-4 12:16

Powered by Discuz!

× 快速回复 返回顶部 返回列表