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
start: 'manual' not working for 'scenario' type #148
Comments
Hi there, |
Sure, it's attached
…On Mar 5, 2017 3:41 AM, "maxwellito" ***@***.***> wrote:
Hi there,
Can you please provide me your SVG, I would like to have a look to have a
better understanding. Thanks :)
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#148 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AA9ei6YWGaxkmBPeoarp8jbNGRbNQ4Olks5rinVUgaJpZM4MTSJs>
.
|
I just realized that's the original SVG without the timing options.
You can find the edited SVG here:
http://remed.io/remedio/logo-wordmark3.svg
THANK YOU!
On Mar 5, 2017 1:41 PM, "Sergio Bastias" <sergio@dishproductions.com> wrote:
Sure, it's attached
…On Mar 5, 2017 3:41 AM, "maxwellito" ***@***.***> wrote:
Hi there,
Can you please provide me your SVG, I would like to have a look to have a
better understanding. Thanks :)
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#148 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AA9ei6YWGaxkmBPeoarp8jbNGRbNQ4Olks5rinVUgaJpZM4MTSJs>
.
|
|
Sorry - what was the solution?
On Mar 5, 2017 2:16 PM, "maxwellito" <notifications@github.com> wrote:
You're welcome! :-)
That was an easy one ;-)
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#148 (comment)>,
or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AA9eiwMGJpUPvUkTXa5LWe54mhJuYliuks5riwnsgaJpZM4MTSJs>
.
|
Sorry I thought you were saying you were using the wrong file in your code. My bad :-S |
I didn't realise you don't wait for the SVG to be loaded to start to play it. When the dynamic load is used (via the property vivusLogo = new Vivus('logo', {
start: 'manual',
type: 'scenario',
file: 'logo-wordmark3.svg?'+Math.random(),
onReady: function () {
// Now I'm ready :) Let's play!
vivusLogo.play(0.5, function(){ console.log('logo completed') })
}
})
// Do not trigger it here, the SVG is not ready
// vivusLogo.play(0.5, function(){ console.log('logo completed') }) |
Sweet. I'll try that now and confirm....
…On Mar 5, 2017 2:34 PM, "maxwellito" ***@***.***> wrote:
I didn't realise you don't wait for the SVG to be loaded to start to play
it. When the dynamic load is used (via the property file), the callback
onReady must be used.
vivusLogo = new Vivus('logo', {
start: 'manual',
type: 'scenario',
file: 'logo-wordmark3.svg?'+Math.random(),
onReady: function () {
// Now I'm ready :) Let's play!
vivusLogo.play(0.5, function(){ console.log('logo completed') })
}
})
// Do not trigger it here, the SVG is not ready// vivusLogo.play(0.5, function(){ console.log('logo completed') })
http://maxwellito.github.io/drafts/vivus-issue-148/
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#148 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AA9ei09PGg50az7RB5lxd7UmzjxFoHySks5riw4pgaJpZM4MTSJs>
.
|
Ok, it seems to work.... but how can I start 'manual-'ly outside of the
onReady function? If I .play() in the onReady, its essentially like
autostart....
On Sun, Mar 5, 2017 at 2:35 PM, Sergio Bastias <sergio@dishproductions.com>
wrote:
… Sweet. I'll try that now and confirm....
On Mar 5, 2017 2:34 PM, "maxwellito" ***@***.***> wrote:
> I didn't realise you don't wait for the SVG to be loaded to start to play
> it. When the dynamic load is used (via the property file), the callback
> onReady must be used.
>
> vivusLogo = new Vivus('logo', {
> start: 'manual',
> type: 'scenario',
> file: 'logo-wordmark3.svg?'+Math.random(),
> onReady: function () {
> // Now I'm ready :) Let's play!
> vivusLogo.play(0.5, function(){ console.log('logo completed') })
> }
> })
> // Do not trigger it here, the SVG is not ready// vivusLogo.play(0.5, function(){ console.log('logo completed') })
>
> http://maxwellito.github.io/drafts/vivus-issue-148/
>
> —
> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub
> <#148 (comment)>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/AA9ei09PGg50az7RB5lxd7UmzjxFoHySks5riw4pgaJpZM4MTSJs>
> .
>
|
Yup :) |
Ok, here's my use case. On loading my SPA, I call:
...and then later in my application logic:
But when i call .play(), the callback runs immediately and animation doesn't start. (Same problem when i don't include the .reset().stop()) |
var autostart = false,
vivusLogo = new Vivus('logo', {
start: 'manual',
type: 'scenario',
file: 'logo-wordmark3.svg?'+Math.random(),
onReady: function () {
// Now I'm ready :) Let's play!
if (autostart) startAnimation()
}
})
function startAnimation () {
if (vivusLogo.isReady) {
vivusLogo.play(0.5, function(){ console.log('logo completed') })
}
else {
autostart = true;
}
} Then call |
Perfect! It's working. I'm not sure I understand the logic? When I call startAnimation, autostart is set to TRUE... how does the onReady function get called again? Just out of curiousity. |
Hehe :)
1st scenario:
2nd scenario:
The reason I use the same function (on the I hope this explanation helps :-) |
I think so. I didn't know that the SVG triggered onReady as well as the
.play() function.
Amazing, thanks!
…On Sun, Mar 5, 2017 at 3:07 PM, maxwellito ***@***.***> wrote:
Hehe :)
Sorry for not leaving more details, here is the story.
1. The vivus object is set up. This one start to load the SVG
*1st scenario*:
1. The SVG is loaded, then vivus trigger the onReady callback. But
because autostart variable is not true.. nothing happens.
2. [At some point] your code trigger startAnimation(), this one will
check if the vivus instance is ready (which is the case) so it starts
playing it.
*2nd scenario*:
1. Your code trigger startAnimation(), this one will check if the
vivus instance is ready (which is NOT the case) so it only switch the
autostart variable to true (as a marker).
2. The SVG is loaded, then vivus trigger the onReady callback. This
time, the autostart variable is true, so it trigger startAnimation().
And this time, the vivus instance is ready so it play the animation.
The reason I use the same function (on the onReady and manually) is
because it will avoid redefining the setting of the play. It's at only
one place.
I hope this explanation helps :-)
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#148 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AA9ei7Glc-sBOxpTxlYAygocfdCR7Xreks5rixYGgaJpZM4MTSJs>
.
|
Uhmmm... |
Thanks for the library!
I've got a cool animation going with scenario, but if i try to change start to 'manual' and then call .play(), the callback is called immediately, and the animation doesn't start.
The timing directives are explicit in my svg file, and it works with inViewport and autostart.
The text was updated successfully, but these errors were encountered: