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

Callback after finish on trigger for example play() #65

Closed
Szymon-dziewonski opened this issue Aug 27, 2015 · 9 comments
Closed

Callback after finish on trigger for example play() #65

Szymon-dziewonski opened this issue Aug 27, 2015 · 9 comments

Comments

@Szymon-dziewonski
Copy link

Is there anyway to callback after animation on click when I trigger for example animation with myVivus.play()?
And by the way what time is .play(1)? its not 1000ms can I set it somehow on specific time value in for example "mili seconds"?

Thank you in advance

@maxwellito
Copy link
Owner

About the callback:

// Inline SVG
new Vivus('my-svg-id', {type: 'delayed', duration: 200}, myCallback);

// Dynamic load
new Vivus('my-div-id', {type: 'delayed', duration: 200, file: 'link/to/my.svg'}, myCallback);

The Vivus constructor asks for 3 parameters:

  • ID (or object) of DOM element to interact with.
    It can be an inline SVG or a wrapper element to append an object tag from the option file
  • Option object (described in the following)
  • _Callback to call at the end of the animation (optional)_

from the readme.md file

About the method play:

  • play(speed) Plays the animation with the speed given in parameter. This value can be negative to go backward, between 0 and 1 to go slowly, or superior to 1 to go fast. By default the value is 1.

from the readme.md file

Btw, at no point Vivus use time for duration, but frames. Because browser can render at different speed depending on the heaviness of the page and performances of the machine. So to ensure a smooth animation Vivus use keyframes.

@Szymon-dziewonski
Copy link
Author

yeah but callback is working only with first animation it does not work when trigger play. Callback starts with staring animation than thats why I asked, I saw this in docs and it doesnt work with trigger .play()

Ok thanks for explenation of play(speed).

@maxwellito
Copy link
Owner

The callback is always triggered at the end of the animation. There's no
callback for when the animation start.
On 28 Aug 2015 8:03 am, "Szymon Dziewoński" notifications@github.com
wrote:

yeah but callback is working only with first animation it does not work
when trigger play. Callback starts with staring animation than thats why I
asked, I saw this in docs and it doesnt work with trigger .play()

Ok thanks for explenation of play(speed).


Reply to this email directly or view it on GitHub
#65 (comment).

@Szymon-dziewonski
Copy link
Author

Yeah but it works on start Im gonna show you, recreate problem
http://esthechoc.vrs.ovh/index.html
kraften section and first dot on left bottom
On console in dev tools it triggers when animations starts not end
main.settings.js line 71 settings for this callback, line 64 function set

@maxwellito
Copy link
Owner

I'm sorry but on my machine, the callback is triggered at the end of the animation.

screen shot 2015-08-29 at 13 44 40
screen shot 2015-08-29 at 13 44 43
screen shot 2015-08-29 at 13 44 44

@Szymon-dziewonski
Copy link
Author

yeah on first animation - you are right. BUt then when u click another bullet and go back to first again you get callback on start animation. I checked it so many times..

@maxwellito
Copy link
Owner

The behavior is normal. You just trigger play on point1 when the previous section begin to appear. So the animation start before you can see it, and the callback is executed before you can see your point.

screen shot 2015-08-29 at 16 01 53
screen shot 2015-08-29 at 16 02 06

@Szymon-dziewonski
Copy link
Author

Ok now I think I get it,seems you were right all along, sorry for wasting
your time.
I did few tests on single objects, and now I see even with play(-speed) it
triggers too but at start as animation is backward
Thank you anyway for patience :)

2015-08-29 17:04 GMT+02:00 maxwellito notifications@github.com:

The behavior is normal. You just trigger play on point1 when the previous
section begin to appear. So the animation start before you can see it, and
the callback is executed before you can see your point.

[image: screen shot 2015-08-29 at 16 01 53]
https://cloud.githubusercontent.com/assets/1097232/9562584/8e7e3800-4e67-11e5-80fa-5fd9ab7bfef9.png
[image: screen shot 2015-08-29 at 16 02 06]
https://cloud.githubusercontent.com/assets/1097232/9562585/91c3423a-4e67-11e5-87fb-9b5a0c5a5fdf.png


Reply to this email directly or view it on GitHub
#65 (comment).


Pozdrawiam,
Szymon Dziewoński

www.szymondziewonski.com
http://www.szymondziewonski.com

@maxwellito
Copy link
Owner

no worries :-)

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

No branches or pull requests

2 participants