svgdotjs / svg.js

The lightweight library for manipulating and animating SVG
https://svgjs.dev
Other
11.01k stars 1.07k forks source link

slow motion not working. #1180

Closed nikkisingh111333 closed 3 years ago

nikkisingh111333 commented 3 years ago

hey there ....i m using slowMo in svg.js of my group tag..heres my code `let u = 1 SVG.on(document, 'DOMContentLoaded', function() { // console.log(upper) console.log("gion") let user = document.getElementById('name') let upper = document.getElementById('upper') let lower = document.getElementById('lower') var introd = SVG().addTo('#WELCOME') var g1 = introd.group()

        g1.path('M883 0L923 25H58L7 0H883Z').fill('red')
        g1.path('M898.022 208L923 237H382.847L351 208H898.022Z').fill('red')
         g1.dmove(2000, 0)
        g1.animate({
            duration: 3000,

            when: 'now',
            swing: true,
            times: 1,

        }).dmove(-2000, 0).during(function() {
           // console.log("RUNNING")
            //console.log(u)
            if (u == 50) {
                this._duration = 4500  //THIS WONT CHANGE ON RUNTIME START FROM START IF WE DOES IT
            }
            u++
        })

    })`

what i want is to slow down group transition after u==50 as you can see in my code .its getting slowing but its not resuming from current position instead getting started from starting point ..i want it to get slowdown in continous like a flow manner how can i do this. i have previously used svg tag for this it worked but i want to do it on svg.js please help me.?

Fuzzyma commented 3 years ago

Well, just randomly changing private variables won't get you what you want :). Try this.speed(0.75).

nikkisingh111333 commented 3 years ago

okkkk this.speed didnt work but when i dig it up i found _timeline._speed=0.3 that worked btw thanks for the help..this.speed is showing undefined function.

On Sat, 19 Dec 2020 at 00:56, Ulrich-Matthias Schäfer < notifications@github.com> wrote:

Well, just randomly changing private variables won't get you what you want :). Try this.speed(0.75).

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/svgdotjs/svg.js/issues/1180#issuecomment-748277921, or unsubscribe https://github.com/notifications/unsubscribe-auth/AL3BT7D6HTVWO2NEFXOKTETSVOUGLANCNFSM4VBSMB6A .

Fuzzyma commented 3 years ago

well i guess its timeline().speed(0.3) then. Again: Don't rely on private properties. It can break at any time