Comments (15)
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.
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.
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.
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.
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.
That interactive demo looks great! Maybe p could be strength or something.
from habitat.
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.
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.
Hey! How about this?
obj.tween(”property", {from, to, strength, ease: Tween.EASE_IN_OUT_SINE})
from habitat.
Or maybe even something along the lines of:
obj.tween("property", {from, to, easeIn: true, easeOut: false, ease: Tween.EASE_SINE})
from habitat.
Sure I can get started on that! Would Tween.EASE_SINE
be a function?
from habitat.
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.
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.
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.
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)
- Components should be able to specify dependencies?
- Use an options helper HOT 1
- Update docs to highlight use of options HOT 1
- Bring things across to Options HOT 1
- Merge Machine and State, and allow nesting
- Fix incorrect entity example HOT 1
- batch signal updates
- context of stage can be an object HOT 1
- Rectangle component overrides dimensions signal with array
- `fire` doesn't pass arguments to state
- You should be able to change states when in the `enter` state machine event
- Pointer (etc) position should be initialised to `undefined` not `[undefined, undefined]`
- `absolutePosition` doesn't take scale into account
- Change state machine states to be classes instead of instances
- the `fire` method of `State` shouldn't be a property
- completely rethink Options
- Boost performance of SVG + HTML functions
- Boost performance of signals
- Pull over Arroost mods
- Validation
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from habitat.