Giter Club home page Giter Club logo

Comments (15)

Magnogen avatar Magnogen commented on August 15, 2024 2

cOnFuSiOn

Okay I'll have a think and get back to you about some ideas that try to keep it simple. If you come up with something that stands out above the other options, let me know.

from habitat.

TodePond avatar TodePond commented on August 15, 2024 1

Cool! Really interesting! So perhaps it sounds like it would be great to have the in-built functions changed to properties on the Tween object to start with.

And then after that, some experimentation about being able to modify their shape could come later. It looks like you've been discovering some cool things already!

from habitat.

TodePond avatar TodePond commented on August 15, 2024 1

Ignore my ramblings haha.

This would be a great target to aim for:

obj.tween(”property", {from, to, over, strength, ease: Tween.EASE_IN_OUT_SINE})

from habitat.

Magnogen avatar Magnogen commented on August 15, 2024

Ooo Tween.EASE_IN_CIRCULAR() is a good idea! I can add that pretty easily (bah dum tss).

Unfortunately though, all of the easings.net functions are hardcoded, and don't have any extra parameters that can be changed - unless you know what you're doing. (I most certainly wouldn't unless I played around with it more! 😅)

What do you mean by refining the easining to in and out? Ones like Tween.EASE_IN_CUBIC() and Tween.EASE_OUT_CIRCULAR(), but not Tween.EASE_IN_OUT_QUADRATIC()?

from habitat.

Magnogen avatar Magnogen commented on August 15, 2024

I've been playing around with some of the math, turns out it is possible to condense some of the equations (Quadratic, Cubic, Quartic & Quintic; with more functionality for between powers, and such)

You can see what I've done at https://www.desmos.com/calculator/1t3xehgaks

Change the slider p to change the overall power, and see how that changes the curves and animation.

I'm not really sure what that would be called, so it's just "p" atm, I'd welcome your thoughts :P

EDIT

I'm not sure that seperate launch and land values would work quite as well as what you have currently, as it'd result in something like this, and that can be a bit weird

ezgif-2-a5feb2c49c6d.mp4

from habitat.

TodePond avatar TodePond commented on August 15, 2024

That interactive demo looks great! Maybe p could be strength or something.

from habitat.

TodePond avatar TodePond commented on August 15, 2024

I see what you mean about the issues of combining ease in and ease out. If it smartly blended between them smoothly that would be amazing, but maybe that's something to investigate at a later time!

from habitat.

Magnogen avatar Magnogen commented on August 15, 2024

Alright, that seems like some reasonable expectations!

Syntax?

Also, Tween currently works like so:

var obj = { property: 0 };
obj.tween('property', { from, to, over, launch, land });

How do you think the new system could work? Perhaps like:

obj.tween.ease_in_out('property', { from, to, over, strength }); // .ease_in() and .ease_out() could also be options

and other functions like:

obj.tween.ease_in_out_sine('property', { from, to, over }); // again with .ease_in() and .ease_out()
obj.tween.ease_in_out_exponential('property', { from, to, over });
obj.tween.ease_in_out_circular('property', { from, to, over });
// etc.

Or some other way?

from habitat.

TodePond avatar TodePond commented on August 15, 2024

Hey! How about this?

obj.tween(”property", {from, to, strength, ease: Tween.EASE_IN_OUT_SINE})

from habitat.

TodePond avatar TodePond commented on August 15, 2024

Or maybe even something along the lines of:

obj.tween("property", {from, to, easeIn: true, easeOut: false, ease: Tween.EASE_SINE})

from habitat.

Magnogen avatar Magnogen commented on August 15, 2024

Sure I can get started on that! Would Tween.EASE_SINE be a function?

from habitat.

TodePond avatar TodePond commented on August 15, 2024

Yeah :) I think we would need to change the Habitat.Tween object so that it's a global, similar to how Stage is.

I'm not 100% set on any of this by the way, so please do feel free to try your own thoughts and ideas too!

from habitat.

TodePond avatar TodePond commented on August 15, 2024

Oh wait, in the final example I gave, it would probably be an object that contained a few different functions as properties. But maybe in the first example I gave it would just be a function. Maybe that's a potential reason why the first example would be better and simpler 🤔

from habitat.

Magnogen avatar Magnogen commented on August 15, 2024

Hey, did you still want to include the launch and land parameters that you already have in place?

They're currently the only way to smoothly tween with different speeds for launching and landing, other and EASE_IN and EASE_OUT

from habitat.

TodePond avatar TodePond commented on August 15, 2024

Ok I merged the changes! 31c58ad

This seems good for now! I would like to experiment in the future with some other intuitive ways of making easings and stuff, but for the moment, this is very useful!

from habitat.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.