Discuss Scratch

--HyperZ--
Scratcher
100+ posts

New Math Block: Lerp

Greetings. I have a suggestion for a math node to add to Scratch: Linear Interpolate, or Lerp. Having used this feature in game engines like Unity and Godot, it might very well be a handy thing to have in Scratch. Similar to the glide blocks, the Lerp math could do a similar thing, but with values and properties instead of strictly positions. The math would be something like this:

float lerp (float a, float b, float t)
{
return a + t(b − a)
}

Of course, since Scratch is not a game engine, with a regular Update callback, it could also be the 2 values along with something like how many seconds it takes to interpolate between them.

I know more than 5 programming languages, including Scratch! I'm also a big Tetris player.

Check out my chatbot!

Xolay
Scratcher
1000+ posts

New Math Block: Lerp

--HyperZ-- wrote:

Greetings. I have a suggestion for a math node to add to Scratch: Linear Interpolate, or Lerp. Having used this feature in game engines like Unity and Godot, it might very well be a handy thing to have in Scratch. Similar to the glide blocks, the Lerp math could do a similar thing, but with values and properties instead of strictly positions. The math would be something like this:

float lerp (float a, float b, float t)
{
return a + t(b − a)
}

Of course, since Scratch is not a game engine, with a regular Update callback, it could also be the 2 values along with something like how many seconds it takes to interpolate between them.
What is a Lerp???

Last edited by kaj (Tomorrow 00:00:00)

I'm a 8 year old boy
[0.0](ᵔ ᵕ ᵔ::stack)('_'::stack variables)(o,o::stack control)(d_b::stack operators)(²-²::stack motion)(1_1::stack looks)(°-°::stack sound)::stack #000000//these are my kumquat protectors

if <(username) = [add signature] > then
set [big brain v]to [True]
end
WHAT??? HOW ARE YOU SEEING THIS?
<<true(::grey) ::#00FF00>::operators>
<<(::grey) false::#ff0000>::operators>
I love courtney from total dramarama
My goal:
5000 posts (::control) (::control) (::#000000) (::#000000) (::#000000) ::#00008B

Credits: Google

move (1) step::motion

hello, light mode user
hello, dark mode user

this hat is looking at u
() () ::custom hat

POV: you are a ST member about to report
See the POV of being a Scratch Team member.

atchscray isyay ayay igh-levelhay ock-basedblay isualvay ogrammingpray anguagelay andyay ebsiteway argetedtay imarilypray atyay ildrenchay 8–16 asyay anyay educationalyay ooltay orfay ogrammingpray.

PLZ buy me a Wedo 2.0

hellohellohellohello

I BELIEVE IN VS TOTAL DRAMARAMA SUPREMACY

you are not being valid offtopic there

hahaha superhero block go brrrr::#FFFFFF cap

made with uploads.scratch.mit.edu
Xolay
Scratcher
1000+ posts

New Math Block: Lerp

--HyperZ-- wrote:

Greetings. I have a suggestion for a math node to add to Scratch: Linear Interpolate, or Lerp. Having used this feature in game engines like Unity and Godot, it might very well be a handy thing to have in Scratch. Similar to the glide blocks, the Lerp math could do a similar thing, but with values and properties instead of strictly positions. The math would be something like this:
float lerp (float a, float b, float t)
{
return a + t(b − a)
}
Of course, since Scratch is not a game engine, with a regular Update callback, it could also be the 2 values along with something like how many seconds it takes to interpolate between them.
Fixed.


I'm a 8 year old boy
[0.0](ᵔ ᵕ ᵔ::stack)('_'::stack variables)(o,o::stack control)(d_b::stack operators)(²-²::stack motion)(1_1::stack looks)(°-°::stack sound)::stack #000000//these are my kumquat protectors

if <(username) = [add signature] > then
set [big brain v]to [True]
end
WHAT??? HOW ARE YOU SEEING THIS?
<<true(::grey) ::#00FF00>::operators>
<<(::grey) false::#ff0000>::operators>
I love courtney from total dramarama
My goal:
5000 posts (::control) (::control) (::#000000) (::#000000) (::#000000) ::#00008B

Credits: Google

move (1) step::motion

hello, light mode user
hello, dark mode user

this hat is looking at u
() () ::custom hat

POV: you are a ST member about to report
See the POV of being a Scratch Team member.

atchscray isyay ayay igh-levelhay ock-basedblay isualvay ogrammingpray anguagelay andyay ebsiteway argetedtay imarilypray atyay ildrenchay 8–16 asyay anyay educationalyay ooltay orfay ogrammingpray.

PLZ buy me a Wedo 2.0

hellohellohellohello

I BELIEVE IN VS TOTAL DRAMARAMA SUPREMACY

you are not being valid offtopic there

hahaha superhero block go brrrr::#FFFFFF cap

made with uploads.scratch.mit.edu
--HyperZ--
Scratcher
100+ posts

New Math Block: Lerp

Xolay wrote:

--HyperZ-- wrote:

Greetings. I have a suggestion for a math node to add to Scratch: Linear Interpolate, or Lerp. Having used this feature in game engines like Unity and Godot, it might very well be a handy thing to have in Scratch. Similar to the glide blocks, the Lerp math could do a similar thing, but with values and properties instead of strictly positions. The math would be something like this:
float lerp (float a, float b, float t)
{
return a + t(b − a)
}
Of course, since Scratch is not a game engine, with a regular Update callback, it could also be the 2 values along with something like how many seconds it takes to interpolate between them.
Fixed.

It is short for linear interpolate. It basically means to move from point a to point b by this amount. So, for instance, lerp from 1 to 10 by 2.

I know more than 5 programming languages, including Scratch! I'm also a big Tetris player.

Check out my chatbot!

-EmeraldThunder-
Scratcher
1000+ posts

New Math Block: Lerp

Support, I used this functionality in my triangle filler tutorial and writing out the equation was a little annoying (I try not to narrate while writing the code). This would just make everything a little easier to do and could simplify the code a little bit.

Nothing here.
6d66yh
Scratcher
100+ posts

New Math Block: Lerp

No support, as this does not seem to be a native instruction, it is better implemented with a broader suggestion such as custom reporters.

Integer arithmetic suggestion: https://scratch.mit.edu/discuss/post/5163608/

Powered by DjangoBB