New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[PoemBot][HOC] Twinkling Stars Foreground Effect #42201
Conversation
case 'twinkling': | ||
case 'twinkling': { | ||
let stars = []; | ||
const resetStars = () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think you need this function (it never gets called)
|
||
this.foregroundEffect = () => { | ||
this.p5.push(); | ||
if (stars.length === 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here- this never happens since you're not filtering stars out at any point
nit: can you change the PR title to be prefixed with |
const color = this.getP5Color(star.color, star.alpha); | ||
this.p5.fill(color); | ||
|
||
star.alpha += star.delta; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems fine as is, but as an exercise, it could be interesting to turn this into a pure functional approach where the alpha is calculated simply based on which frame number we are up to, rather than doing the sign-flipping and alpha adjustment periodically.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New changes look good to me! (I can't approve in the UI since I authored the pull request, but consider this comment approval from my point-of-view).
x: utils.randomInt(0, 400), | ||
y: utils.randomInt(0, 400), | ||
alpha: utils.randomInt(1, 100), | ||
delta: this.p5.random([-6, -5, -4, -3, 3, 4, 5, 6]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i don't think i understand what delta
and the values in this array mean here -- can you add a comment?
Part of the HoC Block Requests for foregrounds. Randomly seeds a star and fades it in and out (kind of slowly, but I promise, it's happening). Gif shown below:
If we don't like how this looks yet, we can change: number of stars, color of stars, pace at which they fade in/out.
PR Checklist: