GithubHelp home page GithubHelp logo

Comments (6)

hellozhangran avatar hellozhangran commented on May 24, 2024 2

i can stop the circel but then , how can i restart it ?

from jquery-circle-progress.

kottenator avatar kottenator commented on May 24, 2024

Hi!

Currently you may stop animation with next:

$(el.circleProgress('widget')).stop();

Full example

var el = $('.circle');
el.circleProgress({ value: 0.5 });
setTimeout(function () {
    $(el.circleProgress('widget')).stop();
}, 500);

I understand that it's not obvious, so it's good idea to include special "stop" method in next version.

I will leave this issue open to not forget to do this.

from jquery-circle-progress.

bderongs avatar bderongs commented on May 24, 2024

Thanks, its works perfectly.

from jquery-circle-progress.

kottenator avatar kottenator commented on May 24, 2024

I decided not to implement it (because it brings an ambiguity about current value) but to mention the solution in documentation.

from jquery-circle-progress.

bderongs avatar bderongs commented on May 24, 2024

I personaly redraw it with the correct values :

In the progress function I update a stepValueLeft variable
self.stepValueLeft = self.timeDuration-self.timeDuration*stepValue;

Then I have declared a restart function like this one below :

  this.restart = function(){
    myObject.circleProgress({
        value:1,
        animationStartValue: this.stepValue,
        animation:{
          duration: this.stepValueLeft,
          easing: "linear"
        }
    });
  };

Probably not the most optimal solution but it works fine.

from jquery-circle-progress.

hioctane321 avatar hioctane321 commented on May 24, 2024

This worked great to stop it but for some reason it's triggering the circle-animation-end event. I had to change the event to a circle-animation-progress and time the event in order to prevent my actions from triggering too early.

UPDATE:
I decided to try again from scratch and the circle-animation-end behaved properly this time. No idea why the first attempt failed. I suspect I had some bad math in triggering my stop.

Also, for those who needed help executing a restart I managed to stop and restart from where the bar left off by grabbing circle-animation-progress value:

.on('circle-animation-progress', function(e,p,v) {
	newStartValue = v.toPrecision(2);
});

from jquery-circle-progress.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.