Skip to content

Commit

Permalink
Update An Animated Solar System code example (#36576)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrjasongorman authored Oct 30, 2024
1 parent 92b03e4 commit 217a5e0
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ This example animates a small model of our solar system.
const sun = new Image();
const moon = new Image();
const earth = new Image();
const ctx = document.getElementById("canvas").getContext("2d");

function init() {
sun.src = "canvas_sun.png";
moon.src = "canvas_moon.png";
Expand All @@ -69,8 +71,6 @@ function init() {
}

function draw() {
const ctx = document.getElementById("canvas").getContext("2d");

ctx.globalCompositeOperation = "destination-over";
ctx.clearRect(0, 0, 300, 300); // clear canvas

Expand Down

0 comments on commit 217a5e0

Please sign in to comment.