Open In App

script.aculo.us Pulsate Effect

Last Updated : 20 Nov, 2020
Improve
Improve
Like Article
Like
Save
Share
Report

In this article we will demonstrate the effect of Pulsate by using JavaScript library called script.aculo.us having smooth transition from one to another. We can adjust the duration of the effect as well.

Syntax:

Effect.Pulsate('id_of_element');
Effect.Pulsate('id_of_element', { pulses: 5, duration: 1.5 });

Note: To use this library we are suppose to download or install the library and then use it in our programs. And to do so you can follow the this link http://script.aculo.us/downloads.

Approach:

To demonstrate the use of this function we have written a small piece of code. In which we have written a small JavaScript function named ShowEffect() method which uses Pulsate() method of this library. By clicking on Click Image to Pulsate, you will see the effect clearly.

Example: To see the effect first install the library and then open the following program in local environment.

HTML




    <html>
   <head>    
  
      <script type = "text/javascript" 
       src="scriptaculous-js-1.9.0/lib/prototype.js">
      </script>
      <script type = "text/javascript" 
       src="scriptaculous-js-1.9.0/src/scriptaculous.js?load = effects">
      </script>
          
      <script type = "text/javascript">
        
           function ShowEffect(element){
            new Effect.Pulsate(element, { duration: 3.0 });
         }          
      </script>
   </head>
     
   <body>
        <h2>Pulsate Effect for Image</h2>                 
    <div id="hideshow" onclick = "ShowEffect(this);">
             <img src = "GEEKSIMAGES/geeks1.PNG" alt = "" /><br/>
         Click Image to Pulsate
    </div>
   </body>
</html>
     


Output:



Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads