Discuss Scratch

Greenie_WasTaken
Scratcher
61 posts

(FIXED) Tween Help

This has been fixed.

I am trying to implement every tween in HaxeFlixel into Scratch. I am currently struggling on the Bounce tween.
Here is Easings.net's function:

function easeOutBounce(x: number): number {
const n1 = 7.5625;
const d1 = 2.75;

if (x < 1 / d1) {
return n1 * x * x;
} else if (x < 2 / d1) {
return n1 * (x -= 1.5 / d1) * x + 0.75;
} else if (x < 2.5 / d1) {
return n1 * (x -= 2.25 / d1) * x + 0.9375;
} else {
return n1 * (x -= 2.625 / d1) * x + 0.984375;
}
}

and here is a link to an SB3 containing my failed recreation.

Last edited by Greenie_WasTaken (Today 16:33:11)

DragonBeast829
Scratcher
100+ posts

(FIXED) Tween Help

What's that -= doing in the middle of the expressions?

Last edited by DragonBeast829 (Oct. 12, 2026 15:46:08)

Greenie_WasTaken
Scratcher
61 posts

(FIXED) Tween Help

DragonBeast829 wrote:

What's that -= doing in the middle of the expressions?
-= is TypeScript's form of the (() - ()) block. It's a short way to say “x = x - y” (or “set x to x - y” in scratch terms)
Greenie_WasTaken
Scratcher
61 posts

(FIXED) Tween Help

Bump
Greenie_WasTaken
Scratcher
61 posts

(FIXED) Tween Help

bump
Greenie_WasTaken
Scratcher
61 posts

(FIXED) Tween Help

bump
PrettyCoolStuffs
Scratcher
42 posts

(FIXED) Tween Help

Greenie_WasTaken wrote:

I am trying to implement every tween in HaxeFlixel into Scratch. I am currently struggling on the Bounce tween.
Here is Easings.net's function:

function easeOutBounce(x: number): number {
const n1 = 7.5625;
const d1 = 2.75;

if (x < 1 / d1) {
return n1 * x * x;
} else if (x < 2 / d1) {
return n1 * (x -= 1.5 / d1) * x + 0.75;
} else if (x < 2.5 / d1) {
return n1 * (x -= 2.25 / d1) * x + 0.9375;
} else {
return n1 * (x -= 2.625 / d1) * x + 0.984375;
}
}

and here is a link to an SB3 containing my failed recreation.
I personally don't have time right now to checkk this, will try and check in a solid few hours
DragonBeast829
Scratcher
100+ posts

(FIXED) Tween Help

Sorry I didn't respond quicker, it didn't notify me.

I'd also recommend not bumping several times in one day

I'm aware of what -= means in textual programming languages. My confusion stemmed from the fact it's in the middle of an expression, which isn't valid in any language I know; you probably meant to write -, not -=. Also I thought HaxeFlixel uses Haxe, not TypeScript.

edit: I looked it up and this is some obscure TypeScript syntax I've never seen before. I'll see if I can remake this easing function in Scratch later, when I have time.

Last edited by DragonBeast829 (Yesterday 17:00:33)

Greenie_WasTaken
Scratcher
61 posts

(FIXED) Tween Help

DragonBeast829 wrote:

I'm aware of what -= means in textual programming languages. My confusion stemmed from the fact it's in the middle of an expression, which isn't valid in any language I know…
That's how it was written on Easings.net.

DragonBeast829 wrote:

Also I thought HaxeFlixel uses Haxe, not TypeScript.
Yes, but Easings.net writes its easing code in TypeScript, and my school's wifi blocked GitHub for some ungodly reason so I can't access Flixel's source code.

EDIT: also you gotta click “Follow Discussion” to get notified of new posts in a topic

Last edited by Greenie_WasTaken (Yesterday 17:02:53)

DragonBeast829
Scratcher
100+ posts

(FIXED) Tween Help

Greenie_WasTaken wrote:

Yes, but Easings.net writes its easing code in TypeScript, and my school's wifi blocked GitHub for some ungodly reason so I can't access Flixel's source code.
Oh, I didn't know about that website.

Greenie_WasTaken wrote:

DragonBeast829 wrote:

EDIT: also you gotta click “Follow Discussion” to get notified of new posts in a topic
Yup, I know. Scratch doesn't notify me anyway sometimes. It's annoying.
Greenie_WasTaken
Scratcher
61 posts

(FIXED) Tween Help

bump
Greenie_WasTaken
Scratcher
61 posts

(FIXED) Tween Help

This has now been fixed (it was because Easings.net's implementation is WRONG!!!!! I used a SourceForge mirror of HaxeFlixel's source code to access flxEase.hx and implemented it from there). I will now close the topic after editing the first message.

Powered by DjangoBB