-
Notifications
You must be signed in to change notification settings - Fork 238
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
Add new blocks to tweening extension #727
Conversation
Woohoo! |
const progress = Cast.toNumber(Math.round(this.clamp(util.stackFrame.loopCounter, 0, 100))) / 100; | ||
const tweened = this[easeMethod](progress, easeDirection); | ||
const x = Cast.toNumber(this.multiplierToNormalNumber(tweened, endx, startx)); | ||
const y = Cast.toNumber(this.multiplierToNormalNumber(tweened, endx, startx)); |
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.
References to endx
and startx
on the right-hand side of const y = ...
should be changed to endy
and starty
. Otherwise, the y position will be the same as the x position. There are 2 occurrences of this issue.
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.
References to
endx
andstartx
on the right-hand side ofconst y = ...
should be changed toendy
andstarty
. Otherwise, the y position will be the same as the x position. There are 2 occurrences of this issue.
Ah. Not sure how I didn’t catch that, I tested all of my blocks and they work fine.
As for the workflows, I’ll try to reverse that. I originally tried to add a action myself, and later realized that I didn’t want or need to use GitHub.io, just a local server, not knowing there was already workflows inside.
@@ -81,224 +128,295 @@ | |||
const tweened = this[easeMethod](progress, easeDirection); | |||
return this.multiplierToNormalNumber(tweened, start, end); | |||
} | |||
tweenPlayAnimationPosition(args, util) { |
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.
For some reason, the sprite doesn't glide from point A to point B properly when using this block. Try it for yourself - setting mode to "linear", it should glide to the ending point at a fixed rate, but it instead eases in and eases out, and seems to stop before the block finishes.
This is probably because some starting position constant is constantly getting updated with the sprite's current x position whenever it moves forward a step, but it should stay the same throughout the whole animation. Haven't studied where that happens, though.
This does not happen with any of the other blocks.
If you don't want to diagnose this, you can probably get away with removing this block as it's as easy as inserting the reporters x position
and y position
into the block after this one to achieve basically the same behavior.
.github/workflows/deploy.yml
Outdated
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.
Please don't remove workflow files from this pull request, or they will get removed from the upstream repository when the PR is merged. Instead, you can disable Actions on your fork from Settings → Actions → General.
Tip: It's possible to revert commits in Git as well as GitHub Desktop.
This reverts commit 825e6fd.
Ignore the current "All checks have failed" -- that's unrelated Would it make sense to replace the idea of "speed" with just the total time of the tween instead? |
Probably. Ill try that. |
It looks like someone else has opened something similar #766 |
could these use seconds instead of the vague "speed" number? |
ok i've been neglecting this entire pr for a while now so im gonna draft it for now until i feel like working on it |
Superceded by #851 |
This adds 3 new blocks that all allow you to run an eased animation in one block rather that having to make a script yourself. There are 3 new blocks:
(linear v) ease (in v) from x: (-100) y: (-100) to x: (100) y:(100) at speed (1) :: extension
(linear v) ease (in v) to x: (100) y:(100) at speed (1) :: extension
(linear v) ease (in v) from size: (0)% to size: (100)% at speed (1) :: extension
Yes, that is in scratchblocks.
https://scratchblocks.github.io/#?style=scratch3&script=(linear%20v)%20ease%20(in%20v)%20from%20x%3A%20(-100)%20y%3A%20(-100)%20to%20x%3A%20(100)%20y%3A(100)%20at%20speed%20(1)%20%3A%3A%20extension%0A%0A(linear%20v)%20ease%20(in%20v)%20to%20x%3A%20(100)%20y%3A(100)%20at%20speed%20(1)%20%3A%3A%20extension%0A%0A(linear%20v)%20ease%20(in%20v)%20from%20size%3A%20(0)%25%20to%20size%3A%20(100)%25%20at%20speed%20(1)%20%3A%3A%20extension