Skip to content

Commit

Permalink
refactor: fadeIn example uses fadeIn function
Browse files Browse the repository at this point in the history
  • Loading branch information
amyspark-ng committed May 27, 2024
1 parent d272cca commit ca31b2e
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions examples/fadeIn.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,17 @@ loadBean();
const bean = add([
sprite("bean"),
pos(120, 80),
opacity(), // opacity() component gives it opacity which is required for fadeIn
fadeIn(), // fadeIn() component makes it fade in
opacity(1), // opacity() component gives it opacity which is required for fadeIn
]);

bean.fadeIn(1) // makes it fade in

// spawn another bean that takes 5 seconds to fade in halfway
// SPOOKY!
let spookyBean = add([
sprite("bean"),
pos(240, 80),
opacity(0.5), // opacity() component gives it opacity which is required for fadeIn (set to 0.5 so it will be half transparent)
fadeIn(5), // fadeIn() component makes it fade in (set to 5 so that it takes 5 seconds to fade in)
]);

spookyBean.fadeIn(5) // makes it fade in (set to 5 so that it takes 5 seconds to fade in)

0 comments on commit ca31b2e

Please sign in to comment.