Skip to content

Comments

Support animation#252

Merged
pearmini merged 1 commit intonextfrom
loop
Oct 20, 2024
Merged

Support animation#252
pearmini merged 1 commit intonextfrom
loop

Conversation

@pearmini
Copy link
Member

image
import * as cm from "@charming-art/charming";

export function spin() {
  return cm.render({
    width: 640,
    height: 640,
    loop: () => {
      const t = Date.now() / 1000;
      return cm.group(
        cm.background({fill: "white"}),
        cm.circle({x: 320, y: 320, r: 120, fill: "black"}),
        cm.circle({x: 320 + Math.cos(t) * 200, y: 320 + Math.sin(t) * 200, r: 40, fill: "black"}),
      );
    },
  });
}

@pearmini pearmini merged commit 35513a8 into next Oct 20, 2024
@pearmini pearmini deleted the loop branch October 20, 2024 15:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant