"Supplied parameters do not match any signature of call target."

Hello guys,

I got this error 4 times in my script. I am really a beginner, so I don’t understand how to fix those errors, it is the same error on 4 different positions. The script is a JS script which I am trying to implement in my project.



BUGGED SCRIPT PART 1

// Speed variables
    var speedS = 1000000; var speedR = 100000; var speedF = 5000;
    var vitesse = speedR;
// Speed function
    Star.prototype.draw = function () {
        var x = Math.sin(this.timePassed) * this.orbitRadius + this.orbitX, y = Math.cos(this.timePassed) * this.orbitRadius + this.orbitY, twinkle = random(10);
        if (twinkle === 1 && this.alpha > 0) {
            this.alpha -= 0.05
        } else if (twinkle === 2 && this.alpha < 1) {
            this.alpha += 0.05
        }
        ctx.globalAlpha = this.alpha;
        ctx.drawImage(canvas2, x - this.radius / 2, y - this.radius / 2, this.radius, this.radius);
        this.timePassed += this.speed
        this.speed = random(this.orbitRadius) / vitesse;
    };

1st error is located here (the terminal sent this to me) :

    var vitesse = speedR;
// Speed function
    Star.prototype.draw = function () {

2nd error is located here (the terminal sent this to me) :

            this.alpha -= 0.05
        } else if (twinkle === 2 && this.alpha < 1) {
            this.alpha += 0.05


BUGGED SCRIPT PART 2

// Space transition function
    function transitionA() {
        vitesse = speedF;
        setTimeout(function(){ vitesse = speedR; }, 500);
    }

The 3rd error is located inside this function.



BUGGED SCRIPT PART 3

// Speed changer - Click
   var spaceS = document.getElementsByClassName("spaceS");
   var spaceR = document.getElementsByClassName("spaceR");
   var spaceF = document.getElementsByClassName("spaceF");
// Transition - Click
   var clickA = document.getElementsByClassName("clickA");
// Transition - Slide
   var slideA = document.getElementsByClassName("slideA");

The error is located here (the terminal sent this to me) :

   var clickA = document.getElementsByClassName("clickA");
// Transition - Slide
   var slideA = document.getElementsByClassName("slideA");

Many thanks to those who will try to help me.

If you’re a beginner, how did you write such a large and complex bunch of code? If the answer is “I didn’t, I just pasted it from somewhere”, then I would suggest not doing that. What you have posted does not look like it will integrate very well into an Ionic application.

This is a script to create particules in a canvas that I found on code pen, I did manage to modify it to get what I wanted.

I am a beginner in Ionic / Angular / Typescript and ES6. :confused:

Actually, I did find a way to integrate it in my Ionic project, but it doesn’t seems right. So I was trying to find the right way to do it.

I had plenty of other errors that I fixed, but this one is the last one. I am just experimenting to find the best way to implement it.

No, it doesn’t seem right. It’s doing direct DOM manipulation, which is a very bad idea in an Angular application. Angular applications need to let Angular handle the DOM. I think you are going to be better off either looking for an Angular-enabled version of this functionality, or enlisting the help of somebody very familiar with Angular to do so with what you have. This is not going to be something you can patch together with duct tape and have maintainable results.

This code is just creating stars in a canvas, I only change the speed of the stars sometimes with a few event listener, and it works fine. It’s even beautiful and smooth.

I just want to try to implement it in the angular way. lol
Can you help with that ?