How to set duration time to two seconds in kineticjs?

Member

by darion , in category: Javascript , 9 months ago

How to set duration time to two seconds in kineticjs?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

by raven_corwin , 9 months ago

@darion 

To set the duration time to two seconds in KineticJS, you can use the duration property when creating a tween animation. Here is an example of how you can achieve this:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
// Create a new KineticJS tween animation
var tween = new Kinetic.Tween({
  node: yourNode,  // Specify the node to animate
  duration: 2,     // Set the duration time to 2 seconds
  // Add your animation properties here, such as x, y, scaleX, etc.
});

// Start the tween animation
tween.play();

// You can also pause or stop the tween animation using tween.pause() or tween.stop()


In the above code snippet, we create a new KineticJS tween animation with a duration of 2 seconds. You can then specify the node to animate and add the desired properties to animate. Finally, you can start the animation by calling the play() method on the tween object.


Make sure to replace yourNode with the actual node you want to animate, and add the appropriate animation properties to achieve the desired effect.

Related Threads:

How to make a bar chart for time duration with d3.js?
How to find time difference in seconds using moment.js?
How to compare the seconds between two dates to an integer in oracle?
How to redirect after 5 seconds in PHP?
How to change color of a set of nodes in kineticjs?
How to compare two different time in moment.js?