Skip to content

Commit

Permalink
]}-[><]-{[
Browse files Browse the repository at this point in the history
  • Loading branch information
bbaudry committed Nov 18, 2023
1 parent a549f7d commit acb9ee2
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 66 deletions.
10 changes: 5 additions & 5 deletions p5-experiments/balle.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
class Balle {
constructor(x) {
constructor() {
this.cx = random(offset, w - offset)
this.cy = 0//random(offset)
this.vitesse = random(3, 7)
this.diam = Math.floor(random(50, 290))
this.cy = 90//random(offset)
this.vitesse = random(3, 9)
this.diam = Math.floor(random(50, 210))
this.down = true
this.hu = Math.floor(random(0, 230))
this.hu = Math.floor(random(30, 230))
}

bouge() {
Expand Down
58 changes: 6 additions & 52 deletions p5-experiments/lfsldemo.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ function setup() {
centerCanvas();
colorMode(HSB, 360, 100, 100, 250);
background(0, 0, 0)
balle=new Balle(600)
balle=new Balle()
//noLoop()
}

Expand All @@ -21,18 +21,20 @@ function centerCanvas() {

var balles=[]
var offset=90
//var balle
var balle

function draw() {
background(0, 0, 0)
if(frameCount==1){ajouter_des_balles(7)}
/*if(frameCount==1){ajouter_des_balles(11)}
for(var i=0;i<balles.length;i++){
var balle=balles[i]
balle.bouge()
balle.dessine()
balle.rebondi()
balle.joue()
}
}*/
balle.dessine()

sol()
plafond()
}
Expand All @@ -51,55 +53,7 @@ function plafond(){

function ajouter_des_balles(nombre){
for(var b=1;b<=nombre;b++){
console.log("one more "+nombre)
balles.push(new Balle())
}
}



function avance_balles(){
for(var i=0;i<balles.length;i++){
var balle=balles[i]
balle.bouge()
rebondi(balle)
fill(balle.hu,100,100,84);noStroke()
ellipse(balle.cx,balle.cy,balle.diam,balle.diam)
}
}

function rebondi(balle){
if (balle.cy+balle.diam/2>h && balle.down){
balle.down=false
}
if (balle.cy-balle.diam/2<0 && !balle.down){
balle.down=true
}
}

















function ajouter_une_balle(){
balles.push({
cx:random(offset,w-offset),
cy:random(offset),
vitesse:random(3,7),
diam:Math.floor(random(50,90)),
down:true,
hu:Math.floor(random(0,230))
})
}
18 changes: 9 additions & 9 deletions p5-experiments/plottable005.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,15 @@
<script>
//297mm × 420mm
//pixel = dpi * mm / 25.4 mm
//h=300*297/25.4=3507.9
//w=300*210/25.4=2480.1

var h = 1053
var w = 744
//w=96*297/25.4=1122.5
//h=96*420/25.4=1587.4

var h = 1587
var w = 1122
var leftmargin = 36
var righttmargin = 36
var topmargin = 45
var bottommargin = 48
var cnv, svgbtn

function setup() {
Expand Down Expand Up @@ -54,10 +58,6 @@
save("plottable004.svg");
}

var leftmargin = 47
var righttmargin = 47
var topmargin = 48
var bottommargin = 55
var resolution = 50
var field = []

Expand Down

0 comments on commit acb9ee2

Please sign in to comment.