Giter Site home page Giter Site logo

xlikesasukee / p5-physic-simulations Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 313 KB

In this Repository I am going to publish Physic Simulations I made in p5.js

JavaScript 87.10% HTML 11.28% CSS 1.62%
electric-field english german javascript math p5-js p5js physics physics-simulation simulation

p5-physic-simulations's People

Contributors

xlikesasukee avatar

Watchers

 avatar

p5-physic-simulations's Issues

Electric Field: Change the color of the arrows depending on the force applied to them.

I would like the color of the Arrows to change depending on the value of F you get for them.
This could happen inside this function.

function drawElectricField() {
  for (let x = 0; x < 1200; x += 40) {
    for (let y = 0; y < 1200; y += 40) {
      let base = new Complex(x, y);
      let F = calculateElectricFieldVector(base).mul(1e15);

      //getColor(F) get corresponding color out of F value

      let absF = F.abs();
      F = F.mul(1/absF);
      drawArrow(base, new Complex(base.re + F.re, base.im + F.im),[35, 144, 145]);
    }
  }
}

The color variable is already a parameter of my drawArrow funciton.

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.