Skip to content
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

PR for #21 #31

Merged
merged 10 commits into from
Aug 9, 2018
Merged

PR for #21 #31

merged 10 commits into from
Aug 9, 2018

Conversation

hirako2000
Copy link
Contributor

Adds pause functionality and update first example to demo it

@hirako2000 hirako2000 mentioned this pull request Aug 7, 2018
src/between.js Outdated
@@ -15,9 +15,10 @@ const _requestAnimationFrame = ( // polyfill
|| raf
);

let _prevTime = Date.now(), _time, _delta;
let _prevTime = Date.now(), _time, _delta, _paused;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Won't _paused stop all loops instead of just one? @hirako2000

Copy link
Contributor Author

@hirako2000 hirako2000 Aug 7, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes it was i thought one instance per tween... why would they share state?
I think, if that's the case, one instance per tween would be preferable, furthermore, should move away from Date.now() to some sort of Loop /timerinstance instance, for finer grained control. (thinks backward action and timelapse value on each tween)

@sasha240100
Copy link
Owner

sasha240100 commented Aug 8, 2018 via email

… use Symbol for the paused flag , and replace function with proper getter sasha240100#21
return this;
}

get isPaused() {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added getter instead of function

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hirako2000 Nice!

@@ -9,6 +9,7 @@ const _betweens = [];
const SYMBOL_TYPE = Symbol('type');
const SYMBOL_START_TIME = Symbol('start_time');
const SYMBOL_COMPLETED = Symbol('completed');
const SYMBOL_PAUSED = Symbol('paused');
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

using symbol now.

@hirako2000
Copy link
Contributor Author

thanks for pointing that out.
Adjusted.

return this;
}

get isPaused() {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hirako2000 Nice!

@@ -22,7 +22,7 @@ between.on('complete', (value) => { value });
// Test pause control
between.pause();
between.start();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hirako2000 How about renaming .start() to .run() ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I called it start because the emitted event that was already present is called start. It's for consistency.
But up to you, I can rename if you think it's better.

@sasha240100
Copy link
Owner

sasha240100 commented Aug 8, 2018 via email

@hirako2000
Copy link
Contributor Author

Renamed

@sasha240100 sasha240100 merged commit 4fe4cae into sasha240100:master Aug 9, 2018
@sasha240100 sasha240100 added this to the v0.1.2 milestone Aug 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants