SlideShare une entreprise Scribd logo
1  sur  47
Télécharger pour lire hors ligne
•




    F = -kx
    k




                  F = -kx
                  ma = -kx

                  x = -sin   k t
                             m

                  x = Csin(!t + "
              x
springForce = -stiffness * stretch




springForce = -stiffness * (position - restPosition)
•




    springForce = stiffness * (restPositon -
    position)




    velocity = friction * (velocity + springFroce)
float stiffness = 0.1; //
float damping = 0.9; //
float velocity = 0.0; //
float targetY; //
float y; //


void setup() {
	   size(400, 400);
	   noStroke();
}

void draw() {
	   fill(0, 12);
	   rect(0, 0, width, height);
	   fill(255);
	   float force = stiffness * (targetY - y); //   f = -kx
	   velocity = damping * (velocity + force); //
	   y += velocity; //
	   rect(10, y, width - 20, 10); //
	   targetY = mouseY; //      Y
}
•




    F = ma



    a=F/m


    acceleration = springForce / mass
//2
float y1, y2; //
float velocity1, velocity2; //
float mass1 = 1.0; //       1
float mass2 = 6.0; //       2
float stiffness = 0.1; //
float damping = 0.9; //


void setup() {
	   size(400, 400);
	   noStroke();
}

void draw() {
	   fill(0, 12);
	   rect(0, 0, width, height);
	   fill(255);
	   float targetY = mouseY; //
	     //   1
	     float forceA = stiffness * (targetY - y1); //
	     float accelerationY1 = forceA / mass1; //
	     velocity1 = damping * (velocity1 + accelerationY1); //
	     y1 += velocity1; //
rect(0, y1, width/2, 15);
	   //   2	
	   float forceB = stiffness * (targetY - y2); //
	   float accelerationY2 = forceB / mass2; //
	   velocity2 = damping * (velocity2 + accelerationY2); //
	   y2 += velocity2; //
	   rect(width/2, y2, width/2, 15);
}
float   stiffness = 0.05;
float   damping = 0.9;
float   mass = 3.0;
float   gravity = 0.0;
float   velocityX = 0.0, velocityY = 0.0;
float   targetX, targetY;
float   x, y;

void setup() {
	   size(600, 600);
	   smooth();
}

void draw() {
	   background(0);
	   //X
	   float forceX = stiffness * (targetX - x);
	   float accelerationX = forceX / mass;
	   velocityX = damping * (velocityX + accelerationX);
	   x += velocityX;
	   //Y     	
	   float forceY = stiffness * (targetY - y);
	   forceY += gravity;
	   float accelerationY = forceY / mass;
	   velocityY = damping * (velocityY + accelerationY);
	   y += velocityY;
//
	   noStroke();
	   fill(255);
	   ellipse(x, y, 40, 40);
	   //
	   stroke(127);
	   noFill();
	   line(mouseX, mouseY, x, y);
	   //
	   targetX = mouseX;
	   targetY = mouseY;
}
//Spring2D
Spring2D s1, s2;
float gravity = 5.0;
float mass = 2.0;

void   setup() {
	      size(400, 400);
	      smooth();
	      fill(0);
	      //     x   , y    ,    ,
	      s1 = new Spring2D(0.0, width / 2, mass, gravity);
	      s2 = new Spring2D(0.0, width / 2, mass, gravity);
}

void   draw() {
	      background(204);
	      s1.update(mouseX, mouseY);
	      s1.display(mouseX, mouseY);
	      s2.update(s1.x, s1.y);
	      s2.display(s1.x, s1.y);
}
// class     Spring2D
//
class Spring2D {
	   float vx, vy;
	   float x, y;
	   float gravity;
	   float mass;
	   float radius = 10;
	   float stiffness = 0.2;
	   float damping = 0.7;
	   //
	    Spring2D(float xpos, float ypos, float m, float g) {
	    	     x = xpos;
	    	     y = ypos;
	    	     mass = m;
	    	     gravity = g;
	    }
	    //
	    void   update(float targetX, float targetY) {
	    	       float forceX = (targetX - x) * stiffness;
	    	       float ax = forceX / mass;
	    	       vx = damping * (vx + ax);
	    	       x += vx;
	    	       float forceY = (targetY - y) * stiffness;
forceY += gravity;
	   	      float ay = forceY / mass;
	   	      vy = damping * (vy + ay);
	   	      y += vy;
	   }
	   //
	   void   display(float nx, float ny) {
	   	       noStroke();
	   	       ellipse(x, y, radius*2, radius*2);
	   	       stroke(255);
	   	       line(x, y, nx, ny);
	   }
}
//
int numSprings = 10; //
Spring2D[] s = new Spring2D[numSprings];
float gravity = 5.0;
float mass = 5.0;
float stiffness = 0.2;
float damping = 0.8;
void setup() {
	   size(600, 600);
	   smooth();
	   fill(0);
	   for (int i = 0; i < numSprings; i++) {
	   	     s[i] = new Spring2D(width / 2, i*(height / numSprings), mass, gravity,
stiffness, damping);
	   }
}
void draw() {
	   background(204);
	   s[0].update(mouseX, mouseY);
	   s[0].display(mouseX, mouseY);
	   for (int i = 1; i < numSprings; i++) {
	   	     s[i].update(s[i-1].x, s[i-1].y);
	   	     s[i].display(s[i-1].x, s[i-1].y);
	   }
}
import traer.physics.*;
ParticleSystem physics;
Particle mouse;
Particle[] p;
Spring[] s;

void setup(){
	   size( 400, 400 );
	   smooth();
	   //Physics
	   physics = new ParticleSystem( 1.0, 0.05 );
	   p = new Particle[10];
	   s = new Spring[10];
	   //
	   for(int i = 0; i < p.length; i++){
	   	     p[i] = physics.makeParticle( 1.0, width/2, 20 * i, 0);
	   	     if(i > 0){
	   	     	    s[i] = physics.makeSpring( p[i], p[i-1], 1.0, 0.1, 20);
	   	     }
	   }
	   //
	   p[0].makeFixed();
}
void draw(){
	   background(0);
	   physics.tick();
	   //
	   p[0].moveTo(mouseX, mouseY, 0);
	   //                                    	
	   for(int i = 0; i < p.length; i++){
	   	     noStroke();
	   	     fill(128);
	   	     ellipse( p[i].position().x(), p[i].position().y(), 10, 10 );
	   	     if(i > 0){
	   	     	    stroke(255);
	   	     	    line(p[i].position().x(), p[i].position().y(),
	   	     	    	     p[i-1].position().x(), p[i-1].position().y());
	   	     }
	   }
}
p[0]   p[1]
                                            p[2]
                                            p[3]




                                             ...
                                            p[n]

                                     p[1]   p[2]
                                            p[3]
                                            p[4]
    for(int i = 0; i < n; i++){




                                             ...
•




    •




       for(j = i + 1; j < n; j++){          p[n]
        •




                                     p[2]   p[3]
    •




        }                                   p[4]
•




    }                                       p[5]


                                      ...




                                             ...
                                     p[n]   p[n]
import processing.opengl.*;
import traer.physics.*;
ParticleSystem physics;
Particle[] particles;
int num = 80;

void setup(){
	   size(800, 800, OPENGL );
	   fill(255);
	   smooth();
	   rectMode(CENTER);
	   physics = new ParticleSystem(0, 0.0);
	   particles = new Particle[num];
	   for (int i = 0; i < num; i++){
	   	     particles[i] = physics.makeParticle(0.2, random(width),
random(height), 0);
	   	     for (int j = i + 1; j < num; j++){
	   	     	    particles[j] = physics.makeParticle(0.2, random(width),
random(height), 0);
	   	     	    particles[j].setMass(0.5);
	   	     	    physics.makeSpring(particles[i], particles[j], 0.1, 0.0, width/2);
	   	     }
	   }
}
void draw(){
  physics.tick(0.01);
  background(0);
  for (int i = 0; i < num; i++){
    rect(particles[i].position().x(), particles[i].position().y(), 8, 8);
  }
}
import processing.opengl.*;
import traer.physics.*;
ParticleSystem physics;
Particle[] particles;
int num = 80;

void setup(){
	   size(800, 800, OPENGL );
	   fill(255);
	   smooth();
	   rectMode(CENTER);
	   physics = new ParticleSystem(0, 0.0);
	   particles = new Particle[num];
	   for (int i = 0; i < num; i++){
	   	     particles[i] = physics.makeParticle(0.2, random(width),
random(height), 0);
	   	     for (int j = i + 1; j < num; j++){
	   	     	    particles[j] = physics.makeParticle(0.2, random(width),
random(height), 0);
	   	     	    particles[j].setMass(0.5);
	   	     	    physics.makeSpring(particles[i], particles[j], 0.1, 0.0, width/2);
	   	     }
	   }
}
void   draw(){
	      physics.tick(0.01);
	      background(0);
	      for (int i = 0; i < num; i++){
	      	   fill(255);
	      	   noStroke();
	      	   rect(particles[i].position().x(), particles[i].position().y(), 8, 8);
	      	   stroke(127,50);
	      	   //Spring    line
	      	   for (int j = i + 1; j < num; j++){
	      	   	    line(particles[j].position().x(), particles[j].position().y(),
	      	   	    particles[i].position().x(), particles[i].position().y());
	      	   }
	      }
}
import processing.opengl.*;
import traer.physics.*;
ParticleSystem physics;
Particle[] particles;
int num = 80;

void setup(){
	   size(800, 800, OPENGL );
	   fill(255);
	   smooth();
	   rectMode(CENTER);
	   physics = new ParticleSystem(0, 0.0);
	   particles = new Particle[num];
	   for (int i = 0; i < num; i++){
	   	     particles[i] = physics.makeParticle(0.2, random(width), random(height), 0);
	   	     for (int j = i + 1; j < num; j++){
	   	     	    particles[j]
	   	     	    = physics.makeParticle(0.2, random(width), random(height), 0);
	   	     	    particles[j].setMass(0.5);
	   	     	    physics.makeSpring(particles[i], particles[j], 0.1, 0.0, width/2);
	   	     }
	   }
}
void   draw(){
	       physics.tick(0.01);
	       background(0);
	       for (int i = 0; i < num; i++){
	       	   rect(particles[i].position().x(), particles[i].position().y(), 4, 4);
	       	   for (int j = i + 1; j < num; j++){
	       	   	    float l = dist(particles[j].position().x(),
	       	   	    	     	     	       particles[j].position().y(),
	       	   	    	     	     	       particles[i].position().x(),
	       	   	    	     	     	       particles[i].position().y());
	       	   	    stroke(255, 100 - l);
	       	   	    line(particles[j].position().x(),
	       	   	    	       particles[j].position().y(),
	       	   	    	       particles[i].position().x(),
	       	   	    	       particles[i].position().y());
	       	   }
	       }
}
import processing.opengl.*;
import traer.physics.*;
ParticleSystem physics;
Particle[] particles;
int num = 80;

void   setup(){
	       size(800, 800, OPENGL );
	       smooth();
	       fill(255);
	       rectMode(CENTER);
	       physics = new ParticleSystem(0, 0.0);
	       particles = new Particle[num];
	       for (int i = 0; i < num; i++){
	       	   particles[i] = physics.makeParticle(0.2, random(width), random(height), 0);
	       	   for (int j = i + 1; j < num; j++){
	       	   	     particles[j]
	       	   	     = physics.makeParticle(0.2, random(width), random(height), 0);
	       	   	     particles[j].setMass(0.5);
	       	   	     physics.makeAttraction(particles[i], particles[j], 1000, width);
	       	   }
	       }
}
void draw(){
	   physics.tick(1);
	   background(0);
	   for (int i = 0; i < num; i++)
	   {
	   	     rect(particles[i].position().x(), particles[i].position().y(), 3, 3);
	   	     for (int j = i + 1; j < num; j++)
	   	     {
	   	     	    float l = dist(particles[j].position().x(),
	   	     	    	     	     	       particles[j].position().y(),
	   	     	    	     	     	       particles[i].position().x(),
	   	     	    	     	     	       particles[i].position().y());
	   	     	    stroke(255, 100 - l);
	   	     	    line(particles[j].position().x(),
	   	     	    	       particles[j].position().y(),
	   	     	    	       particles[i].position().x(),
	   	     	    	       particles[i].position().y());
	   	     }
	   }
}
Proga 0622

Contenu connexe

Tendances

Disney Effects: Building web/mobile castle in OpenGL 2D & 3D
Disney Effects: Building web/mobile castle in OpenGL 2D & 3DDisney Effects: Building web/mobile castle in OpenGL 2D & 3D
Disney Effects: Building web/mobile castle in OpenGL 2D & 3D
SVWB
 
X2 T06 01 Discs & Washers
X2 T06 01 Discs & WashersX2 T06 01 Discs & Washers
X2 T06 01 Discs & Washers
Nigel Simmons
 
ECMAScript 6 major changes
ECMAScript 6 major changesECMAScript 6 major changes
ECMAScript 6 major changes
hayato
 

Tendances (20)

Mobile Game and Application with J2ME - Collision Detection
Mobile Gameand Application withJ2ME  - Collision DetectionMobile Gameand Application withJ2ME  - Collision Detection
Mobile Game and Application with J2ME - Collision Detection
 
Disney Effects: Building web/mobile castle in OpenGL 2D & 3D
Disney Effects: Building web/mobile castle in OpenGL 2D & 3DDisney Effects: Building web/mobile castle in OpenGL 2D & 3D
Disney Effects: Building web/mobile castle in OpenGL 2D & 3D
 
The Ring programming language version 1.7 book - Part 48 of 196
The Ring programming language version 1.7 book - Part 48 of 196The Ring programming language version 1.7 book - Part 48 of 196
The Ring programming language version 1.7 book - Part 48 of 196
 
The Ring programming language version 1.4 book - Part 16 of 30
The Ring programming language version 1.4 book - Part 16 of 30The Ring programming language version 1.4 book - Part 16 of 30
The Ring programming language version 1.4 book - Part 16 of 30
 
662305 LAB13
662305 LAB13662305 LAB13
662305 LAB13
 
The Ring programming language version 1.5 book - Part 8 of 31
The Ring programming language version 1.5 book - Part 8 of 31The Ring programming language version 1.5 book - Part 8 of 31
The Ring programming language version 1.5 book - Part 8 of 31
 
openGl example
openGl exampleopenGl example
openGl example
 
Raspberry Pi à la GroovyFX
Raspberry Pi à la GroovyFXRaspberry Pi à la GroovyFX
Raspberry Pi à la GroovyFX
 
The Ring programming language version 1.3 book - Part 50 of 88
The Ring programming language version 1.3 book - Part 50 of 88The Ring programming language version 1.3 book - Part 50 of 88
The Ring programming language version 1.3 book - Part 50 of 88
 
Javasccript MV* frameworks
Javasccript MV* frameworksJavasccript MV* frameworks
Javasccript MV* frameworks
 
NTU ML TENSORFLOW
NTU ML TENSORFLOWNTU ML TENSORFLOW
NTU ML TENSORFLOW
 
The Ring programming language version 1.5.1 book - Part 57 of 180
The Ring programming language version 1.5.1 book - Part 57 of 180The Ring programming language version 1.5.1 book - Part 57 of 180
The Ring programming language version 1.5.1 book - Part 57 of 180
 
mobl
moblmobl
mobl
 
Corona sdk
Corona sdkCorona sdk
Corona sdk
 
X2 T06 01 Discs & Washers
X2 T06 01 Discs & WashersX2 T06 01 Discs & Washers
X2 T06 01 Discs & Washers
 
ECMAScript 6 major changes
ECMAScript 6 major changesECMAScript 6 major changes
ECMAScript 6 major changes
 
The Ring programming language version 1.5.4 book - Part 68 of 185
The Ring programming language version 1.5.4 book - Part 68 of 185The Ring programming language version 1.5.4 book - Part 68 of 185
The Ring programming language version 1.5.4 book - Part 68 of 185
 
Computational Linguistics week 10
 Computational Linguistics week 10 Computational Linguistics week 10
Computational Linguistics week 10
 
Sokoban Game Development Using Java ( Updated using Screenshots & Class Diagr...
Sokoban Game Development Using Java ( Updated using Screenshots & Class Diagr...Sokoban Game Development Using Java ( Updated using Screenshots & Class Diagr...
Sokoban Game Development Using Java ( Updated using Screenshots & Class Diagr...
 
The Ring programming language version 1.4.1 book - Part 18 of 31
The Ring programming language version 1.4.1 book - Part 18 of 31The Ring programming language version 1.4.1 book - Part 18 of 31
The Ring programming language version 1.4.1 book - Part 18 of 31
 

En vedette (7)

Web Presen1 0625
Web Presen1 0625Web Presen1 0625
Web Presen1 0625
 
Proga 0601
Proga 0601Proga 0601
Proga 0601
 
Web Presen1 0709
Web Presen1 0709Web Presen1 0709
Web Presen1 0709
 
Tau Web0609
Tau Web0609Tau Web0609
Tau Web0609
 
Sbaw090623
Sbaw090623Sbaw090623
Sbaw090623
 
Proga 0615
Proga 0615Proga 0615
Proga 0615
 
Meteor.js for DOers
Meteor.js for DOersMeteor.js for DOers
Meteor.js for DOers
 

Similaire à Proga 0622

Create a java project that - Draw a circle with three random init.pdf
Create a java project that - Draw a circle with three random init.pdfCreate a java project that - Draw a circle with three random init.pdf
Create a java project that - Draw a circle with three random init.pdf
arihantmobileselepun
 
ARTDM 170, Week 13: Text Elements + Arrays
ARTDM 170, Week 13: Text Elements + ArraysARTDM 170, Week 13: Text Elements + Arrays
ARTDM 170, Week 13: Text Elements + Arrays
Gilbert Guerrero
 
import java.util.Scanner;public class Main {    public static in.pdf
import java.util.Scanner;public class Main {    public static in.pdfimport java.util.Scanner;public class Main {    public static in.pdf
import java.util.Scanner;public class Main {    public static in.pdf
anwarsadath111
 
Exploring Canvas
Exploring CanvasExploring Canvas
Exploring Canvas
Kevin Hoyt
 
package chapter15;import javafx.application.Application;import j.pdf
package chapter15;import javafx.application.Application;import j.pdfpackage chapter15;import javafx.application.Application;import j.pdf
package chapter15;import javafx.application.Application;import j.pdf
KARTIKINDIA
 

Similaire à Proga 0622 (20)

Create a java project that - Draw a circle with three random init.pdf
Create a java project that - Draw a circle with three random init.pdfCreate a java project that - Draw a circle with three random init.pdf
Create a java project that - Draw a circle with three random init.pdf
 
Proga 090525
Proga 090525Proga 090525
Proga 090525
 
Ocr code
Ocr codeOcr code
Ocr code
 
Ssaw08 0624
Ssaw08 0624Ssaw08 0624
Ssaw08 0624
 
Include
IncludeInclude
Include
 
[3] 프로세싱과 아두이노
[3] 프로세싱과 아두이노[3] 프로세싱과 아두이노
[3] 프로세싱과 아두이노
 
ARTDM 170, Week 13: Text Elements + Arrays
ARTDM 170, Week 13: Text Elements + ArraysARTDM 170, Week 13: Text Elements + Arrays
ARTDM 170, Week 13: Text Elements + Arrays
 
Proga 0518
Proga 0518Proga 0518
Proga 0518
 
Proga 0706
Proga 0706Proga 0706
Proga 0706
 
Matlab assignment
Matlab assignmentMatlab assignment
Matlab assignment
 
Creating an Uber Clone - Part IV.pdf
Creating an Uber Clone - Part IV.pdfCreating an Uber Clone - Part IV.pdf
Creating an Uber Clone - Part IV.pdf
 
C Code and the Art of Obfuscation
C Code and the Art of ObfuscationC Code and the Art of Obfuscation
C Code and the Art of Obfuscation
 
Grand centraldispatch
Grand centraldispatchGrand centraldispatch
Grand centraldispatch
 
Haskellで学ぶ関数型言語
Haskellで学ぶ関数型言語Haskellで学ぶ関数型言語
Haskellで学ぶ関数型言語
 
PRACTICAL COMPUTING
PRACTICAL COMPUTINGPRACTICAL COMPUTING
PRACTICAL COMPUTING
 
Numerical Method Assignment
Numerical Method AssignmentNumerical Method Assignment
Numerical Method Assignment
 
import java.util.Scanner;public class Main {    public static in.pdf
import java.util.Scanner;public class Main {    public static in.pdfimport java.util.Scanner;public class Main {    public static in.pdf
import java.util.Scanner;public class Main {    public static in.pdf
 
Beyond Scala Lens
Beyond Scala LensBeyond Scala Lens
Beyond Scala Lens
 
Exploring Canvas
Exploring CanvasExploring Canvas
Exploring Canvas
 
package chapter15;import javafx.application.Application;import j.pdf
package chapter15;import javafx.application.Application;import j.pdfpackage chapter15;import javafx.application.Application;import j.pdf
package chapter15;import javafx.application.Application;import j.pdf
 

Plus de Atsushi Tadokoro

「クリエイティブ・ミュージック・コーディング」- オーディオ・ビジュアル作品のための、オープンソースなソフトウエア・フレームワークの現状と展望
「クリエイティブ・ミュージック・コーディング」- オーディオ・ビジュアル作品のための、オープンソースなソフトウエア・フレームワークの現状と展望「クリエイティブ・ミュージック・コーディング」- オーディオ・ビジュアル作品のための、オープンソースなソフトウエア・フレームワークの現状と展望
「クリエイティブ・ミュージック・コーディング」- オーディオ・ビジュアル作品のための、オープンソースなソフトウエア・フレームワークの現状と展望
Atsushi Tadokoro
 
プログラム初級講座 - メディア芸術をはじめよう
プログラム初級講座 - メディア芸術をはじめようプログラム初級講座 - メディア芸術をはじめよう
プログラム初級講座 - メディア芸術をはじめよう
Atsushi Tadokoro
 
Interactive Music II ProcessingとSuperColliderの連携 -2
Interactive Music II ProcessingとSuperColliderの連携 -2Interactive Music II ProcessingとSuperColliderの連携 -2
Interactive Music II ProcessingとSuperColliderの連携 -2
Atsushi Tadokoro
 
coma Creators session vol.2
coma Creators session vol.2coma Creators session vol.2
coma Creators session vol.2
Atsushi Tadokoro
 
Interactive Music II ProcessingとSuperColliderの連携1
Interactive Music II ProcessingとSuperColliderの連携1Interactive Music II ProcessingとSuperColliderの連携1
Interactive Music II ProcessingとSuperColliderの連携1
Atsushi Tadokoro
 
Interactive Music II Processingによるアニメーション
Interactive Music II ProcessingによるアニメーションInteractive Music II Processingによるアニメーション
Interactive Music II Processingによるアニメーション
Atsushi Tadokoro
 
Interactive Music II Processing基本
Interactive Music II Processing基本Interactive Music II Processing基本
Interactive Music II Processing基本
Atsushi Tadokoro
 
Interactive Music II SuperCollider応用 2 - SuperColliderとPure Dataの連携
Interactive Music II SuperCollider応用 2 - SuperColliderとPure Dataの連携Interactive Music II SuperCollider応用 2 - SuperColliderとPure Dataの連携
Interactive Music II SuperCollider応用 2 - SuperColliderとPure Dataの連携
Atsushi Tadokoro
 
Media Art II openFrameworks アプリ間の通信とタンジブルなインターフェイス
Media Art II openFrameworks  アプリ間の通信とタンジブルなインターフェイス Media Art II openFrameworks  アプリ間の通信とタンジブルなインターフェイス
Media Art II openFrameworks アプリ間の通信とタンジブルなインターフェイス
Atsushi Tadokoro
 
Interactive Music II SuperCollider応用 - SuperColliderと OSC (Open Sound Control)
Interactive Music II SuperCollider応用 - SuperColliderと OSC (Open Sound Control)Interactive Music II SuperCollider応用 - SuperColliderと OSC (Open Sound Control)
Interactive Music II SuperCollider応用 - SuperColliderと OSC (Open Sound Control)
Atsushi Tadokoro
 
iTamabi 13 ARTSAT API 実践 5 - 衛星の軌道を描く
iTamabi 13 ARTSAT API 実践 5 - 衛星の軌道を描くiTamabi 13 ARTSAT API 実践 5 - 衛星の軌道を描く
iTamabi 13 ARTSAT API 実践 5 - 衛星の軌道を描く
Atsushi Tadokoro
 
メディア芸術基礎 II 第11回:HTML5実践 表現のための様々なJavaScriptライブラリ
メディア芸術基礎 II 第11回:HTML5実践 表現のための様々なJavaScriptライブラリメディア芸術基礎 II 第11回:HTML5実践 表現のための様々なJavaScriptライブラリ
メディア芸術基礎 II 第11回:HTML5実践 表現のための様々なJavaScriptライブラリ
Atsushi Tadokoro
 
芸術情報演習デザイン(Web) 第8回: CSSフレームワークを使う
芸術情報演習デザイン(Web)  第8回: CSSフレームワークを使う芸術情報演習デザイン(Web)  第8回: CSSフレームワークを使う
芸術情報演習デザイン(Web) 第8回: CSSフレームワークを使う
Atsushi Tadokoro
 
Interactive Music II SuperCollider応用 JITLib - ライブコーディング 2
Interactive Music II SuperCollider応用 JITLib - ライブコーディング 2Interactive Music II SuperCollider応用 JITLib - ライブコーディング 2
Interactive Music II SuperCollider応用 JITLib - ライブコーディング 2
Atsushi Tadokoro
 
iTamabi 13 第9回:ARTSAT API 実践 3 ジオコーディングで衛星の位置を取得
iTamabi 13 第9回:ARTSAT API 実践 3 ジオコーディングで衛星の位置を取得iTamabi 13 第9回:ARTSAT API 実践 3 ジオコーディングで衛星の位置を取得
iTamabi 13 第9回:ARTSAT API 実践 3 ジオコーディングで衛星の位置を取得
Atsushi Tadokoro
 
Webデザイン 第10回:HTML5実践 Three.jsで3Dプログラミング
Webデザイン 第10回:HTML5実践 Three.jsで3DプログラミングWebデザイン 第10回:HTML5実践 Three.jsで3Dプログラミング
Webデザイン 第10回:HTML5実践 Three.jsで3Dプログラミング
Atsushi Tadokoro
 
Interactive Music II SuperCollider応用 JITLib - ライブコーディング 1
Interactive Music II SuperCollider応用 JITLib - ライブコーディング 1Interactive Music II SuperCollider応用 JITLib - ライブコーディング 1
Interactive Music II SuperCollider応用 JITLib - ライブコーディング 1
Atsushi Tadokoro
 
iTamabi 13 第8回:ARTSAT API 実践 2 衛星アプリを企画する
iTamabi 13 第8回:ARTSAT API 実践 2 衛星アプリを企画するiTamabi 13 第8回:ARTSAT API 実践 2 衛星アプリを企画する
iTamabi 13 第8回:ARTSAT API 実践 2 衛星アプリを企画する
Atsushi Tadokoro
 
Media Art II openFrameworks 複数のシーンの管理・切替え
Media Art II openFrameworks 複数のシーンの管理・切替えMedia Art II openFrameworks 複数のシーンの管理・切替え
Media Art II openFrameworks 複数のシーンの管理・切替え
Atsushi Tadokoro
 

Plus de Atsushi Tadokoro (20)

「クリエイティブ・ミュージック・コーディング」- オーディオ・ビジュアル作品のための、オープンソースなソフトウエア・フレームワークの現状と展望
「クリエイティブ・ミュージック・コーディング」- オーディオ・ビジュアル作品のための、オープンソースなソフトウエア・フレームワークの現状と展望「クリエイティブ・ミュージック・コーディング」- オーディオ・ビジュアル作品のための、オープンソースなソフトウエア・フレームワークの現状と展望
「クリエイティブ・ミュージック・コーディング」- オーディオ・ビジュアル作品のための、オープンソースなソフトウエア・フレームワークの現状と展望
 
プログラム初級講座 - メディア芸術をはじめよう
プログラム初級講座 - メディア芸術をはじめようプログラム初級講座 - メディア芸術をはじめよう
プログラム初級講座 - メディア芸術をはじめよう
 
Interactive Music II ProcessingとSuperColliderの連携 -2
Interactive Music II ProcessingとSuperColliderの連携 -2Interactive Music II ProcessingとSuperColliderの連携 -2
Interactive Music II ProcessingとSuperColliderの連携 -2
 
coma Creators session vol.2
coma Creators session vol.2coma Creators session vol.2
coma Creators session vol.2
 
Interactive Music II ProcessingとSuperColliderの連携1
Interactive Music II ProcessingとSuperColliderの連携1Interactive Music II ProcessingとSuperColliderの連携1
Interactive Music II ProcessingとSuperColliderの連携1
 
Interactive Music II Processingによるアニメーション
Interactive Music II ProcessingによるアニメーションInteractive Music II Processingによるアニメーション
Interactive Music II Processingによるアニメーション
 
Interactive Music II Processing基本
Interactive Music II Processing基本Interactive Music II Processing基本
Interactive Music II Processing基本
 
Interactive Music II SuperCollider応用 2 - SuperColliderとPure Dataの連携
Interactive Music II SuperCollider応用 2 - SuperColliderとPure Dataの連携Interactive Music II SuperCollider応用 2 - SuperColliderとPure Dataの連携
Interactive Music II SuperCollider応用 2 - SuperColliderとPure Dataの連携
 
Media Art II openFrameworks アプリ間の通信とタンジブルなインターフェイス
Media Art II openFrameworks  アプリ間の通信とタンジブルなインターフェイス Media Art II openFrameworks  アプリ間の通信とタンジブルなインターフェイス
Media Art II openFrameworks アプリ間の通信とタンジブルなインターフェイス
 
Interactive Music II SuperCollider応用 - SuperColliderと OSC (Open Sound Control)
Interactive Music II SuperCollider応用 - SuperColliderと OSC (Open Sound Control)Interactive Music II SuperCollider応用 - SuperColliderと OSC (Open Sound Control)
Interactive Music II SuperCollider応用 - SuperColliderと OSC (Open Sound Control)
 
iTamabi 13 ARTSAT API 実践 5 - 衛星の軌道を描く
iTamabi 13 ARTSAT API 実践 5 - 衛星の軌道を描くiTamabi 13 ARTSAT API 実践 5 - 衛星の軌道を描く
iTamabi 13 ARTSAT API 実践 5 - 衛星の軌道を描く
 
メディア芸術基礎 II 第11回:HTML5実践 表現のための様々なJavaScriptライブラリ
メディア芸術基礎 II 第11回:HTML5実践 表現のための様々なJavaScriptライブラリメディア芸術基礎 II 第11回:HTML5実践 表現のための様々なJavaScriptライブラリ
メディア芸術基礎 II 第11回:HTML5実践 表現のための様々なJavaScriptライブラリ
 
芸術情報演習デザイン(Web) 第8回: CSSフレームワークを使う
芸術情報演習デザイン(Web)  第8回: CSSフレームワークを使う芸術情報演習デザイン(Web)  第8回: CSSフレームワークを使う
芸術情報演習デザイン(Web) 第8回: CSSフレームワークを使う
 
Interactive Music II SuperCollider応用 JITLib - ライブコーディング 2
Interactive Music II SuperCollider応用 JITLib - ライブコーディング 2Interactive Music II SuperCollider応用 JITLib - ライブコーディング 2
Interactive Music II SuperCollider応用 JITLib - ライブコーディング 2
 
iTamabi 13 第9回:ARTSAT API 実践 3 ジオコーディングで衛星の位置を取得
iTamabi 13 第9回:ARTSAT API 実践 3 ジオコーディングで衛星の位置を取得iTamabi 13 第9回:ARTSAT API 実践 3 ジオコーディングで衛星の位置を取得
iTamabi 13 第9回:ARTSAT API 実践 3 ジオコーディングで衛星の位置を取得
 
Tamabi media131118
Tamabi media131118Tamabi media131118
Tamabi media131118
 
Webデザイン 第10回:HTML5実践 Three.jsで3Dプログラミング
Webデザイン 第10回:HTML5実践 Three.jsで3DプログラミングWebデザイン 第10回:HTML5実践 Three.jsで3Dプログラミング
Webデザイン 第10回:HTML5実践 Three.jsで3Dプログラミング
 
Interactive Music II SuperCollider応用 JITLib - ライブコーディング 1
Interactive Music II SuperCollider応用 JITLib - ライブコーディング 1Interactive Music II SuperCollider応用 JITLib - ライブコーディング 1
Interactive Music II SuperCollider応用 JITLib - ライブコーディング 1
 
iTamabi 13 第8回:ARTSAT API 実践 2 衛星アプリを企画する
iTamabi 13 第8回:ARTSAT API 実践 2 衛星アプリを企画するiTamabi 13 第8回:ARTSAT API 実践 2 衛星アプリを企画する
iTamabi 13 第8回:ARTSAT API 実践 2 衛星アプリを企画する
 
Media Art II openFrameworks 複数のシーンの管理・切替え
Media Art II openFrameworks 複数のシーンの管理・切替えMedia Art II openFrameworks 複数のシーンの管理・切替え
Media Art II openFrameworks 複数のシーンの管理・切替え
 

Dernier

Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
kauryashika82
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
ZurliaSoop
 

Dernier (20)

Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Asian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptxAsian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptx
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Spatium Project Simulation student brief
Spatium Project Simulation student briefSpatium Project Simulation student brief
Spatium Project Simulation student brief
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 

Proga 0622

  • 1.
  • 2.
  • 3. F = -kx k F = -kx ma = -kx x = -sin k t m x = Csin(!t + " x
  • 4. springForce = -stiffness * stretch springForce = -stiffness * (position - restPosition)
  • 5. springForce = stiffness * (restPositon - position) velocity = friction * (velocity + springFroce)
  • 6. float stiffness = 0.1; // float damping = 0.9; // float velocity = 0.0; // float targetY; // float y; // void setup() { size(400, 400); noStroke(); } void draw() { fill(0, 12); rect(0, 0, width, height); fill(255); float force = stiffness * (targetY - y); // f = -kx velocity = damping * (velocity + force); // y += velocity; // rect(10, y, width - 20, 10); // targetY = mouseY; // Y }
  • 7.
  • 8. F = ma a=F/m acceleration = springForce / mass
  • 9. //2 float y1, y2; // float velocity1, velocity2; // float mass1 = 1.0; // 1 float mass2 = 6.0; // 2 float stiffness = 0.1; // float damping = 0.9; // void setup() { size(400, 400); noStroke(); } void draw() { fill(0, 12); rect(0, 0, width, height); fill(255); float targetY = mouseY; // // 1 float forceA = stiffness * (targetY - y1); // float accelerationY1 = forceA / mass1; // velocity1 = damping * (velocity1 + accelerationY1); // y1 += velocity1; //
  • 10. rect(0, y1, width/2, 15); // 2 float forceB = stiffness * (targetY - y2); // float accelerationY2 = forceB / mass2; // velocity2 = damping * (velocity2 + accelerationY2); // y2 += velocity2; // rect(width/2, y2, width/2, 15); }
  • 11.
  • 12.
  • 13. float stiffness = 0.05; float damping = 0.9; float mass = 3.0; float gravity = 0.0; float velocityX = 0.0, velocityY = 0.0; float targetX, targetY; float x, y; void setup() { size(600, 600); smooth(); } void draw() { background(0); //X float forceX = stiffness * (targetX - x); float accelerationX = forceX / mass; velocityX = damping * (velocityX + accelerationX); x += velocityX; //Y float forceY = stiffness * (targetY - y); forceY += gravity; float accelerationY = forceY / mass; velocityY = damping * (velocityY + accelerationY); y += velocityY;
  • 14. // noStroke(); fill(255); ellipse(x, y, 40, 40); // stroke(127); noFill(); line(mouseX, mouseY, x, y); // targetX = mouseX; targetY = mouseY; }
  • 15.
  • 16.
  • 17. //Spring2D Spring2D s1, s2; float gravity = 5.0; float mass = 2.0; void setup() { size(400, 400); smooth(); fill(0); // x , y , , s1 = new Spring2D(0.0, width / 2, mass, gravity); s2 = new Spring2D(0.0, width / 2, mass, gravity); } void draw() { background(204); s1.update(mouseX, mouseY); s1.display(mouseX, mouseY); s2.update(s1.x, s1.y); s2.display(s1.x, s1.y); }
  • 18. // class Spring2D // class Spring2D { float vx, vy; float x, y; float gravity; float mass; float radius = 10; float stiffness = 0.2; float damping = 0.7; // Spring2D(float xpos, float ypos, float m, float g) { x = xpos; y = ypos; mass = m; gravity = g; } // void update(float targetX, float targetY) { float forceX = (targetX - x) * stiffness; float ax = forceX / mass; vx = damping * (vx + ax); x += vx; float forceY = (targetY - y) * stiffness;
  • 19. forceY += gravity; float ay = forceY / mass; vy = damping * (vy + ay); y += vy; } // void display(float nx, float ny) { noStroke(); ellipse(x, y, radius*2, radius*2); stroke(255); line(x, y, nx, ny); } }
  • 20.
  • 21.
  • 22. // int numSprings = 10; // Spring2D[] s = new Spring2D[numSprings]; float gravity = 5.0; float mass = 5.0; float stiffness = 0.2; float damping = 0.8; void setup() { size(600, 600); smooth(); fill(0); for (int i = 0; i < numSprings; i++) { s[i] = new Spring2D(width / 2, i*(height / numSprings), mass, gravity, stiffness, damping); } } void draw() { background(204); s[0].update(mouseX, mouseY); s[0].display(mouseX, mouseY); for (int i = 1; i < numSprings; i++) { s[i].update(s[i-1].x, s[i-1].y); s[i].display(s[i-1].x, s[i-1].y); } }
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28. import traer.physics.*; ParticleSystem physics; Particle mouse; Particle[] p; Spring[] s; void setup(){ size( 400, 400 ); smooth(); //Physics physics = new ParticleSystem( 1.0, 0.05 ); p = new Particle[10]; s = new Spring[10]; // for(int i = 0; i < p.length; i++){ p[i] = physics.makeParticle( 1.0, width/2, 20 * i, 0); if(i > 0){ s[i] = physics.makeSpring( p[i], p[i-1], 1.0, 0.1, 20); } } // p[0].makeFixed(); }
  • 29. void draw(){ background(0); physics.tick(); // p[0].moveTo(mouseX, mouseY, 0); // for(int i = 0; i < p.length; i++){ noStroke(); fill(128); ellipse( p[i].position().x(), p[i].position().y(), 10, 10 ); if(i > 0){ stroke(255); line(p[i].position().x(), p[i].position().y(), p[i-1].position().x(), p[i-1].position().y()); } } }
  • 30.
  • 31.
  • 32. p[0] p[1] p[2] p[3] ... p[n] p[1] p[2] p[3] p[4] for(int i = 0; i < n; i++){ ... • • for(j = i + 1; j < n; j++){ p[n] • p[2] p[3] • } p[4] • } p[5] ... ... p[n] p[n]
  • 33. import processing.opengl.*; import traer.physics.*; ParticleSystem physics; Particle[] particles; int num = 80; void setup(){ size(800, 800, OPENGL ); fill(255); smooth(); rectMode(CENTER); physics = new ParticleSystem(0, 0.0); particles = new Particle[num]; for (int i = 0; i < num; i++){ particles[i] = physics.makeParticle(0.2, random(width), random(height), 0); for (int j = i + 1; j < num; j++){ particles[j] = physics.makeParticle(0.2, random(width), random(height), 0); particles[j].setMass(0.5); physics.makeSpring(particles[i], particles[j], 0.1, 0.0, width/2); } } }
  • 34. void draw(){ physics.tick(0.01); background(0); for (int i = 0; i < num; i++){ rect(particles[i].position().x(), particles[i].position().y(), 8, 8); } }
  • 35.
  • 36.
  • 37. import processing.opengl.*; import traer.physics.*; ParticleSystem physics; Particle[] particles; int num = 80; void setup(){ size(800, 800, OPENGL ); fill(255); smooth(); rectMode(CENTER); physics = new ParticleSystem(0, 0.0); particles = new Particle[num]; for (int i = 0; i < num; i++){ particles[i] = physics.makeParticle(0.2, random(width), random(height), 0); for (int j = i + 1; j < num; j++){ particles[j] = physics.makeParticle(0.2, random(width), random(height), 0); particles[j].setMass(0.5); physics.makeSpring(particles[i], particles[j], 0.1, 0.0, width/2); } } }
  • 38. void draw(){ physics.tick(0.01); background(0); for (int i = 0; i < num; i++){ fill(255); noStroke(); rect(particles[i].position().x(), particles[i].position().y(), 8, 8); stroke(127,50); //Spring line for (int j = i + 1; j < num; j++){ line(particles[j].position().x(), particles[j].position().y(), particles[i].position().x(), particles[i].position().y()); } } }
  • 39.
  • 40.
  • 41. import processing.opengl.*; import traer.physics.*; ParticleSystem physics; Particle[] particles; int num = 80; void setup(){ size(800, 800, OPENGL ); fill(255); smooth(); rectMode(CENTER); physics = new ParticleSystem(0, 0.0); particles = new Particle[num]; for (int i = 0; i < num; i++){ particles[i] = physics.makeParticle(0.2, random(width), random(height), 0); for (int j = i + 1; j < num; j++){ particles[j] = physics.makeParticle(0.2, random(width), random(height), 0); particles[j].setMass(0.5); physics.makeSpring(particles[i], particles[j], 0.1, 0.0, width/2); } } }
  • 42. void draw(){ physics.tick(0.01); background(0); for (int i = 0; i < num; i++){ rect(particles[i].position().x(), particles[i].position().y(), 4, 4); for (int j = i + 1; j < num; j++){ float l = dist(particles[j].position().x(), particles[j].position().y(), particles[i].position().x(), particles[i].position().y()); stroke(255, 100 - l); line(particles[j].position().x(), particles[j].position().y(), particles[i].position().x(), particles[i].position().y()); } } }
  • 43.
  • 44.
  • 45. import processing.opengl.*; import traer.physics.*; ParticleSystem physics; Particle[] particles; int num = 80; void setup(){ size(800, 800, OPENGL ); smooth(); fill(255); rectMode(CENTER); physics = new ParticleSystem(0, 0.0); particles = new Particle[num]; for (int i = 0; i < num; i++){ particles[i] = physics.makeParticle(0.2, random(width), random(height), 0); for (int j = i + 1; j < num; j++){ particles[j] = physics.makeParticle(0.2, random(width), random(height), 0); particles[j].setMass(0.5); physics.makeAttraction(particles[i], particles[j], 1000, width); } } }
  • 46. void draw(){ physics.tick(1); background(0); for (int i = 0; i < num; i++) { rect(particles[i].position().x(), particles[i].position().y(), 3, 3); for (int j = i + 1; j < num; j++) { float l = dist(particles[j].position().x(), particles[j].position().y(), particles[i].position().x(), particles[i].position().y()); stroke(255, 100 - l); line(particles[j].position().x(), particles[j].position().y(), particles[i].position().x(), particles[i].position().y()); } } }