public
Description: script.aculo.us is an open-source JavaScript framework for visual effects and interface behaviours.
Homepage: http://script.aculo.us/
Clone URL: git://github.com/madrobby/scriptaculous.git
Click here to lend your support to: scriptaculous and make a donation at www.pledgie.com !
Fixed a calculation error in Effect.Transitions.pulse that could lead to 
flickering, add easing and change it to be a normal 0 to 1 transition that can 
be used with any effects; Effect.Pulsate now uses its own implementation.
madrobby (author)
Mon May 12 00:29:09 -0700 2008
commit  b352e2b5c05a0a0642cc05cb896780cd5ca01f3e
tree    0eb92ed84a564adab1779afc94ba5529b61c323c
parent  00226c07b81ce6822c8cb1dc82f5d99f04ec39cc
...
 
 
1
2
3
...
1
2
3
4
5
0
@@ -1,3 +1,5 @@
0
+* Fixed a calculation error in Effect.Transitions.pulse that could lead to flickering, add easing and change it to be a normal 0 to 1 transition that can be used with any effects; Effect.Pulsate now uses its own implementation.  [Thomas Fuchs]
0
+
0
 * Fixed Effect.ScrollTo. Changeset 8686 had a typo, document.viewport.getScrollOffsets[0] is always undefined. Removed the max check as it is not a cross-browser way to get scroll height and breaks the effect. Depending on scrollTo to do the right thing.  Closes #11306.  [Nick Stakenburg]
0
 
0
 * Update version check so all Prototype versions can be required, not just x.x.x.  Closes #10966.  [Nick Stakenburg]
...
70
71
72
73
 
74
75
76
77
78
79
 
80
81
82
83
 
84
85
86
87
88
89
90
91
 
92
93
94
 
95
96
97
...
876
877
878
879
880
881
882
883
 
 
 
 
 
 
 
884
885
886
...
70
71
72
 
73
74
75
76
77
78
 
79
80
81
82
 
83
84
85
 
 
 
 
 
 
86
87
88
 
89
90
91
92
...
871
872
873
 
 
 
 
 
874
875
876
877
878
879
880
881
882
883
0
@@ -70,28 +70,23 @@ var Effect = {
0
   Transitions: {
0
     linear: Prototype.K,
0
     sinoidal: function(pos) {
0
-      return (-Math.cos(pos*Math.PI)/2) + 0.5;
0
+      return (-Math.cos(pos*Math.PI)/2) + .5;
0
     },
0
     reverse: function(pos) {
0
       return 1-pos;
0
     },
0
     flicker: function(pos) {
0
-      var pos = ((-Math.cos(pos*Math.PI)/4) + 0.75) + Math.random()/4;
0
+      var pos = ((-Math.cos(pos*Math.PI)/4) + .75) + Math.random()/4;
0
       return pos > 1 ? 1 : pos;
0
     },
0
     wobble: function(pos) {
0
-      return (-Math.cos(pos*Math.PI*(9*pos))/2) + 0.5;
0
+      return (-Math.cos(pos*Math.PI*(9*pos))/2) + .5;
0
     },
0
     pulse: function(pos, pulses) { 
0
-      pulses = pulses || 5; 
0
-      return (
0
-        ((pos % (1/pulses)) * pulses).round() == 0 ? 
0
-              ((pos * pulses * 2) - (pos * pulses * 2).floor()) : 
0
-          1 - ((pos * pulses * 2) - (pos * pulses * 2).floor())
0
-        );
0
+      return (-Math.cos((pos*((pulses||5)-.5)*2)*Math.PI)/2) + .5;
0
     },
0
     spring: function(pos) { 
0
-      return 1 - (Math.cos(pos * 4.5 * Math.PI) * Math.exp(-pos * 6)); 
0
+      return 1 - (Math.cos(pos * 4.5 * Math.PI) * Math.exp(-pos * 6));
0
     },
0
     none: function(pos) {
0
       return 0;
0
@@ -876,11 +871,13 @@ Effect.Shrink = function(element) {
0
 
0
 Effect.Pulsate = function(element) {
0
   element = $(element);
0
-  var options    = arguments[1] || { };
0
-  var oldOpacity = element.getInlineOpacity();
0
-  var transition = options.transition || Effect.Transitions.sinoidal;
0
-  var reverser   = function(pos){ return transition(1-Effect.Transitions.pulse(pos, options.pulses)) };
0
-  reverser.bind(transition);
0
+  var options    = arguments[1] || { },
0
+    oldOpacity = element.getInlineOpacity(),
0
+    transition = options.transition || Effect.Transitions.linear,
0
+    reverser   = function(pos){ 
0
+      return 1 - transition((-Math.cos((pos*(options.pulses||5)*2)*Math.PI)/2) + .5);
0
+    };
0
+    
0
   return new Effect.Opacity(element, 
0
     Object.extend(Object.extend({  duration: 2.0, from: 0,
0
       afterFinishInternal: function(effect) { effect.element.setStyle({opacity: oldOpacity}); }

Comments