CodingTrain / CodingTrain/Suggestion-Box
Multiple Interpolations using a loop
- Lingua principale
- Nessun dato sulla lingua
- Stelle
- 570
- Fork
- 85
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
Hello Mr. Shiffman. Thank you for your wonderful videos. My question is how to create multiple interpolations in P5 js and call each in a for loop. I tried to re-create Ben Fry's Integrator class in P5 js and use it to do what I desire but that did not succeed. I hope you can help me with this or at least give me a hint. Thank you. Here is what I have done :
```
function Integrator(value, damping, attraction)
{
this.DAMPING=0.5;
this.ATTRACTION=0.2;
this.value;
this.vel;
this.accel;
this.force;
this.mass=1;
this.damping=this.DAMPING;
this.attraction=this.ATTRACTION;
this.targeting; //boolean
this.target;
this.value=value;
this.damping=damping;
this.attraction=attraction;
this.set =function(v)
{
this.value=v;
}
this.update = function()
{
if(this.targeting)
{
this.force +=this.attraction *(this.target-this.value);
}
this.accel = this.force/this.mass;
this.vel = (this.vel+this.accel)*this.damping;
this.value +=this.vel;
this.force=0;
}
this.target = function(t)
{
this.targeting=true;
this.target=t;
}
this.noTarget = function()
{
this.targeting = false;
}
}
```
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Direzione di ricerca
Inizia con lo snippet Integrator dell'issue e la sua richiesta di più interpolazioni in un ciclo for; non viene indicato alcun file del repository, test o punto di ingresso. Per considerarlo completato sarebbe necessaria una risposta o un ambito tematico definito da un maintainer, poiché l'issue non specifica alcuna modifica concreta al repository.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- javascript
- Ambito
- content
- Tipo di issue
- Funzionalità
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Stato di attività
- Ferma
- Chiarezza
- Da chiarire
- Idoneità per principianti
- 15/100