Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Compare function animation duration not matching listed duration #1

Merged
merged 2 commits into from

2 participants

@aackerman

fixed bug in the case that a user adjusts the duration and then clicks on a library function and the 'compare' 'tealish-colored' function is not set to the listed duration and defaults to 1 second.

@aackerman aackerman fixed bug in the case that a user adjusts the duration and then click…
…s on a library function and the library function is set to one second instead of the listed duration
84237ee
@LeaVerou
Owner

Hi, thanks for your code and effort!

Could you please make the name of the function shorter to match the rest? (e.g. duration())

@aackerman aackerman minor changes but I can't use duration() as a function as it is alrea…
…dy being used to id an element, can't really clobber an element
85d6ad1
@aackerman

I changed it to getDuration() and I could change it to something specific if you wish. But, as my commit message states, duration is already being used as an id so it cannot be used as a function.

@LeaVerou LeaVerou merged commit 7863012 into LeaVerou:master
@LeaVerou
Owner

Merged & uploaded. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 5, 2011
  1. @aackerman

    fixed bug in the case that a user adjusts the duration and then click…

    aackerman authored
    …s on a library function and the library function is set to one second instead of the listed duration
Commits on Dec 14, 2011
  1. @aackerman

    minor changes but I can't use duration() as a function as it is alrea…

    aackerman authored
    …dy being used to id an element, can't really clobber an element
This page is out of date. Refresh to see the latest.
Showing with 11 additions and 11 deletions.
  1. +11 −11 interaction.js
View
22 interaction.js
@@ -77,7 +77,9 @@ var self = window.bezierLibrary = {
this.bezierCanvas.plot(self.thumbnailStyleSelected);
compare.style.cssText = this.style.cssText;
-
+
+ compare.style.setProperty(prefix + 'transition-duration', getDuration() + 's', null);
+
compareCanvas.bezier = this.bezier;
compareCanvas.plot({
@@ -283,16 +285,10 @@ go.onclick = function() {
};
duration.oninput = function() {
- var value = Math.round(this.value * 10) / 10;
-
- if(isNaN(value)) {
- return;
- }
-
- this.nextElementSibling.textContent = value + ' second' + (value == 1? '' : 's');
-
- current.style.setProperty(prefix + 'transition-duration', value + 's', null);
- compare.style.setProperty(prefix + 'transition-duration', value + 's', null);
+ var val = getDuration();
+ this.nextElementSibling.textContent = val + ' second' + (val == 1? '' : 's');
+ current.style.setProperty(prefix + 'transition-duration', val + 's', null);
+ compare.style.setProperty(prefix + 'transition-duration', val + 's', null);
};
window['import'].onclick = function() {
@@ -357,6 +353,10 @@ importexport.onsubmit = function() {
* Helper functions
*/
+function getDuration() {
+ return (isNaN(val = Math.round(duration.value * 10) / 10)) ? null : val;
+}
+
function update() {
// Redraw canvas
bezierCanvas.bezier =
Something went wrong with that request. Please try again.